]> granicus.if.org Git - neomutt/commitdiff
tidy code
authorRichard Russon <rich@flatcap.org>
Wed, 17 Feb 2016 19:57:38 +0000 (19:57 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 02:34:28 +0000 (03:34 +0100)
curs_lib.c

index 0f4da466a57ad72f9372b12558048cee9ef8c36f..1ab6d2da6906c99127d14814aa863221d89e939b 100644 (file)
@@ -411,50 +411,51 @@ void mutt_progress_init (progress_t* progress, const char *msg,
   mutt_progress_update (progress, 0, 0);
 }
 
-static void message_bar (int percent, const char *fmt, ...)
+/**
+ * message_bar - XXX
+ */
+static void
+message_bar (int percent, const char *fmt, ...)
 {
-  va_list ap;
-  char buf[STRING], buf2[STRING];
-  int w = percent * COLS / 100;
-  size_t l;
-
-  va_start (ap, fmt);
-  vsnprintf (buf, sizeof (buf), fmt, ap);
-  l = mutt_strwidth (buf);
-  va_end (ap);
-
-  mutt_format_string(buf2, sizeof (buf2),
-    0, COLS-2, FMT_LEFT, 0, buf, sizeof (buf), 0);
-
-  move (LINES - 1, 0);
-
-  if (l < w)
-  {
-    SETCOLOR(MT_COLOR_PROGRESS);
-    addstr (buf2);
-    w -= l;
-    while (w--)
-      addch(' ');
-    SETCOLOR(MT_COLOR_NORMAL);
-    clrtoeol ();
-    mutt_refresh();
-  }
-  else
-  {
-    size_t bw;
-    char ch;
-    int off = mutt_wstr_trunc (buf2, sizeof (buf2), w, &bw);
-
-    ch = buf2[off];
-    buf2[off] = 0;
-    SETCOLOR(MT_COLOR_PROGRESS);
-    addstr (buf2);
-    buf2[off] = ch;
-    SETCOLOR(MT_COLOR_NORMAL);
-    addstr (&buf2[off]);
-    clrtoeol ();
-    mutt_refresh();
-  }
+       va_list ap;
+       char buf[STRING], buf2[STRING];
+       int w = percent * COLS / 100;
+       size_t l;
+
+       va_start (ap, fmt);
+       vsnprintf (buf, sizeof (buf), fmt, ap);
+       l = mutt_strwidth (buf);
+       va_end (ap);
+
+       mutt_format_string (buf2, sizeof (buf2), 0, COLS-2, FMT_LEFT, 0, buf, sizeof (buf), 0);
+
+       move (LINES - 1, 0);
+
+       if (l < w) {
+               SETCOLOR(MT_COLOR_PROGRESS);
+               addstr (buf2);
+               w -= l;
+               while (w--) {
+                       addch (' ');
+               }
+               SETCOLOR(MT_COLOR_NORMAL);
+               clrtoeol();
+               mutt_refresh();
+       } else {
+               size_t bw;
+               char ch;
+               int off = mutt_wstr_trunc (buf2, sizeof (buf2), w, &bw);
+
+               ch = buf2[off];
+               buf2[off] = 0;
+               SETCOLOR(MT_COLOR_PROGRESS);
+               addstr (buf2);
+               buf2[off] = ch;
+               SETCOLOR(MT_COLOR_NORMAL);
+               addstr (&buf2[off]);
+               clrtoeol();
+               mutt_refresh();
+       }
 }
 
 void mutt_progress_update (progress_t* progress, long pos, int percent)
@@ -507,9 +508,9 @@ void mutt_progress_update (progress_t* progress, long pos, int percent)
 
     if (progress->size > 0)
     {
-      message_bar (percent > 0 ? percent : (int) (100.0 * (double) progress->pos / progress->size),
+      message_bar ((percent > 0) ? percent : (int) (100.0 * (double) progress->pos / progress->size),
         "%s %s/%s (%d%%)", progress->msg, posstr, progress->sizestr,
-        percent > 0 ? percent : (int) (100.0 * (double) progress->pos / progress->size));
+        (percent > 0) ? percent : (int) (100.0 * (double) progress->pos / progress->size));
     }
     else
     {