From f4bb363fd4d29d2fae5e6abd006c6e078679c987 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 6 Apr 2017 23:39:16 +0100 Subject: [PATCH] tidying --- src/src/expand.c | 14 ++++---------- src/src/mime.c | 14 +++----------- src/src/rfc2047.c | 14 +++++++------- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/src/expand.c b/src/src/expand.c index b96b2897a..1753aa307 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1554,11 +1554,9 @@ for (i = 0; i < 2; i++) int size = 0; header_line *h; - for (h = header_list; size < header_insert_maxlen && h != NULL; h = h->next) - { - if (h->type != htype_old && h->text != NULL) /* NULL => Received: placeholder */ - { - if (name == NULL || (len <= h->slen && strncmpic(name, h->text, len) == 0)) + for (h = header_list; size < header_insert_maxlen && h; h = h->next) + if (h->type != htype_old && h->text) /* NULL => Received: placeholder */ + if (!name || (len <= h->slen && strncmpic(name, h->text, len) == 0)) { int ilen; uschar *t; @@ -1580,7 +1578,7 @@ for (i = 0; i < 2; i++) that contains an address list, except when asked for raw headers. Only need to do this once. */ - if (!want_raw && name != NULL && comma == 0 && + if (!want_raw && name && comma == 0 && Ustrchr("BCFRST", h->type) != NULL) comma = 1; @@ -1613,8 +1611,6 @@ for (i = 0; i < 2; i++) } } } - } - } /* At end of first pass, return NULL if no header found. Then truncate size if necessary, and get the buffer to hold the data, returning the buffer size. @@ -1632,9 +1628,7 @@ for (i = 0; i < 2; i++) /* That's all we do for raw header expansion. */ if (want_raw) - { *ptr = 0; - } /* Otherwise, remove a final newline and a redundant added comma. Then we do RFC 2047 decoding, translating the charset if requested. The rfc2047_decode2() diff --git a/src/src/mime.c b/src/src/mime.c index 821cb541d..3a30e6e4c 100644 --- a/src/src/mime.c +++ b/src/src/mime.c @@ -157,24 +157,16 @@ while (fgets(CS ibuf, MIME_MAX_LINE_LENGTH, in) != NULL) { /* Error from decoder. ipos is unchanged. */ mime_set_anomaly(MIME_ANOMALY_BROKEN_QP); - *opos = '='; - ++opos; + *opos++ = '='; ++ipos; } else if (decode_qp_result == -1) break; else if (decode_qp_result >= 0) - { - *opos = decode_qp_result; - ++opos; - } + *opos++ = decode_qp_result; } else - { - *opos = *ipos; - ++opos; - ++ipos; - } + *opos++ = *ipos++; } /* something to write? */ len = opos - obuf; diff --git a/src/src/rfc2047.c b/src/src/rfc2047.c index 5c987e292..041a18858 100644 --- a/src/src/rfc2047.c +++ b/src/src/rfc2047.c @@ -50,7 +50,7 @@ ptr = *ptrptr = store_get(Ustrlen(string) + 1); /* No longer than this */ while (*string != 0) { - register int ch = *string++; + int ch = *string++; if (ch == '_') *ptr++ = ' '; else if (ch == '=') @@ -197,9 +197,9 @@ uschar *mimeword, *q1, *q2, *endword; *error = NULL; mimeword = decode_mimeword(string, lencheck, &q1, &q2, &endword, &dlen, &dptr); -if (mimeword == NULL) +if (!mimeword) { - if (lenptr != NULL) *lenptr = size; + if (lenptr) *lenptr = size; return string; } @@ -210,7 +210,7 @@ string building code. */ yield = store_get(++size); -while (mimeword != NULL) +while (mimeword) { #if HAVE_ICONV @@ -317,7 +317,7 @@ while (mimeword != NULL) string = endword + 2; mimeword = decode_mimeword(string, lencheck, &q1, &q2, &endword, &dlen, &dptr); - if (mimeword != NULL) + if (mimeword) { uschar *s = string; while (isspace(*s)) s++; @@ -330,8 +330,8 @@ the length as well if requested. */ yield = string_cat(yield, &size, &ptr, string); yield[ptr] = 0; -if (lenptr != NULL) *lenptr = ptr; -if (sizeptr != NULL) *sizeptr = size; +if (lenptr) *lenptr = ptr; +if (sizeptr) *sizeptr = size; return yield; } -- 2.25.1