<<< Date Index >>>     <<< Thread Index >>>

Re: [Mutt] #2515: Sorting by from or to in index is sometimes



#2515: Sorting by from or to in index is sometimes incorrect

Comment (by Christoph Berg):

 {{{
 # HG changeset patch
 # User Christoph Berg <cb@xxxxxxxx>
 # Date 1179397876 -7200
 # Node ID 79dcca404278728bbf65995eec4771830a4ec499
 # Parent  33af2883d52b99ece0a935818a91293b502603aa
 Apply patch by pywatson@xxxxxxxxx to strdup strings when sorting.
 Closes #1515. (Debian #196545.)

 diff -r 33af2883d52b -r 79dcca404278 sort.c
 --- a/sort.c    Tue May 15 21:05:53 2007 +0200
 +++ b/sort.c    Thu May 17 12:31:16 2007 +0200
 @@ -114,9 +114,10 @@ int compare_to (const void *a, const voi
    const char *fa, *fb;
    int result;

 -  fa = mutt_get_name ((*ppa)->env->to);
 +  fa = safe_strdup (mutt_get_name ((*ppa)->env->to));
    fb = mutt_get_name ((*ppb)->env->to);
    result = mutt_strcasecmp (fa, fb);
 +  FREE(&fa);
    AUXSORT(result,a,b);
    return (SORTCODE (result));
  }
 @@ -128,9 +129,10 @@ int compare_from (const void *a, const v
    const char *fa, *fb;
    int result;

 -  fa = mutt_get_name ((*ppa)->env->from);
 +  fa = safe_strdup (mutt_get_name ((*ppa)->env->from));
    fb = mutt_get_name ((*ppb)->env->from);
    result = mutt_strcasecmp (fa, fb);
 +  FREE(&fa);
    AUXSORT(result,a,b);
    return (SORTCODE (result));
  }
 }}}

-- 
Ticket URL: <http://dev.mutt.org/trac/ticket/2515#comment:>