]> granicus.if.org Git - neomutt/commitdiff
indent: sync to surroundings
authorRichard Russon <rich@flatcap.org>
Tue, 1 Dec 2015 03:23:52 +0000 (03:23 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 02:37:42 +0000 (03:37 +0100)
NOTE: this patch does NOT make any code changes.
If only adds/removes whitespace.

Tidy our code in mutt functions as best we can.
Importantly, match up the indent to the surrounding code.

Delete trailing whitespace
{} in compact style
Tidy whitespace around ()'s and maths operators

buffy.c
buffy.h
curs_main.c
flags.c
imap/command.c
main.c
menu.c
mutt_curses.h
mx.c
pager.c

diff --git a/buffy.c b/buffy.c
index 47933a19f4633d7198e211c29b115cd0ca1b3da9..62952e9997be5063e98d79b467f21bd5da17eb80 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -248,7 +248,7 @@ static BUFFY *buffy_new (const char *path)
 
   buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
   strfcpy (buffy->path, path, sizeof (buffy->path));
-  r = realpath(path, rp);
+  r = realpath (path, rp);
   strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
   buffy->next = NULL;
   buffy->magic = 0;
@@ -333,7 +333,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
     else
       (*tmp)->size = 0;
   }
-  Incoming = buffy_sort(Incoming);
+  Incoming = buffy_sort (Incoming);
   return 0;
 }
 
@@ -358,9 +358,9 @@ static int buffy_maildir_dir_hasnew(BUFFY* mailbox, const char *dir_name)
       return 0;
   }
 
-  if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
-      mailbox->new = 1;
-      return 1;
+  if (option (OPTSIDEBAR) && mailbox->msg_unread > 0) {
+    mailbox->new = 1;
+    return 1;
   }
 
   if ((dirp = opendir (path)) == NULL)
@@ -489,7 +489,7 @@ static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
   else
     statcheck = sb->st_mtime > sb->st_atime
       || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
-  if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
+  if ((!option (OPTSIDEBAR) && statcheck) || (option (OPTSIDEBAR) && mailbox->msg_unread > 0))
   {
     if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
     {
@@ -604,8 +604,8 @@ int mutt_buffy_check (int force)
       case M_MBOX:
       case M_MMDF:
        if (sidebar_should_refresh()) {
-               buffy_mbox_update (tmp, &sb);
-               sidebar_updated();
+         buffy_mbox_update (tmp, &sb);
+         sidebar_updated();
        }
        if (buffy_mbox_hasnew (tmp, &sb) > 0)
          BuffyCount++;
@@ -613,8 +613,8 @@ int mutt_buffy_check (int force)
 
       case M_MAILDIR:
        if (sidebar_should_refresh()) {
-               buffy_maildir_update (tmp);
-               sidebar_updated();
+         buffy_maildir_update (tmp);
+         sidebar_updated();
        }
        if (buffy_maildir_hasnew (tmp) > 0)
          BuffyCount++;
@@ -622,10 +622,10 @@ int mutt_buffy_check (int force)
 
       case M_MH:
        if (sidebar_should_refresh()) {
-               mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
-               sidebar_updated();
+         mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
+         sidebar_updated();
        }
-        mh_buffy(tmp);
+       mh_buffy(tmp);
        if (tmp->new)
          BuffyCount++;
        break;
diff --git a/buffy.h b/buffy.h
index 03c37dfe73924b06d281ee77fd2cb6980eed5fa5..846710809588f830d6963a8648d09cc745464eb7 100644 (file)
--- a/buffy.h
+++ b/buffy.h
@@ -35,7 +35,7 @@ typedef struct buffy_t
   short magic;                 /* mailbox type */
   short newly_created;         /* mbox or mmdf just popped into existence */
   time_t last_visited;         /* time of last exit from this mailbox */
-  time_t sb_last_checked;      /* time of last buffy check from sidebar */
+  time_t sb_last_checked;      /* time of last buffy check from sidebar */
 }
 BUFFY;
 
index e417e89fd102f3aeaa639829ff881f8b5118f5ea..c8482356e02cfd8b558b08da8de5e78fed7f33dd 100644 (file)
@@ -608,7 +608,7 @@ int mutt_index_menu (void)
        do_buffy_notify = 1;
     }
 
-    if(option(OPTSIDEBAR))
+    if (option (OPTSIDEBAR))
         menu->redraw |= REDRAW_SIDEBAR;
 
     if (op != -1)
@@ -617,11 +617,11 @@ int mutt_index_menu (void)
     if (menu->redraw & REDRAW_FULL)
     {
       menu_redraw_full (menu);
-      draw_sidebar(menu->menu);
+      draw_sidebar (menu->menu);
       mutt_show_error ();
-    } else if(menu->redraw & REDRAW_SIDEBAR) {
-        draw_sidebar(menu->menu);
-        menu->redraw &= ~REDRAW_SIDEBAR;
+    } else if (menu->redraw & REDRAW_SIDEBAR) {
+      draw_sidebar (menu->menu);
+      menu->redraw &= ~REDRAW_SIDEBAR;
     }
 
     if (menu->menu == MENU_MAIN)
@@ -648,7 +648,7 @@ int mutt_index_menu (void)
         DrawFullLine = 0;
        move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
        SETCOLOR (MT_COLOR_STATUS);
-        set_buffystats(Context);
+       set_buffystats (Context);
        mutt_paddstr (COLS, buf);
        NORMAL_COLOR;
        menu->redraw &= ~REDRAW_STATUS;
@@ -1107,7 +1107,7 @@ int mutt_index_menu (void)
          break;
 
        CHECK_MSGCOUNT;
-        CHECK_VISIBLE;
+       CHECK_VISIBLE;
        CHECK_READONLY;
        {
          int oldvcount = Context->vcount;
@@ -1199,11 +1199,12 @@ int mutt_index_menu (void)
        {
          mutt_buffy (buf, sizeof (buf));
 
-          if ( op == OP_SIDEBAR_OPEN ) {
-              if(!CurBuffy)
-                break;
-            strncpy( buf, CurBuffy->path, sizeof(buf) );  
-           } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
+         if (op == OP_SIDEBAR_OPEN) {
+           if (!CurBuffy)
+             break;
+           strncpy (buf, CurBuffy->path, sizeof (buf));
+         } else
+         if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
          {
            if (menu->menu == MENU_PAGER)
            {
@@ -1221,7 +1222,7 @@ int mutt_index_menu (void)
        }
 
        mutt_expand_path (buf, sizeof (buf));
-        set_curbuffy(buf);
+       set_curbuffy (buf);
        if (mx_get_magic (buf) <= 0)
        {
          mutt_error (_("%s is not a mailbox."), buf);
diff --git a/flags.c b/flags.c
index d67500018398b382ed9edc444dddc02d0cb70b70..8c7e4fa1797cce88bc817e972d76299786e721af 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -265,7 +265,7 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
    */
   if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged))
     h->searched = 0;
-       draw_sidebar(0);
+  draw_sidebar(0);
 }
 
 void mutt_tag_set_flag (int flag, int bf)
index 5068fca7c1ab0050a63d61347f506efa4a715da3..d52b29dc25cda0055ce5afb7b588f1306084d8d2 100644 (file)
@@ -1016,12 +1016,11 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s)
             opened */
          status->uidnext = oldun;
 
-        /* Added to make the sidebar show the correct numbers */
-        if (status->messages)
-        {
-          inc->msgcount = status->messages;
-          inc->msg_unread = status->unseen;
-        }
+       /* Added to make the sidebar show the correct numbers */
+       if (status->messages) {
+         inc->msgcount   = status->messages;
+         inc->msg_unread = status->unseen;
+       }
 
         FREE (&value);
         return;
diff --git a/main.c b/main.c
index cfe718c356f1c6421246051a1bb0270ead688946..694ffeb5684763ade1507ea0323ab53a5f49bc27 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1189,8 +1189,8 @@ int main (int argc, char **argv)
     {
       char tmpfolder[PATH_MAX];
       strfcpy (tmpfolder, folder, sizeof (tmpfolder));
-      if(!realpath(tmpfolder, folder))
-          strfcpy (folder, tmpfolder, sizeof (tmpfolder));
+      if (!realpath (tmpfolder, folder))
+        strfcpy (folder, tmpfolder, sizeof (tmpfolder));
     }
 
     mutt_str_replace (&CurrentFolder, folder);
@@ -1215,7 +1215,7 @@ int main (int argc, char **argv)
     if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
        || !explicit_folder)
     {
-      set_curbuffy(folder);
+      set_curbuffy (folder);
       mutt_index_menu ();
       if (Context)
        FREE (&Context);
diff --git a/menu.c b/menu.c
index 49012a8f97e8848adb1fb44e3e6f2c0966cb7802..2d90239d65d0c7f35f1c213f28d89ecbc72b548a 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -238,7 +238,7 @@ void menu_redraw_index (MUTTMENU *menu)
   int do_color;
   int attr;
 
-  draw_sidebar(1);
+  draw_sidebar (1);
   for (i = menu->top; i < menu->top + menu->pagelen; i++)
   {
     if (i < menu->max)
@@ -272,7 +272,7 @@ void menu_redraw_index (MUTTMENU *menu)
     else
     {
       NORMAL_COLOR;
-      CLEARLINE_WIN (i - menu->top + menu->offset);
+      CLEARLINE_WIN(i - menu->top + menu->offset);
     }
   }
   NORMAL_COLOR;
index 5b0472aacea8da16c1d5f4cded0acce864f137af..7fca545b27d3748ea73f82a352b8ba68cb94bdee 100644 (file)
@@ -64,7 +64,7 @@
 #undef lines
 #endif /* lines */
 
-#define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
+#define CLEARLINE_WIN(x) move (x,SidebarWidth), clrtoeol()
 #define CLEARLINE(x) move(x,0), clrtoeol()
 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
diff --git a/mx.c b/mx.c
index 5318ec349b11970e123f9c399d0f7e4f26bd4c93..ca788e953bb172f42541e6effbd641dd3281e32a 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -717,14 +717,14 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
   {
     ut.actime = ctx->atime;
     ut.modtime = ctx->mtime;
-    utime (ctx->path, &ut); 
+    utime (ctx->path, &ut);
   }
 #endif
 
   /* never announce that a mailbox we've just left has new mail. #3290
    * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
-  if(!ctx->peekonly)
-    mutt_buffy_setnotified(ctx->path);
+  if (!ctx->peekonly)
+  mutt_buffy_setnotified(ctx->path);
 
   if (ctx->mx_close)
     ctx->mx_close (ctx);
@@ -737,7 +737,7 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
   for (i = 0; i < ctx->msgcount; i++)
     mutt_free_header (&ctx->hdrs[i]);
   ctx->msgcount -= ctx->deleted;
-  set_buffystats(ctx);
+  set_buffystats (ctx);
   FREE (&ctx->hdrs);
   FREE (&ctx->v2r);
   FREE (&ctx->path);
diff --git a/pager.c b/pager.c
index 9d8bc333c0069154f41e8bcfe1abf6335db067c1..561dfa28ff24f56d650bc4343e5aa769a13f26c6 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1763,7 +1763,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
                            &QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
            lines++;
          curline++;
-         move(lines + bodyoffset, SidebarWidth);
+         move (lines + bodyoffset, SidebarWidth);
        }
        last_offset = lineInfo[curline].offset;
       } while (force_redraw);
@@ -1776,7 +1776,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
          addch ('~');
        addch ('\n');
        lines++;
-       move(lines + bodyoffset, SidebarWidth);
+       move (lines + bodyoffset, SidebarWidth);
       }
       NORMAL_COLOR;
 
@@ -1794,7 +1794,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
       hfi.ctx = Context;
       hfi.pager_progress = pager_progress_str;
 
-      statuswidth = COLS - (option(OPTSTATUSONTOP) && PagerIndexLines > 0 ? SidebarWidth : 0);
+      statuswidth = COLS - (option (OPTSTATUSONTOP) && PagerIndexLines > 0 ? SidebarWidth : 0);
 
       if (last_pos < sb.st_size - 1)
        snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
@@ -1804,11 +1804,11 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
       /* print out the pager status bar */
       move (statusoffset, SidebarWidth);
       SETCOLOR (MT_COLOR_STATUS);
-      if(option(OPTSTATUSONTOP) && PagerIndexLines > 0) {
-          CLEARLINE_WIN (statusoffset);
+      if (option (OPTSTATUSONTOP) && PagerIndexLines > 0) {
+        CLEARLINE_WIN (statusoffset);
       } else {
-          CLEARLINE (statusoffset);
-          DrawFullLine = 1; /* for mutt_make_string_info */
+        CLEARLINE (statusoffset);
+        DrawFullLine = 1; /* for mutt_make_string_info */
       }
 
       if (IsHeader (extra) || IsMsgAttach (extra))
@@ -1825,7 +1825,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
        snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
        mutt_paddstr (statuswidth, bn);
       }
-      if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
+      if (!option (OPTSTATUSONTOP) || PagerIndexLines == 0)
           DrawFullLine = 0; /* reset */
       NORMAL_COLOR;
       if (option(OPTTSENABLED) && TSSupported)
@@ -1842,7 +1842,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
       /* redraw the pager_index indicator, because the
        * flags for this message might have changed. */
       menu_redraw_current (index);
-      draw_sidebar(MENU_PAGER);
+      draw_sidebar (MENU_PAGER);
 
       /* print out the index status bar */
       menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
@@ -1855,8 +1855,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
     }
 
     /* if we're not using the index, update every time */
-    if ( index == 0 )
-      draw_sidebar(MENU_PAGER);
+    if (index == 0)
+      draw_sidebar (MENU_PAGER);
 
     redraw = 0;
 
@@ -2805,7 +2805,7 @@ search_next:
       case OP_SIDEBAR_SCROLL_DOWN:
       case OP_SIDEBAR_SCROLL_UP:
        scroll_sidebar(ch, MENU_PAGER);
-       break;
+       break;
 
       default:
        ch = -1;