From: Jeremy Harris Date: Tue, 26 Mar 2024 17:36:59 +0000 (+0000) Subject: tidying X-Git-Tag: exim-4.98-RC0~54 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/4687a69c269ee3f2a7f0625e0147a503fd9d3d0b?hp=c90c2288e88f66ae1d8af198cfa56c401e573ce4 tidying --- diff --git a/src/src/acl.c b/src/src/acl.c index 29441dfc1..d719a937b 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1366,7 +1366,7 @@ uschar * target = store_get(TARGET_SIZE, GET_TAINTED); client's HELO domain. If the client has not said HELO, use its IP address instead. If it's a local client (exim -bs), CSA isn't applicable. */ -while (isspace(*domain) && *domain != '\0') ++domain; +while (isspace(*domain) && *domain) ++domain; if (*domain == '\0') domain = sender_helo_name; if (!domain) domain = sender_host_address; if (!sender_host_address) return CSA_UNKNOWN; @@ -1867,9 +1867,10 @@ switch(vp->value) verify_sender_address = sender_address; else { - while (isspace(*s)) s++; - if (*s++ != '=') goto BAD_VERIFY; - while (isspace(*s)) s++; + if (Uskip_whitespace(&s) != '=') + goto BAD_VERIFY; + s++; + Uskip_whitespace(&s); verify_sender_address = string_copy(s); } } @@ -1911,13 +1912,13 @@ while ((ss = string_nextinlist(&list, &sep, NULL, 0))) callout = CALLOUT_TIMEOUT_DEFAULT; if (*(ss += 7)) { - while (isspace(*ss)) ss++; + Uskip_whitespace(&ss); if (*ss++ == '=') { const uschar * sublist = ss; int optsep = ','; - while (isspace(*sublist)) sublist++; + Uskip_whitespace(&sublist); for (uschar * opt; opt = string_nextinlist(&sublist, &optsep, NULL, 0); ) { callout_opt_t * op; @@ -1931,14 +1932,14 @@ while ((ss = string_nextinlist(&list, &sep, NULL, 0))) if (op->has_option) { opt += Ustrlen(op->name); - while (isspace(*opt)) opt++; + Uskip_whitespace(&opt); if (*opt++ != '=') { *log_msgptr = string_sprintf("'=' expected after " "\"%s\" in ACL verify condition \"%s\"", op->name, arg); return ERROR; } - while (isspace(*opt)) opt++; + Uskip_whitespace(&opt); } if (op->timeval && (period = v_period(opt, arg, log_msgptr)) < 0) return ERROR; @@ -1981,14 +1982,14 @@ while ((ss = string_nextinlist(&list, &sep, NULL, 0))) quota = TRUE; if (*(ss += 5)) { - while (isspace(*ss)) ss++; + Uskip_whitespace(&ss); if (*ss++ == '=') { const uschar * sublist = ss; int optsep = ','; int period; - while (isspace(*sublist)) sublist++; + Uskip_whitespace(&sublist); for (uschar * opt; opt = string_nextinlist(&sublist, &optsep, NULL, 0); ) if (Ustrncmp(opt, "cachepos=", 9) == 0) if ((period = v_period(opt += 9, arg, log_msgptr)) < 0) @@ -3892,7 +3893,7 @@ for (; cb; cb = cb->next) } s++; } - while (isspace(*s)) s++; + Uskip_whitespace(&s); if (logbits == 0) logbits = LOG_MAIN; log_write(0, logbits, "%s", string_printing(s)); @@ -4316,19 +4317,17 @@ if (!s) /* At top level, we expand the incoming string. At lower levels, it has already been expanded as part of condition processing. */ -if (acl_level == 0) +if (acl_level != 0) + ss = s; +else if (!(ss = expand_string(s))) { - if (!(ss = expand_string(s))) - { - if (f.expand_string_forcedfail) return OK; - *log_msgptr = string_sprintf("failed to expand ACL string \"%s\": %s", s, - expand_string_message); - return ERROR; - } + if (f.expand_string_forcedfail) return OK; + *log_msgptr = string_sprintf("failed to expand ACL string \"%s\": %s", s, + expand_string_message); + return ERROR; } -else ss = s; -while (isspace(*ss)) ss++; +Uskip_whitespace(&ss); /* If we can't find a named ACL, the default is to parse it as an inline one. (Unless it begins with a slash; non-existent files give rise to an error.) */ @@ -4617,8 +4616,8 @@ if (!(tmp = string_dequote(&s)) || !(name = expand_string(tmp))) for (i = 0; i < 9; i++) { - while (*s && isspace(*s)) s++; - if (!*s) break; + if (!Uskip_whitespace(&s)) + break; if (!(tmp = string_dequote(&s)) || !(tmp_arg[i] = expand_string(tmp))) { tmp = name; diff --git a/src/src/dbfn.c b/src/src/dbfn.c index 460fd8bb7..13a3c2d66 100644 --- a/src/src/dbfn.c +++ b/src/src/dbfn.c @@ -490,7 +490,7 @@ while (Ufgets(buffer, 256, stdin) != NULL) { count = Uatoi(cmd); while (isdigit((uschar)*cmd)) cmd++; - while (isspace((uschar)*cmd)) cmd++; + Uskip_whitespace(&cmd); } if (Ustrncmp(cmd, "open", 4) == 0) @@ -498,7 +498,7 @@ while (Ufgets(buffer, 256, stdin) != NULL) int i; open_db *odb; uschar *s = cmd + 4; - while (isspace((uschar)*s)) s++; + Uskip_whitespace(&s); for (i = 0; i < max_db; i++) if (dbblock[i].dbptr == NULL) break; @@ -534,8 +534,7 @@ while (Ufgets(buffer, 256, stdin) != NULL) else if (Ustrncmp(cmd, "write", 5) == 0) { int rc = 0; - uschar *key = cmd + 5; - uschar *data; + uschar * key = cmd + 5, * data; if (current < 0) { @@ -543,11 +542,11 @@ while (Ufgets(buffer, 256, stdin) != NULL) continue; } - while (isspace((uschar)*key)) key++; + Uskip_whitespace(&key); data = key; - while (*data != 0 && !isspace((uschar)*data)) data++; + while (*data && !isspace((uschar)*data)) data++; *data++ = 0; - while (isspace((uschar)*data)) data++; + Uskip_whitespace(&data); dbwait = (dbdata_wait *)(&structbuffer); Ustrcpy(dbwait->text, data); @@ -562,13 +561,13 @@ while (Ufgets(buffer, 256, stdin) != NULL) else if (Ustrncmp(cmd, "read", 4) == 0) { - uschar *key = cmd + 4; + uschar * key = cmd + 4; if (current < 0) { printf("No current database\n"); continue; } - while (isspace((uschar)*key)) key++; + Uskip_whitespace(&key); start = clock(); while (count-- > 0) dbwait = (dbdata_wait *)dbfn_read_with_length(dbblock+ current, key, NULL); @@ -578,13 +577,13 @@ while (Ufgets(buffer, 256, stdin) != NULL) else if (Ustrncmp(cmd, "delete", 6) == 0) { - uschar *key = cmd + 6; + uschar * key = cmd + 6; if (current < 0) { printf("No current database\n"); continue; } - while (isspace((uschar)*key)) key++; + Uskip_whitespace(&key); dbfn_delete(dbblock + current, key); } @@ -614,8 +613,8 @@ while (Ufgets(buffer, 256, stdin) != NULL) else if (Ustrncmp(cmd, "close", 5) == 0) { - uschar *s = cmd + 5; - while (isspace((uschar)*s)) s++; + uschar * s = cmd + 5; + Uskip_whitespace(&s); i = Uatoi(s); if (i >= max_db || dbblock[i].dbptr == NULL) printf("Not open\n"); else { @@ -629,8 +628,8 @@ while (Ufgets(buffer, 256, stdin) != NULL) else if (Ustrncmp(cmd, "file", 4) == 0) { - uschar *s = cmd + 4; - while (isspace((uschar)*s)) s++; + uschar * s = cmd + 4; + Uskip_whitespace(&s); i = Uatoi(s); if (i >= max_db || dbblock[i].dbptr == NULL) printf("Not open\n"); else current = i; @@ -682,3 +681,5 @@ return 0; #endif /* End of dbfn.c */ +/* vi: aw ai sw=2 +*/ diff --git a/src/src/exim.c b/src/src/exim.c index 3170bef98..5c9e64021 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -2632,14 +2632,11 @@ on the second character (the one after '-'), to save some effort. */ reset_point = store_mark(); while (Ufgets(big_buffer, big_buffer_size, trust_list)) { - uschar *start = big_buffer, *nl; - while (*start && isspace(*start)) - start++; - if (*start != '/') + uschar * start = big_buffer, * nl; + if (Uskip_whitespace(&start) != '/') continue; - nl = Ustrchr(start, '\n'); - if (nl) - *nl = 0; + if ((nl = Ustrchr(start, '\n'))) + *nl = '\0'; trusted_configs[nr_configs++] = string_copy(start); if (nr_configs == nelem(trusted_configs)) break; @@ -2698,7 +2695,7 @@ on the second character (the one after '-'), to save some effort. */ const uschar * s = argrest; opt_D_used = TRUE; - while (isspace(*s)) s++; + Uskip_whitespace(&s); if (*s < 'A' || *s > 'Z') exim_fail("exim: macro name set by -D must start with " @@ -2711,11 +2708,10 @@ on the second character (the one after '-'), to save some effort. */ } name[ptr] = 0; if (ptr == 0) { badarg = TRUE; break; } - while (isspace(*s)) s++; - if (*s != 0) + if (Uskip_whitespace(&s)) { if (*s++ != '=') { badarg = TRUE; break; } - while (isspace(*s)) s++; + Uskip_whitespace(&s); } for (m = macros_user; m; m = m->next) @@ -5918,7 +5914,7 @@ for (BOOL more = TRUE; more; ) receive_add_recipient(string_copy_taint(recipient, GET_TAINTED), -1); s = ss; if (!finished) - while (*(++s) != 0 && (*s == ',' || isspace(*s))); + while (*++s && (*s == ',' || isspace(*s))); } } diff --git a/src/src/expand.c b/src/src/expand.c index a916eee64..5ea4dc6d4 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1262,7 +1262,8 @@ while (*s) while (*s && *s != '=' && !isspace(*s)) s++; dkeylength = s - dkey; - if (Uskip_whitespace(&s) == '=') while (isspace(*++s)); + if (Uskip_whitespace(&s) == '=') + while (isspace(*++s)) ; data = string_dequote(&s); if (length == dkeylength && strncmpic(key, dkey, length) == 0) @@ -4114,7 +4115,7 @@ if (!*error) if (*s != ')') *error = US"expecting closing parenthesis"; else - while (isspace(*++s)); + while (isspace(*++s)) ; else if (*s) *error = US"expecting operator"; *sptr = s; diff --git a/src/src/filter.c b/src/src/filter.c index b56b593b8..18567f17c 100644 --- a/src/src/filter.c +++ b/src/src/filter.c @@ -276,16 +276,11 @@ nextsigchar(const uschar *ptr, BOOL comment_allowed) for (;;) { while (isspace(*ptr)) - { - if (*ptr == '\n') line_number++; - ptr++; - } + if (*ptr++ == '\n') line_number++; if (comment_allowed && *ptr == '#') - { - while (*(++ptr) != '\n' && *ptr != 0); - continue; - } - else break; + while (*++ptr != '\n' && *ptr) ; + else + break; } return ptr; } @@ -311,18 +306,19 @@ Returns: pointer to the next significant character after the word static const uschar * nextword(const uschar *ptr, uschar *buffer, int size, BOOL bracket) { -uschar *bp = buffer; -while (*ptr != 0 && !isspace(*ptr) && +uschar * bp = buffer; +while (*ptr && !isspace(*ptr) && (!bracket || (*ptr != '(' && *ptr != ')'))) - { - if (bp - buffer < size - 1) *bp++ = *ptr++; else + if (bp - buffer < size - 1) + *bp++ = *ptr++; + else { *error_pointer = string_sprintf("word is too long in line %d of " "filter file (max = %d chars)", line_number, size); break; } - } -*bp = 0; + +*bp = '\0'; return nextsigchar(ptr, TRUE); } @@ -410,8 +406,8 @@ int value, count; if (sscanf(CS s, "%i%n", &value, &count) != 1) return 0; if (tolower(s[count]) == 'k') { value *= 1024; count++; } if (tolower(s[count]) == 'm') { value *= 1024*1024; count++; } -while (isspace((s[count]))) count++; -if (s[count] != 0) return 0; +while (isspace(s[count])) count++; +if (s[count]) return 0; *ok = TRUE; return value; } @@ -2006,8 +2002,7 @@ while (commands) if (subtype == TRUE) { - while (isspace(*s)) s++; - if (*s) + if (Uskip_whitespace(&s)) { header_add(htype_other, "%s%s", s, s[Ustrlen(s)-1] == '\n' ? "" : "\n"); @@ -2226,7 +2221,7 @@ while (commands) gstring * log_addr = NULL; if (!to) to = expand_string(US"$reply_address"); - while (isspace(*to)) to++; + Uskip_whitespace(&to); for (tt = to; *tt; tt++) /* Get rid of newlines */ if (*tt == '\n') @@ -2298,7 +2293,7 @@ while (commands) /* Move on past this address */ tt = ss + (*ss ? 1 : 0); - while (isspace(*tt)) tt++; + Uskip_whitespace(&tt); } if (log_addr) @@ -2612,3 +2607,5 @@ return yield; /* End of filter.c */ +/* vi: aw ai sw=2 +*/ diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c index 050baa3b7..af1ad9dab 100644 --- a/src/src/lookups/dnsdb.c +++ b/src/src/lookups/dnsdb.c @@ -154,8 +154,7 @@ gstring * yield = string_get(256); /* If the string starts with '>' we change the output separator. If it's followed by ';' or ',' we set the TXT output separator. */ -while (isspace(*keystring)) keystring++; -if (*keystring == '>') +if (Uskip_whitespace(&keystring) == '>') { outsep = keystring + 1; keystring += 2; @@ -169,7 +168,7 @@ if (*keystring == '>') outsep2 = US""; keystring++; } - while (isspace(*keystring)) keystring++; + Uskip_whitespace(&keystring); } /* Check for a modifier keyword. */ @@ -234,14 +233,14 @@ for (;;) else break; - while (isspace(*keystring)) keystring++; + Uskip_whitespace(&keystring); if (*keystring++ != ',') { *errmsg = US"dnsdb modifier syntax error"; rc = DEFER; goto out; } - while (isspace(*keystring)) keystring++; + Uskip_whitespace(&keystring); } /* Figure out the "type" value if it is not T_TXT. @@ -272,7 +271,7 @@ if ((equals = Ustrchr(keystring, '=')) != NULL) } keystring = equals + 1; - while (isspace(*keystring)) keystring++; + Uskip_whitespace(&keystring); } /* Initialize the resolver in case this is the first time it has been used. */ diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c index b93782cc3..90cde6c86 100644 --- a/src/src/lookups/ldap.c +++ b/src/src/lookups/ldap.c @@ -1083,20 +1083,15 @@ control_ldap_search(const uschar *ldap_url, int search_type, uschar **res, uschar **errmsg) { BOOL defer_break = FALSE; -int timelimit = LDAP_NO_LIMIT; -int sizelimit = LDAP_NO_LIMIT; +int timelimit = LDAP_NO_LIMIT, sizelimit = LDAP_NO_LIMIT; int tcplimit = 0; int sep = 0; int dereference = LDAP_DEREF_NEVER; -void* referrals = LDAP_OPT_ON; -const uschar *url = ldap_url; -const uschar *p; -uschar *user = NULL; -uschar *password = NULL; -uschar *local_servers = NULL; -const uschar *list; +void * referrals = LDAP_OPT_ON; +const uschar * url = ldap_url, * p, * list; +uschar * user = NULL, * password = NULL, * local_servers = NULL; -while (isspace(*url)) url++; +Uskip_whitespace(&url); /* Until the string begins "ldap", search for the other parameter settings that are recognized. They are of the form NAME=VALUE, with the value being @@ -1175,7 +1170,7 @@ while (strncmpic(url, US"ldap", 4) != 0) DEBUG(D_lookup) debug_printf_indent("LDAP query error: %s\n", *errmsg); return DEFER; } - while (isspace(*url)) url++; + Uskip_whitespace(&url); continue; } } diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c index 33e8c5157..7b78de916 100644 --- a/src/src/lookups/lsearch.c +++ b/src/src/lookups/lsearch.c @@ -291,8 +291,8 @@ for (BOOL this_is_eol, last_was_eol = TRUE; this_is_comment = (this_is_comment || (buffer[0] == 0 || buffer[0] == '#')); if (this_is_comment) continue; if (!isspace((uschar)buffer[0])) break; - while (isspace((uschar)*s)) s++; - *(--s) = ' '; + Uskip_whitespace(&s); + *--s = ' '; } if (this_is_comment) continue; diff --git a/src/src/lookups/oracle.c b/src/src/lookups/oracle.c index d0604c245..c25b7c0ee 100644 --- a/src/src/lookups/oracle.c +++ b/src/src/lookups/oracle.c @@ -408,9 +408,9 @@ while (cda->rc != NO_DATA_FOUND) /* Loop for each row */ else for (int i = 0; i < num_fields; i++) { int slen; - uschar *s = US desc[i].buf; + uschar * s = US desc[i].buf; - while (*s != 0 && isspace(*s)) s++; + Uskip_whitespace(&s); slen = Ustrlen(s); while (slen > 0 && isspace(s[slen-1])) slen--; result = string_catn(result, s, slen); diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c index 7b680f086..53b479142 100644 --- a/src/src/lookups/redis.c +++ b/src/src/lookups/redis.c @@ -212,7 +212,7 @@ if(sdata[1]) int siz, ptr, i; uschar c; - while (isspace(*s)) s++; + Uskip_whitespace(&s); for (i = 0; *s && i < nele(argv); i++) { @@ -224,7 +224,7 @@ if(sdata[1]) argv[i] = string_from_gstring(g); DEBUG(D_lookup) debug_printf_indent("REDIS: argv[%d] '%s'\n", i, argv[i]); - while (isspace(*s)) s++; + Uskip_whitespace(&s); } /* Run the command. We use the argv form rather than plain as that parses diff --git a/src/src/match.c b/src/src/match.c index 8b1a3bef6..2cb499359 100644 --- a/src/src/match.c +++ b/src/src/match.c @@ -599,7 +599,7 @@ while ((sss = string_nextinlist(&list, &sep, NULL, 0))) if (*ss == '!') { yield = FAIL; - while (isspace((*(++ss)))); + while (isspace(*++ss)) ; } else yield = OK; @@ -825,15 +825,14 @@ while ((sss = string_nextinlist(&list, &sep, NULL, 0))) while (Ufgets(filebuffer, sizeof(filebuffer), f) != NULL) { - uschar *error; - uschar *sss = filebuffer; + uschar * error, * sss = filebuffer; while ((ss = Ustrchr(sss, '#')) != NULL) { if ((type != MCL_ADDRESS && type != MCL_LOCALPART) || ss == filebuffer || isspace(ss[-1])) { - *ss = 0; + *ss = '\0'; break; } sss = ss + 1; @@ -841,20 +840,19 @@ while ((sss = string_nextinlist(&list, &sep, NULL, 0))) ss = filebuffer + Ustrlen(filebuffer); /* trailing space */ while (ss > filebuffer && isspace(ss[-1])) ss--; - *ss = 0; + *ss = '\0'; ss = filebuffer; - while (isspace(*ss)) ss++; /* leading space */ - - if (!*ss) continue; /* ignore empty */ + if (!Uskip_whitespace(&ss)) /* leading space */ + continue; /* ignore empty */ file_yield = yield; /* positive yield */ sss = ss; /* for debugging */ if (*ss == '!') /* negation */ { - file_yield = (file_yield == OK)? FAIL : OK; - while (isspace((*(++ss)))); + file_yield = file_yield == OK ? FAIL : OK; + while (isspace(*++ss)) ; } switch ((func)(arg, ss, valueptr, &error)) @@ -1157,7 +1155,7 @@ if (pattern[0] == '@' && pattern[1] == '@') if (*ss == '!') { local_yield = FAIL; - while (isspace((*(++ss)))); + while (isspace(*++ss)) ; } else local_yield = OK; diff --git a/src/src/moan.c b/src/src/moan.c index 6fe82b29c..641540839 100644 --- a/src/src/moan.c +++ b/src/src/moan.c @@ -762,13 +762,12 @@ llen = domain++ - recipient; while ((item = string_nextinlist(&listptr, &sep, NULL, 0))) { - const uschar *newaddress = item; - const uschar *pattern = string_dequote(&newaddress); + const uschar * newaddress = item; + const uschar * pattern = string_dequote(&newaddress); /* If no new address found, just skip this item. */ - while (isspace(*newaddress)) newaddress++; - if (*newaddress == 0) continue; + if (!Uskip_whitespace(&newaddress)) continue; /* We now have an item to match as an address in item, and the additional address in newaddress. If the pattern matches, expand the new address string diff --git a/src/src/parse.c b/src/src/parse.c index ecdbe9f8d..4a75d229e 100644 --- a/src/src/parse.c +++ b/src/src/parse.c @@ -1363,7 +1363,7 @@ for (;;) *error = string_sprintf("\"%.*s\" is not permitted", len, s); return FF_ERROR; } - while (*ss && isspace(*ss)) ss++; /* skip leading whitespace */ + Uskip_whitespace(&ss); /* skip leading whitespace */ if ((len = Ustrlen(ss)) > 0) /* ignore trailing newlines */ for (const uschar * t = ss + len - 1; t >= ss && *t == '\n'; t--) len--; *error = string_copyn(ss, len); /* becomes the error */ diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c index 21e17c61e..565ee068e 100644 --- a/src/src/pdkim/pdkim.c +++ b/src/src/pdkim/pdkim.c @@ -679,8 +679,7 @@ for (const uschar * ele = raw_record, * tspec, * end, * val; *ele; ele = end) DEBUG(D_acl) debug_printf(" %.*s=%s\n", taglen, tspec, val); while (taglen > 1 && isspace(tspec[taglen-1])) taglen--; /* Ignore whitespace before = */ - while (isspace(*val)) - val++; /* Ignore whitespace after = */ + Uskip_whitespace(&val); /* Ignore whitespace after = */ if (isspace(val[ Ustrlen(val)-1 ])) { /* Ignore whitespace after value */ gstring * g = string_cat(NULL, val); diff --git a/src/src/proxy.c b/src/src/proxy.c index fbce11163..e2d3bace0 100644 --- a/src/src/proxy.c +++ b/src/src/proxy.c @@ -396,7 +396,7 @@ else if (ret >= 8 && memcmp(hdr.v1.line, "PROXY", 5) == 0) /* Step through the string looking for the required fields. Ensure strict adherence to required formatting, exit for any error. */ p += 5; - if (!isspace(*(p++))) + if (!isspace(*p++)) { DEBUG(D_receive) debug_printf("Missing space after PROXY command\n"); goto proxyfail; @@ -417,7 +417,7 @@ else if (ret >= 8 && memcmp(hdr.v1.line, "PROXY", 5) == 0) } p += Ustrlen(iptype); - if (!isspace(*(p++))) + if (!isspace(*p++)) { DEBUG(D_receive) debug_printf("Missing space after TCP4/6 command\n"); goto proxyfail; diff --git a/src/src/readconf.c b/src/src/readconf.c index 5b486d0b6..3db3bdd69 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1050,7 +1050,7 @@ for (;;) (Ustrncmp(ss+8, "_if_exists", 10) == 0 && isspace(ss[18])))) { uschar *t; - int include_if_exists = isspace(ss[8])? 0 : 10; + int include_if_exists = isspace(ss[8]) ? 0 : 10; config_file_item *save; struct stat statbuf; @@ -1644,8 +1644,7 @@ uschar name2[EXIM_DRIVERNAME_MAX]; /* There may be leading spaces; thereafter, we expect an option name starting with a letter. */ -while (isspace(*s)) s++; -if (!isalpha(*s)) +if (!isalpha( Uskip_whitespace(&s) )) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "option setting expected: %s", s); /* Read the name of the option, and skip any subsequent white space. If @@ -1660,7 +1659,7 @@ for (int n = 0; n < 2; n++) s++; } name[ptr] = 0; - while (isspace(*s)) s++; + Uskip_whitespace(&s); if (Ustrcmp(name, "hide") != 0) break; issecure = opt_secure; ptr = 0; @@ -1720,7 +1719,7 @@ else if (*s && (offset != 0 || *s != '=')) /* Skip white space after = */ -if (*s == '=') while (isspace((*(++s)))); +if (*s == '=') while (isspace(*++s)); /* If there is a data block and the opt_public flag is not set, change the data block pointer to the private options block. */ @@ -2202,8 +2201,7 @@ switch (type) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "absolute value of integer \"%s\" is too large (overflow)", s); - while (isspace(*endptr)) endptr++; - if (*endptr) + if (Uskip_whitespace(&endptr)) extra_chars_error(endptr, inttype, US"integer value for ", name); value = (int)lvalue; @@ -2251,8 +2249,7 @@ switch (type) if (errno == ERANGE) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "absolute value of integer \"%s\" is too large (overflow)", s); - while (isspace(*endptr)) endptr++; - if (*endptr != 0) + if (Uskip_whitespace(&endptr)) extra_chars_error(endptr, inttype, US"integer value for ", name); if (data_block) @@ -2347,7 +2344,7 @@ switch (type) list[count+1] = value; if (snext == NULL) break; s = snext + 1; - while (isspace(*s)) s++; + Uskip_whitespace(&s); } if (count > list[0] - 2) @@ -3570,8 +3567,7 @@ if (host_number_string) "failed to expand localhost_number \"%s\": %s", host_number_string, expand_string_message); n = Ustrtol(s, &end, 0); - while (isspace(*end)) end++; - if (*end) + if (Uskip_whitespace(&end)) log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "localhost_number value is not a number: %s", s); if (n > LOCALHOST_MAX) @@ -4019,10 +4015,9 @@ Returns: time in seconds or fixed point number * 1000 */ static int -retry_arg(const uschar **paddr, int type) +retry_arg(const uschar ** paddr, int type) { -const uschar *p = *paddr; -const uschar *pp; +const uschar * p = *paddr, * pp; if (*p++ != ',') log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "comma expected"); @@ -4030,7 +4025,7 @@ Uskip_whitespace(&p); pp = p; while (isalnum(*p) || (type == 1 && *p == '.')) p++; -if (*p != 0 && !isspace(*p) && *p != ',' && *p != ';') +if (*p && !isspace(*p) && *p != ',' && *p != ';') log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "comma or semicolon expected"); *paddr = p; @@ -4433,10 +4428,8 @@ for (const config_line_item * i = config_lines; i; i = i->next) r = store_mark(); /* skip over to the first non-space */ - for (current = string_copy(i->line); *current && isspace(*current); ++current) - ; - - if (!*current) + current = string_copy(i->line); + if (!Uskip_whitespace(¤t)) continue; /* Collapse runs of spaces. We stop this if we encounter one of the @@ -4444,11 +4437,10 @@ for (const config_line_item * i = config_lines; i; i = i->next) for (p = current; *p; p++) if (isspace(*p)) { - uschar *next; + uschar * next = p; if (*p != ' ') *p = ' '; - for (next = p; isspace(*next); ++next) - ; + Uskip_whitespace(&p); if (next - p > 1) memmove(p+1, next, Ustrlen(next)+1); diff --git a/src/src/receive.c b/src/src/receive.c index a56ff473e..9dbf45df9 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -2251,8 +2251,7 @@ OVERSIZE: if (isspace(*p)) break; while (mac_isgraph(*p) && *p != ':') p++; - while (isspace(*p)) p++; - if (*p != ':') + if (Uskip_whitespace(&p) != ':') { body_zerocount = had_zero; break; @@ -2453,13 +2452,14 @@ for (header_line * h = header_list->next; h; h = h->next) if (!smtp_input) { int len; - uschar *s = Ustrchr(h->text, ':') + 1; - while (isspace(*s)) s++; + uschar * s = Ustrchr(h->text, ':') + 1; + + Uskip_whitespace(&s); len = h->slen - (s - h->text) - 1; if (Ustrlen(originator_login) == len && strncmpic(s, originator_login, len) == 0) { - uschar *name = is_resent? US"Resent-From" : US"From"; + uschar * name = is_resent ? US"Resent-From" : US"From"; header_add(htype_from, "%s: %s <%s@%s>\n", name, originator_name, originator_login, qualify_domain_sender); from_header = header_last; @@ -2514,15 +2514,13 @@ for (header_line * h = header_list->next; h; h = h->next) if (filter_test != FTEST_NONE) { - uschar *start = h->text + 12; - uschar *end = start + Ustrlen(start); - while (isspace(*start)) start++; + uschar * start = h->text + 12; + uschar * end = start + Ustrlen(start); + + Uskip_whitespace(&start); while (end > start && isspace(end[-1])) end--; if (*start == '<' && end[-1] == '>') - { - start++; - end--; - } + { start++; end--; } return_path = string_copyn(start, end - start); printf("Return-path taken from \"Return-path:\" header line\n"); } @@ -2626,7 +2624,7 @@ if (extract_recip) (!contains_resent_headers || strncmpic(h->text, US"resent-", 7) == 0)) { uschar * s = Ustrchr(h->text, ':') + 1; - while (isspace(*s)) s++; + Uskip_whitespace(&s); f.parse_allow_group = TRUE; /* Allow address group syntax */ @@ -2706,7 +2704,7 @@ if (extract_recip) /* Move on past this address */ s = ss + (*ss ? 1 : 0); - while (isspace(*s)) s++; + Uskip_whitespace(&s); } /* Next address */ f.parse_allow_group = FALSE; /* Reset group syntax flags */ diff --git a/src/src/rewrite.c b/src/src/rewrite.c index 9ee5a6794..ce35c4365 100644 --- a/src/src/rewrite.c +++ b/src/src/rewrite.c @@ -452,7 +452,7 @@ header_line * newh = NULL; rmark function_reset_point = store_mark(); uschar * s = Ustrchr(h->text, ':') + 1; -while (isspace(*s)) s++; +Uskip_whitespace(&s); DEBUG(D_rewrite) /* The header text includes the trailing newline */ debug_printf_indent("rewrite_one_header: type=%c:\n %s", h->type, h->text); @@ -493,7 +493,7 @@ while (*s) recipient = parse_extract_address(s, &errmess, &start, &end, &domain, FALSE); *ss1 = terminator; s = ss + (*ss ? 1 : 0); - while (isspace(*s)) s++; + Uskip_whitespace(&s); /* There isn't much we can do for syntactic disasters at this stage. Pro tem (possibly for ever) ignore them. diff --git a/src/src/rfc2047.c b/src/src/rfc2047.c index 18263f9ab..1ab25150a 100644 --- a/src/src/rfc2047.c +++ b/src/src/rfc2047.c @@ -313,8 +313,8 @@ while (mimeword) mimeword = decode_mimeword(string, lencheck, &q1, &q2, &endword, &dlen, &dptr); if (mimeword) { - uschar *s = string; - while (isspace(*s)) s++; + uschar * s = string; + Uskip_whitespace(&s); if (s == mimeword) string = s; } } diff --git a/src/src/route.c b/src/src/route.c index 0fdcdf2ed..afd43d866 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -266,12 +266,12 @@ for (router_instance * r = routers; r; r = r->next) else if (Ustrncmp(s, "reroute:", 8) == 0) { s += 8; - while (isspace(*s)) s++; + Uskip_whitespace(&s); if (Ustrncmp(s, "rewrite:", 8) == 0) { r->self_rewrite = TRUE; s += 8; - while (isspace(*s)) s++; + Uskip_whitespace(&s); } r->self = s; r->self_code = self_reroute; @@ -693,13 +693,13 @@ while ((check = string_nextinlist(&listptr, &sep, NULL, 0))) if (*ss == '+') { eacces_code = 1; - while (isspace((*(++ss)))); + while (isspace(*++ss)); } if (*ss == '!') { invert = TRUE; - while (isspace((*(++ss)))); + while (isspace(*++ss)); } if (*ss != '/') @@ -1463,7 +1463,7 @@ for (uschar * ele; (ele = string_nextinlist(&varlist, &sep, NULL, 0)); ) } name += 2; - while (isspace(*assignment)) assignment++; + Uskip_whitespace(&assignment); if (!(val = expand_string(US assignment))) if (f.expand_string_forcedfail) diff --git a/src/src/routers/manualroute.c b/src/src/routers/manualroute.c index 45378ce3d..ed497336b 100644 --- a/src/src/routers/manualroute.c +++ b/src/src/routers/manualroute.c @@ -156,17 +156,17 @@ static BOOL parse_route_item(const uschar *s, const uschar **domain, const uschar **hostlist, const uschar **options) { -while (*s != 0 && isspace(*s)) s++; +Uskip_whitespace(&s); if (domain) { if (!*s) return FALSE; /* missing data */ *domain = string_dequote(&s); - while (*s && isspace(*s)) s++; + Uskip_whitespace(&s); } *hostlist = string_dequote(&s); -while (*s && isspace(*s)) s++; +Uskip_whitespace(&s); *options = s; return TRUE; } @@ -333,8 +333,9 @@ lookup_type = LK_DEFAULT; while (*options) { unsigned n; - const uschar *s = options; - while (*options != 0 && !isspace(*options)) options++; + const uschar * s = options; + + while (*options && !isspace(*options)) options++; n = options-s; if (Ustrncmp(s, "randomize", n) == 0) randomize = TRUE; @@ -368,7 +369,7 @@ while (*options) if (*options) { options++; - while (*options != 0 && isspace(*options)) options++; + while (*options && isspace(*options)) options++; } } diff --git a/src/src/routers/queryprogram.c b/src/src/routers/queryprogram.c index b1d736f94..5f0f50cd9 100644 --- a/src/src/routers/queryprogram.c +++ b/src/src/routers/queryprogram.c @@ -363,10 +363,10 @@ buffer[len] = 0; DEBUG(D_route) debug_printf("command wrote: %s\n", buffer); rword = buffer; -while (isspace(*rword)) rword++; +Uskip_whitespace(&rword); rdata = rword; while (*rdata && !isspace(*rdata)) rdata++; -if (*rdata) *rdata++ = 0; +if (*rdata) *rdata++ = '\0'; /* The word must be a known yield name. If it is "REDIRECT", the rest of the line is redirection data, as for a .forward file. It may not contain filter diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index f62d6fbf2..79176687d 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1227,7 +1227,7 @@ for (smtp_cmd_list * p = cmd_list; p < cmd_list + nelem(cmd_list); p++) follow the sender address. */ smtp_cmd_argument = smtp_cmd_buffer + p->len; - while (isspace(*smtp_cmd_argument)) smtp_cmd_argument++; + Uskip_whitespace(&smtp_cmd_argument); Ustrcpy(smtp_data_buffer, smtp_cmd_argument); smtp_cmd_data = smtp_data_buffer; @@ -3807,8 +3807,8 @@ while (done <= 0) if (*smtp_cmd_data) { - *smtp_cmd_data++ = 0; - while (isspace(*smtp_cmd_data)) smtp_cmd_data++; + *smtp_cmd_data++ = '\0'; + Uskip_whitespace(&smtp_cmd_data); } /* Search for an authentication mechanism which is configured for use @@ -3919,10 +3919,10 @@ while (done <= 0) if (!f.sender_host_unknown) { BOOL old_helo_verified = f.helo_verified; - uschar *p = smtp_cmd_data; + uschar * p = smtp_cmd_data; - while (*p != 0 && !isspace(*p)) { *p = tolower(*p); p++; } - *p = 0; + while (*p && !isspace(*p)) { *p = tolower(*p); p++; } + *p = '\0'; /* Force a reverse lookup if HELO quoted something in helo_lookup_domains because otherwise the log can be confusing. */ diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index 895b594fc..888a0006e 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -704,13 +704,13 @@ if (format) if (outblock->authenticating) { - uschar *p = big_buffer; + uschar * p = big_buffer; if (Ustrncmp(big_buffer, "AUTH ", 5) == 0) { p += 5; - while (isspace(*p)) p++; + Uskip_whitespace(&p); while (!isspace(*p)) p++; - while (isspace(*p)) p++; + Uskip_whitespace(&p); } while (*p) *p++ = '*'; } diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index e6a1c6fa4..64e8c711a 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -5170,8 +5170,7 @@ if (!expand_check(option_spec, US"openssl_options", &exp, &end)) for (uschar * s = exp; *s; /**/) { - while (isspace(*s)) ++s; - if (*s == '\0') + if (!Uskip_whitespace(&s)) break; if (*s != '+' && *s != '-') { diff --git a/src/src/transports/autoreply.c b/src/src/transports/autoreply.c index 690ec4a92..67d48a1cb 100644 --- a/src/src/transports/autoreply.c +++ b/src/src/transports/autoreply.c @@ -235,13 +235,12 @@ that needs to be removed */ s = newlist + Ustrlen(newlist); while (s > newlist && (isspace(s[-1]) || s[-1] == ',')) s--; -*s = 0; +*s = '\0'; /* Check to see if there any addresses left; if not, return NULL */ s = newlist; -while (s && isspace(*s)) s++; -if (*s) +if (Uskip_whitespace(&s)) return newlist; store_reset(reset_point); @@ -592,7 +591,7 @@ for (h = header_list; h; h = h->next) if (h) { message_id = Ustrchr(h->text, ':') + 1; - while (isspace(*message_id)) message_id++; + Uskip_whitespace(&message_id); fprintf(fp, "In-Reply-To: %s", message_id); } diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 60a20c8fe..f8a1427b9 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -562,7 +562,7 @@ if (testflag(addr, af_pfr) && addr->local_part[0] == '|') else { cmd = addr->local_part + 1; - while (isspace(*cmd)) cmd++; + Uskip_whitespace(&cmd); expand_arguments = testflag(addr, af_expand_pipe); expand_fail = FAIL; } diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 736592352..ed5994241 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -533,7 +533,7 @@ switch(*errno_value) case ERRNO_SMTPFORMAT: /* Handle malformed SMTP response */ s = string_printing(buffer); - while (isspace(*s)) s++; + Uskip_whitespace(&s); *message = *s == 0 ? string_sprintf("Malformed SMTP reply (an empty line) " "in response to %s%s", pl, smtp_command) @@ -815,8 +815,7 @@ uschar * match; if (regex_match(regex_LIMITS, sx->buffer, -1, &match)) for (const uschar * s = sx->buffer + Ustrlen(match); *s; ) { - while (isspace(*s)) s++; - if (*s == '\n') break; + if (Uskip_whitespace(&s) == '\n') break; if (strncmpic(s, US"MAILMAX=", 8) == 0) { @@ -1694,8 +1693,8 @@ if ( sx->esmtp { DEBUG(D_transport) debug_printf("skipping %s authenticator: %s\n", au->name, - (au->client)? "client_condition is false" : - "not configured as a client"); + au->client ? "client_condition is false" + : "not configured as a client"); continue; } @@ -1703,15 +1702,14 @@ if ( sx->esmtp while (*p) { - int len = Ustrlen(au->public_name); - int rc; + int len = Ustrlen(au->public_name), rc; - while (isspace(*p)) p++; + Uskip_whitespace(&p); if (strncmpic(au->public_name, p, len) != 0 || - (p[len] != 0 && !isspace(p[len]))) + (p[len] && !isspace(p[len]))) { - while (*p != 0 && !isspace(*p)) p++; + while (*p && !isspace(*p)) p++; continue; } diff --git a/src/src/verify.c b/src/src/verify.c index 78923651c..4f3bafb04 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -2612,12 +2612,12 @@ for (int i = 0; i < 3 && !done; i++) f.parse_allow_group = TRUE; - while (*s != 0) + while (*s) { - address_item *vaddr; + address_item * vaddr; while (isspace(*s) || *s == ',') s++; - if (*s == 0) break; /* End of header */ + if (!*s) break; /* End of header */ ss = parse_find_address_end(s, FALSE); @@ -2628,7 +2628,7 @@ for (int i = 0; i < 3 && !done; i++) while (isspace(ss[-1])) ss--; terminator = *ss; - *ss = 0; + *ss = '\0'; HDEBUG(D_verify) debug_printf("verifying %.*s header address %s\n", (int)(endname - h->text), h->text, s); @@ -2873,17 +2873,17 @@ if (sscanf(CS buffer + qlen, "%d , %d%n", &received_sender_port, goto END_OFF; p = buffer + qlen + n; -while(isspace(*p)) p++; +Uskip_whitespace(&p); if (*p++ != ':') goto END_OFF; -while(isspace(*p)) p++; +Uskip_whitespace(&p); if (Ustrncmp(p, "USERID", 6) != 0) goto END_OFF; p += 6; -while(isspace(*p)) p++; +Uskip_whitespace(&p); if (*p++ != ':') goto END_OFF; -while (*p != 0 && *p != ':') p++; -if (*p++ == 0) goto END_OFF; -while(isspace(*p)) p++; -if (*p == 0) goto END_OFF; +while (*p && *p != ':') p++; +if (!*p++) goto END_OFF; +Uskip_whitespace(&p); +if (!*p) goto END_OFF; /* The rest of the line is the data we want. We turn it into printing characters when we save it, so that it cannot mess up the format of any logging @@ -3083,7 +3083,7 @@ if (iplookup) key = filename; while (*key != 0 && !isspace(*key)) key++; filename = string_copyn(filename, key - filename); - while (isspace(*key)) key++; + Uskip_whitespace(&key); } else if (mac_islookup(search_type, lookup_querystyle)) { diff --git a/src/src/xclient.c b/src/src/xclient.c index 2a8be9b0e..2219cb027 100644 --- a/src/src/xclient.c +++ b/src/src/xclient.c @@ -248,7 +248,7 @@ for (state = XCLIENT_SKIP_SPACES; *s; ) } case XCLIENT_SKIP_SPACES: - while (*s && isspace (*s)) s++; + Uskip_whitespace(&s); state = XCLIENT_READ_COMMAND; break;