]> granicus.if.org Git - mutt/commitdiff
Unconditionally define M_IMAP, M_POP.
authorBrendan Cully <brendan@kublai.com>
Sun, 9 Aug 2009 03:58:19 +0000 (20:58 -0700)
committerBrendan Cully <brendan@kublai.com>
Sun, 9 Aug 2009 03:58:19 +0000 (20:58 -0700)
These aren't bloat, and not having them creates a lot of #ifdef clutter.

buffy.c
muttlib.c
mx.c
mx.h
status.c

diff --git a/buffy.c b/buffy.c
index 8cb0dec104c7b735e84b56c704af1e31f8f77988..959c7d60f9e532c89bbee8abca77125567e50167 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -315,14 +315,11 @@ int mutt_buffy_check (int force)
 
 #ifdef USE_IMAP
   BuffyCount += imap_buffy_check (force);
-
-  if (!Context || Context->magic != M_IMAP)
-#endif
-#ifdef USE_POP
-  if (!Context || Context->magic != M_POP)
 #endif
+
   /* check device ID and serial number instead of comparing paths */
-  if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0)
+  if (!Context || Context->magic != M_IMAP || Context->magic != M_POP
+      || stat (Context->path, &contex_sb) != 0)
   {
     contex_sb.st_dev=0;
     contex_sb.st_ino=0;
@@ -330,56 +327,34 @@ int mutt_buffy_check (int force)
   
   for (tmp = Incoming; tmp; tmp = tmp->next)
   {
-#ifdef USE_IMAP
     if (tmp->magic != M_IMAP)
-#endif
-    tmp->new = 0;
+      tmp->new = 0;
 
-#ifdef USE_IMAP
     if (tmp->magic != M_IMAP)
     {
-#endif
 #ifdef USE_POP
-    if (mx_is_pop (tmp->path))
-      tmp->magic = M_POP;
-    else
+      if (mx_is_pop (tmp->path))
+       tmp->magic = M_POP;
+      else
 #endif
-    if (stat (tmp->path, &sb) != 0 || (S_ISREG(sb.st_mode) && sb.st_size == 0) ||
-       (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0))
-    {
-      /* if the mailbox still doesn't exist, set the newly created flag to
-       * be ready for when it does. */
-      tmp->newly_created = 1;
-      tmp->magic = 0;
-      tmp->size = 0;
-      continue;
-    }
-#ifdef USE_IMAP
+      if (stat (tmp->path, &sb) != 0 || (S_ISREG(sb.st_mode) && sb.st_size == 0) ||
+         (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0))
+      {
+       /* if the mailbox still doesn't exist, set the newly created flag to
+        * be ready for when it does. */
+       tmp->newly_created = 1;
+       tmp->magic = 0;
+       tmp->size = 0;
+       continue;
+      }
     }
-#endif
 
     /* check to see if the folder is the currently selected folder
      * before polling */
     if (!Context || !Context->path ||
-#if defined USE_IMAP || defined USE_POP
-       ((
-#ifdef USE_IMAP
-       tmp->magic == M_IMAP
-#endif
-#ifdef USE_POP
-#ifdef USE_IMAP
-       ||
-#endif
-       tmp->magic == M_POP
-#endif
-       ) ? mutt_strcmp (tmp->path, Context->path) :
-#endif
-        (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)
-#if defined USE_IMAP || defined USE_POP         
-           )
-#endif
-       )
-       
+       (( tmp->magic == M_IMAP || tmp->magic == M_POP )
+           ? mutt_strcmp (tmp->path, Context->path) :
+             (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)))
     {
       switch (tmp->magic)
       {
index 3b9a140aeaec0b8fda75c2416e461cfdadc71e74..a081abefe69a6622ff734bd25d59323b9b8066f5 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -1511,10 +1511,7 @@ int mutt_save_confirm (const char *s, struct stat *st)
       return 1;
     }
   }
-  else
-#ifdef USE_IMAP
-  if (magic != M_IMAP)
-#endif /* execute the block unconditionally if we don't use imap */
+  else if (magic != M_IMAP)
   {
     st->st_mtime = 0;
     st->st_atime = 0;
diff --git a/mx.c b/mx.c
index 27d827acbf77a60cb390f5dc181120a8ede790ec..117aa38aa18b9bc6707d014403fce1c687da1cfb 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1116,10 +1116,8 @@ int mx_sync_mailbox (CONTEXT *ctx, int *index_hint)
     {
       if (!ctx->changed)
        return 0; /* nothing to do! */
-#ifdef USE_IMAP
       /* let IMAP servers hold on to D flags */
       if (ctx->magic != M_IMAP)
-#endif
       {
         for (i = 0 ; i < ctx->msgcount ; i++)
           ctx->hdrs[i]->deleted = 0;
@@ -1177,10 +1175,8 @@ int mx_sync_mailbox (CONTEXT *ctx, int *index_hint)
      */
     if (purge || (ctx->magic != M_MAILDIR && ctx->magic != M_MH))
     {
-#ifdef USE_IMAP
       /* IMAP does this automatically after handling EXPUNGE */
       if (ctx->magic != M_IMAP)
-#endif
       {
        mx_update_tables (ctx, 1);
        mutt_sort_headers (ctx, 1); /* rethread from scratch */
@@ -1476,13 +1472,7 @@ int mx_close_message (MESSAGE **msg)
   int r = 0;
 
   if ((*msg)->magic == M_MH || (*msg)->magic == M_MAILDIR
-#ifdef USE_IMAP
-      || (*msg)->magic == M_IMAP
-#endif
-#ifdef USE_POP
-      || (*msg)->magic == M_POP
-#endif
-      )
+      || (*msg)->magic == M_IMAP || (*msg)->magic == M_POP)
   {
     r = safe_fclose (&(*msg)->fp);
   }
diff --git a/mx.h b/mx.h
index a4d4ee8ef78e4da35cf66c13c06d597e621fa88f..136ae5fbca7250df4fa9efa83839593d6d56af91 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -33,13 +33,9 @@ enum
   M_MBOX = 1,
   M_MMDF,
   M_MH,
-  M_MAILDIR
-#ifdef USE_IMAP
-  , M_IMAP
-#endif
-#ifdef USE_POP
-  , M_POP
-#endif
+  M_MAILDIR,
+  M_IMAP,
+  M_POP
 };
 
 WHERE short DefaultMagic INITVAL (M_MBOX);
index db5cbfbfaeae37b2ec012ca1e2637b83817dff62..63f228e580f23c7efe4171b2699f0d7a15c38534 100644 (file)
--- a/status.c
+++ b/status.c
@@ -214,12 +214,10 @@ status_format_str (char *buf, size_t buflen, size_t col, char op, const char *sr
       if (Context)
       {
        i = option(OPTATTACHMSG) ? 3 : ((Context->readonly ||
-          Context->dontwrite) ? 2 : (Context->changed || (
-#ifdef USE_IMAP
-        /* deleted doesn't necessarily mean changed in IMAP */
-          Context->magic != M_IMAP &&
-#endif
-          Context->deleted)) ? 1 : 0);
+          Context->dontwrite) ? 2 : (Context->changed ||
+          /* deleted doesn't necessarily mean changed in IMAP */
+          (Context->magic != M_IMAP &&
+           Context->deleted)) ? 1 : 0);
       }
       
       if (!StChars)