From: Ralph Corderoy Date: Sun, 13 Nov 2016 23:05:37 +0000 (+0000) Subject: Split a few more if-then statements into two lines to help gcov. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a59060598f60ebb02d85ff7f1efb2f9ca2f699f4?hp=cb264ca67270e08ee6e629bf0f183054b63c6f07 Split a few more if-then statements into two lines to help gcov. It's interesting to see how often some of them have the then-branch taken. --- diff --git a/sbr/base64.c b/sbr/base64.c index e8ddee7a..a1e54c92 100644 --- a/sbr/base64.c +++ b/sbr/base64.c @@ -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); } } diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 4c775e4f..f640a2aa 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -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