]> diplodocus.org Git - nmh/commitdiff
Split a few more if-then statements into two lines to help gcov.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 13 Nov 2016 23:05:37 +0000 (23:05 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 19 Nov 2016 15:59:50 +0000 (15:59 +0000)
It's interesting to see how often some of them have the then-branch
taken.

sbr/base64.c
sbr/m_getfld.c

index e8ddee7ab4124734044190e565691a1d4f102a1f..a1e54c92fc0cf6371e6fbc0f06e54ff792a86888 100644 (file)
@@ -243,7 +243,8 @@ decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len,
     charstring_t decoded_c = charstring_create (strlen (encoded));
     MD5_CTX mdContext;
 
-    if (digest) { MD5Init (&mdContext); }
+    if (digest)
+        MD5Init (&mdContext);
 
     bitno = 18;
     bits = 0L;
@@ -274,19 +275,22 @@ test_end:
                     if (! skip_crs  ||  b != '\r') {
                         charstring_push_back (decoded_c, b);
                     }
-                    if (digest) { MD5Update (&mdContext, (unsigned char *) &b, 1); }
+                    if (digest)
+                        MD5Update (&mdContext, (unsigned char *) &b, 1);
                     if (skip < 2) {
                         b = (bits >> 8) & 0xff;
                         if (! skip_crs  ||  b != '\r') {
                             charstring_push_back (decoded_c, b);
                         }
-                        if (digest) { MD5Update (&mdContext, (unsigned char *) &b, 1); }
+                        if (digest)
+                            MD5Update (&mdContext, (unsigned char *) &b, 1);
                         if (skip < 1) {
                             b = bits & 0xff;
                             if (! skip_crs  ||  b != '\r') {
                                 charstring_push_back (decoded_c, b);
                             }
-                            if (digest) { MD5Update (&mdContext, (unsigned char *) &b, 1); }
+                            if (digest)
+                                MD5Update (&mdContext, (unsigned char *) &b, 1);
                         }
                     }
 
index 4c775e4f6cdbb91544511b59c30d88bc5352e05f..f640a2aab7e1251a7b85ac14d6b6dc90e9cdd820 100644 (file)
@@ -432,7 +432,8 @@ read_more (m_getfld_state_t s) {
     ssize_t retain = s->edelimlen;
     size_t num_read;
 
-    if (retain < s->end - s->readpos) retain = s->end - s->readpos;
+    if (retain < s->end - s->readpos)
+        retain = s->end - s->readpos;
     assert (retain <= s->readpos - s->msg_buf);
 
     /* Move what we want to retain at end of the buffer to the beginning. */
@@ -620,10 +621,12 @@ m_getfld (m_getfld_state_t *gstate, char name[NAMESZ], char *buf, int *bufsz,
            n = 0;
            for (finished = 0; ! finished; ) {
                while (c != '\n'  &&  c != EOF  &&  n++ < max) {
-                   if ((c = Getc (s)) != EOF) { *cp++ = c; }
+                   if ((c = Getc (s)) != EOF)
+                        *cp++ = c;
                }
 
-               if (c != EOF) c = Peek (s);
+               if (c != EOF)
+                    c = Peek (s);
                if (max < n) {
                    /* The dest buffer is full.  Need to back the read
                       pointer up by one because when m_getfld() is