]> granicus.if.org Git - neomutt/commitdiff
identical code for different branches
authorRichard Russon <rich@flatcap.org>
Fri, 15 Dec 2017 14:23:36 +0000 (14:23 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 28 Dec 2017 13:39:02 +0000 (13:39 +0000)
`SETCOLOR(MT_COLOR_NORMAL)` caused identical code to be generated in
both branches of an `if` statement.

curs_lib.c
main.c
mutt_curses.h
sidebar.c

index 4c780691792bd5e239ba04bd7820221df0e1f88e..2737381fd37c14e7577cfb553f3aeea799e59681 100644 (file)
@@ -525,7 +525,7 @@ static void message_bar(int percent, const char *fmt, ...)
       {
         addch(' ');
       }
-      SETCOLOR(MT_COLOR_NORMAL);
+      NORMAL_COLOR;
     }
     else
     {
@@ -538,7 +538,7 @@ static void message_bar(int percent, const char *fmt, ...)
       SETCOLOR(MT_COLOR_PROGRESS);
       addstr(buf2);
       buf2[off] = ch;
-      SETCOLOR(MT_COLOR_NORMAL);
+      NORMAL_COLOR;
       addstr(&buf2[off]);
     }
   }
diff --git a/main.c b/main.c
index 745c4f7742e5a5b425173341ffc931e978cfc7de..8079de4464380906a18395113cccc8dfb32d48b5 100644 (file)
--- a/main.c
+++ b/main.c
@@ -503,7 +503,7 @@ int main(int argc, char **argv, char **env)
 
   if (!option(OPT_NO_CURSES))
   {
-    SETCOLOR(MT_COLOR_NORMAL);
+    NORMAL_COLOR;
     clear();
     mutt_error = mutt_curses_error;
     mutt_message = mutt_curses_message;
index 83cc779b6438dd7b3c334221212df2cc2e557fae..eb6af86e7cdbc6e4bad73a5a2cf91d431b12c1d8 100644 (file)
@@ -309,6 +309,10 @@ void ci_start_color(void);
 #endif
 
 /* reset the color to the normal terminal color as defined by 'color normal ...' */
-#define NORMAL_COLOR SETCOLOR(MT_COLOR_NORMAL)
+#ifdef HAVE_BKGDSET
+#define NORMAL_COLOR bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' ')
+#else
+#define NORMAL_COLOR attrset(ColorDefs[MT_COLOR_NORMAL])
+#endif
 
 #endif /* _MUTT_CURSES_H */
index 2a286f08f0c1b061bf2fc3b521c7e340c0326966..436943e9bc8d23419146aade2257a131f45206cc 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -776,7 +776,7 @@ static int draw_divider(int num_rows, int num_cols)
 static void fill_empty_space(int first_row, int num_rows, int div_width, int num_cols)
 {
   /* Fill the remaining rows with blank space */
-  SETCOLOR(MT_COLOR_NORMAL);
+  NORMAL_COLOR;
 
   if (!option(OPT_SIDEBAR_ON_RIGHT))
     div_width = 0;
@@ -849,7 +849,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width)
       if (ColorDefs[MT_COLOR_ORDINARY] != 0)
         SETCOLOR(MT_COLOR_ORDINARY);
       else
-        SETCOLOR(MT_COLOR_NORMAL);
+        NORMAL_COLOR;
     }
 
     int col = 0;