Fix compilation warnings in mutt_idna.c
[apps/madmutt.git] / thread.c
index 965c897..ee923b1 100644 (file)
--- a/thread.c
+++ b/thread.c
 #endif
 
 #include <lib-lib/mem.h>
+#include <lib-lib/macros.h>
 
 #include "mutt.h"
 #include "sort.h"
 #include "thread.h"
 
-#include "lib/intl.h"
 
 #include <string.h>
 #include <ctype.h>
@@ -124,7 +124,7 @@ static void calculate_visibility (CONTEXT * ctx, int *max_depth)
     tree = tree->next;
   *max_depth = 0;
 
-  FOREVER {
+  for (;;) {
     if (depth > *max_depth)
       *max_depth = depth;
 
@@ -180,7 +180,7 @@ static void calculate_visibility (CONTEXT * ctx, int *max_depth)
   /* now fix up for the OPTHIDETOP* options if necessary */
   if (hide_top_limited || hide_top_missing) {
     tree = ctx->tree;
-    FOREVER {
+    for (;;) {
       if (!tree->visible && tree->deep && tree->subtree_visible < 2
           && ((tree->message && hide_top_limited)
               || (!tree->message && hide_top_missing)))
@@ -243,12 +243,12 @@ void mutt_draw_tree (CONTEXT * ctx)
         myarrow[width + 1] = 0;
         new_tree = p_new(char, (2 + depth * width));
         if (start_depth > 1) {
-          strncpy (new_tree, pfx, (start_depth - 1) * width);
-          strfcpy (new_tree + (start_depth - 1) * width,
-                   arrow, (1 + depth - start_depth) * width + 2);
+          memcpy(new_tree, pfx, (start_depth - 1) * width);
+          m_strcpy(new_tree + (start_depth - 1) * width,
+                   (1 + depth - start_depth) * width + 2, arrow);
         }
         else
-          strfcpy (new_tree, arrow, 2 + depth * width);
+          m_strcpy(new_tree, 2 + depth * width, arrow);
         tree->message->tree = new_tree;
       }
     }
@@ -324,7 +324,7 @@ static LIST *make_subject_list (THREAD * cur, time_t * dateptr)
   LIST *curlist, *oldlist, *newlist, *subjects = NULL;
   int rc = 0;
 
-  FOREVER {
+  for (;;) {
     while (!cur->message)
       cur = cur->child;
 
@@ -340,7 +340,7 @@ static LIST *make_subject_list (THREAD * cur, time_t * dateptr)
         ((env->real_subj != env->subject) || (!option (OPTSORTRE)))) {
       for (curlist = subjects, oldlist = NULL;
            curlist; oldlist = curlist, curlist = curlist->next) {
-        rc = str_cmp (env->real_subj, curlist->data);
+        rc = m_strcmp(env->real_subj, curlist->data);
         if (rc >= 0)
           break;
       }
@@ -400,7 +400,7 @@ static THREAD *find_subject (CONTEXT * ctx, THREAD * cur)
             (last->message->received < tmp->message->received) :
             (last->message->date_sent < tmp->message->date_sent))) &&
           tmp->message->env->real_subj &&
-          str_cmp (subjects->data, tmp->message->env->real_subj) == 0)
+          m_strcmp(subjects->data, tmp->message->env->real_subj) == 0)
         last = tmp;             /* best match so far */
     }
 
@@ -463,7 +463,7 @@ static void pseudo_threads (CONTEXT * ctx)
       insert_message (&parent->child, parent, cur);
       parent->sort_children = 1;
       tmp = cur;
-      FOREVER {
+      for (;;) {
         while (!tmp->message)
           tmp = tmp->child;
 
@@ -473,7 +473,7 @@ static void pseudo_threads (CONTEXT * ctx)
          * parent, since otherwise they rightly belong to the message
          * we're attaching. */
         if (tmp == cur
-            || !str_cmp (tmp->message->env->real_subj,
+            || !m_strcmp(tmp->message->env->real_subj,
                              parent->message->env->real_subj)) {
           tmp->message->subject_changed = 0;
 
@@ -671,7 +671,7 @@ static void check_subjects (CONTEXT * ctx, int init)
     if (!tmp)
       cur->subject_changed = 1;
     else if (cur->env->real_subj && tmp->message->env->real_subj)
-      cur->subject_changed = str_cmp (cur->env->real_subj,
+      cur->subject_changed = m_strcmp(cur->env->real_subj,
                                           tmp->message->env->
                                           real_subj) ? 1 : 0;
     else
@@ -823,7 +823,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init)
         if (!cur->env->references)
           ref = ref->next;
         else {
-          if (str_cmp (ref->data, cur->env->references->data))
+          if (m_strcmp(ref->data, cur->env->references->data))
             ref = cur->env->references;
           else
             ref = cur->env->references->next;
@@ -899,7 +899,7 @@ static HEADER *find_virtual (THREAD * cur, int reverse)
   while (reverse && cur->next)
     cur = cur->next;
 
-  FOREVER {
+  for (;;) {
     if (cur->message && cur->message->virtual >= 0)
       return (cur->message);
 
@@ -1081,7 +1081,7 @@ int _mutt_traverse_thread (CONTEXT * ctx, HEADER * cur, int flag)
       return (min_unread);
   }
 
-  FOREVER {
+  for (;;) {
     cur = thread->message;
 
     if (cur) {
@@ -1252,7 +1252,7 @@ static void clean_references (THREAD * brk, THREAD * cur)
     for (p = brk; !done && p; p = p->parent)
       for (ref = cur->message->env->references; p->message && ref;
            ref = ref->next)
-        if (!str_casecmp (ref->data, p->message->env->message_id)) {
+        if (!m_strcasecmp(ref->data, p->message->env->message_id)) {
           done = 1;
           break;
         }
@@ -1284,7 +1284,7 @@ static int link_threads (HEADER * parent, HEADER * child, CONTEXT * ctx)
   mutt_break_thread (child);
 
   child->env->in_reply_to = mutt_new_list ();
-  child->env->in_reply_to->data = str_dup (parent->env->message_id);
+  child->env->in_reply_to->data = m_strdup(parent->env->message_id);
 
   mutt_set_flag (ctx, child, M_TAG, 0);