X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sort.c;h=af0064612f3e381f0bdf14f9918f2eb3b3d9315c;hp=8a5957f13fb79bb498667fdb545a44e4d1030bcc;hb=d9960a434f5c00a534a0dabe02ae5ab8d4881569;hpb=9a1efcc01ddeca4106847f8eb28a704aca2dcf0b diff --git a/sort.c b/sort.c index 8a5957f..af00646 100644 --- a/sort.c +++ b/sort.c @@ -12,13 +12,13 @@ #endif #include +#include #include "mutt.h" #include "sort.h" #include "thread.h" #include "mutt_idna.h" -#include "lib/str.h" #include #include @@ -118,11 +118,8 @@ int compare_to (const void *a, const void *b) * On the next call that pointer may get smashed so we copy the return value * to our own memory space. */ - strncpy (fa, mutt_get_name ((*ppa)->env->to), sizeof (fa)); - fa[sizeof (fa) - 1] = '\0'; - - strncpy (fb, mutt_get_name ((*ppb)->env->to), sizeof (fb)); - fb[sizeof (fb) - 1] = '\0'; + m_strcpy(fa, sizeof(fa), mutt_get_name((*ppa)->env->to)); + m_strcpy(fb, sizeof(fb), mutt_get_name((*ppb)->env->to)); result = str_casecmp (fa, fb); AUXSORT (result, a, b); @@ -141,11 +138,8 @@ int compare_from (const void *a, const void *b) * On the next call that pointer may get smashed so we copy the return value * to our own memory space. */ - strncpy (fa, mutt_get_name ((*ppa)->env->from), sizeof (fa)); - fa[sizeof (fa) - 1] = '\0'; - - strncpy (fb, mutt_get_name ((*ppb)->env->from), sizeof (fb)); - fb[sizeof (fb) - 1] = '\0'; + m_strcpy(fa, sizeof(fa), mutt_get_name((*ppa)->env->from)); + m_strcpy(fb, sizeof(fb), mutt_get_name((*ppb)->env->from)); result = str_casecmp (fa, fb); AUXSORT (result, a, b); @@ -215,13 +209,13 @@ int compare_spam (const void *a, const void *b) /* If either aptr or bptr is equal to data, there is no numeric */ /* value for that spam attribute. In this case, compare lexically. */ if ((aptr == (*ppa)->env->spam->data) || (bptr == (*ppb)->env->spam->data)) - return (SORTCODE (str_cmp (aptr, bptr))); + return (SORTCODE (m_strcmp(aptr, bptr))); /* Otherwise, we have numeric value for both attrs. If these values */ /* are equal, then we first fall back upon string comparison, then */ /* upon auxiliary sort. */ if (result == 0) { - result = str_cmp (aptr, bptr); + result = m_strcmp(aptr, bptr); if (result == 0) AUXSORT (result, a, b); }