Changeset: c8f86d688f30 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8f86d688f30
Modified Files:
        tools/merovingian/daemon/merovingian.c
        tools/merovingian/daemon/merovingian.h
        tools/merovingian/daemon/multiplex-funnel.c
Branch: Jun2016
Log Message:

Layout, and a comment fix.


diffs (117 lines):

diff --git a/tools/merovingian/daemon/merovingian.c 
b/tools/merovingian/daemon/merovingian.c
--- a/tools/merovingian/daemon/merovingian.c
+++ b/tools/merovingian/daemon/merovingian.c
@@ -529,7 +529,7 @@ main(int argc, char *argv[])
                                int len;
                                len = snprintf(dbfarm, sizeof(dbfarm), "%s",
                                                argv[2 + merodontfork]);
-                       
+
                                if (len > 0 && (size_t)len >= sizeof(dbfarm)) {
                                        Mfprintf(stderr, "fatal: dbfarm exceeds 
allocated " \
                                                        "path length, please 
file a bug at " \
@@ -558,7 +558,7 @@ main(int argc, char *argv[])
        if (!merodontfork) {
                char buf[4];
 
-               /* Fork into the background immediately.  By doing this our 
child
+               /* Fork into the background immediately.  By doing this, our 
child
                 * can simply do everything it needs to do itself.  Via a pipe 
it
                 * will tell us if it is happy or not. */
                if (pipe(pfd) == -1) {
@@ -598,33 +598,38 @@ main(int argc, char *argv[])
        }
 
 /* use after the logger thread has started */
-#define MERO_EXIT(status) if (!merodontfork) { \
-               char s = status; \
-               if (write(retfd, &s, 1) != 1 || close(retfd) != 0) { \
-                       Mfprintf(stderr, "could not write to parent\n"); \
-               } \
-               if (status != 0) { \
-                       Mfprintf(stderr, "fatal startup condition encountered, 
" \
-                                       "aborting startup\n"); \
-                       goto shutdown; \
-               } \
-       } else { \
-               if (status != 0) { \
-                       Mfprintf(stderr, "fatal startup condition encountered, 
" \
-                                       "aborting startup\n"); \
-                       goto shutdown; \
-               } \
-       }
+#define MERO_EXIT(status)                                                      
                                        \
+       do {                                                                    
                                                        \
+               if (!merodontfork) {                                            
                                        \
+                       char s = status;                                        
                                                \
+                       if (write(retfd, &s, 1) != 1 || close(retfd) != 0) {    
        \
+                               Mfprintf(stderr, "could not write to 
parent\n");                \
+                       }                                                       
                                                                \
+                       if (status != 0) {                                      
                                                \
+                               Mfprintf(stderr, "fatal startup condition 
encountered, " \
+                                                "aborting startup\n");         
                                        \
+                               goto shutdown;                                  
                                                \
+                       }                                                       
                                                                \
+               } else {                                                        
                                                        \
+                       if (status != 0) {                                      
                                                \
+                               Mfprintf(stderr, "fatal startup condition 
encountered, " \
+                                                "aborting startup\n");         
                                        \
+                               goto shutdown;                                  
                                                \
+                       }                                                       
                                                                \
+               }                                                               
                                                                \
+       } while (0)
+
 /* use before logger thread has started */
-#define MERO_EXIT_CLEAN(status) if (!merodontfork) { \
-               char s = status; \
-               if (write(retfd, &s, 1) != 1 || close(retfd) != 0) { \
-                       Mfprintf(stderr, "could not write to parent\n"); \
-               } \
-               exit(s); \
-       } else { \
-               exit(status); \
-       }
+#define MERO_EXIT_CLEAN(status)                                                
                                \
+       do {                                                                    
                                                \
+               if (!merodontfork) {                                            
                                \
+                       char s = status;                                        
                                        \
+                       if (write(retfd, &s, 1) != 1 || close(retfd) != 0) {    
\
+                               Mfprintf(stderr, "could not write to 
parent\n");        \
+                       }                                                       
                                                        \
+               }                                                               
                                                        \
+               exit(status);                                                   
                                        \
+       } while (0)
 
        /* check if dbfarm actually exists */
        if (stat(dbfarm, &sb) == -1) {
diff --git a/tools/merovingian/daemon/merovingian.h 
b/tools/merovingian/daemon/merovingian.h
--- a/tools/merovingian/daemon/merovingian.h
+++ b/tools/merovingian/daemon/merovingian.h
@@ -35,10 +35,11 @@ typedef char* err;
 
 /* when not writing to stderr, one has to flush, make it easy to do so */
 #define Mfprintf(S, ...)                                               \
-       if( S)                                                                  
        \
        do {                                                                    
        \
-               fprintf(S, __VA_ARGS__);                                \
-               fflush(S);                                                      
        \
+               if (S) {                                                        
        \
+                       fprintf(S, __VA_ARGS__);                        \
+                       fflush(S);                                              
        \
+               }                                                               
                \
        } while (0)
 
 char *newErr(_In_z_ _Printf_format_string_ const char *fmt, ...)
diff --git a/tools/merovingian/daemon/multiplex-funnel.c 
b/tools/merovingian/daemon/multiplex-funnel.c
--- a/tools/merovingian/daemon/multiplex-funnel.c
+++ b/tools/merovingian/daemon/multiplex-funnel.c
@@ -867,7 +867,8 @@ multiplexAddClient(char *mp, int sock, s
        if (m->clients == NULL) {
                m->clients = n;
        } else {
-               for (w = m->clients; w->next != NULL; w = w->next);
+               for (w = m->clients; w->next != NULL; w = w->next)
+                       ;
                w->next = n;
        }
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to