[exim-cvs] tidying: skip_whitespace

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Exim Git Commits Mailing List
Ημερομηνία:  
Προς: exim-cvs
Αντικείμενο: [exim-cvs] tidying: skip_whitespace
Gitweb: https://git.exim.org/exim.git/commitdiff/137ae145e066dda8f9d81cf6d2c9f76c15929605
Commit:     137ae145e066dda8f9d81cf6d2c9f76c15929605
Parent:     6641ba45c04b15d2d565c6e9bc6d37e6e731c49c
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Apr 4 14:25:07 2020 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sat Apr 4 14:27:57 2020 +0100


    tidying: skip_whitespace
---
 src/src/acl.c                   | 19 +++++++------
 src/src/exim.c                  | 32 +++++++++++++---------
 src/src/expand.c                | 32 ++++++++++------------
 src/src/filter.c                | 17 ++++++------
 src/src/functions.h             | 10 +++++++
 src/src/globals.h               |  2 +-
 src/src/header.c                |  5 ++--
 src/src/log.c                   | 10 +++----
 src/src/lookups/sqlite.c        |  2 +-
 src/src/match.c                 |  8 +++---
 src/src/moan.c                  |  2 +-
 src/src/parse.c                 |  8 +++---
 src/src/rda.c                   | 10 +++----
 src/src/readconf.c              | 59 +++++++++++++++++++----------------------
 src/src/smtp_in.c               |  2 +-
 src/src/smtp_out.c              |  4 +--
 src/src/transports/appendfile.c |  4 +--
 src/src/verify.c                |  4 +--
 18 files changed, 118 insertions(+), 112 deletions(-)


diff --git a/src/src/acl.c b/src/src/acl.c
index 74ec1ef..9ed0057 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -732,7 +732,7 @@ uschar * s;

*error = NULL;

-while ((s = (*func)()) != NULL)
+while ((s = (*func)()))
{
int v, c;
BOOL negated = FALSE;
@@ -742,8 +742,7 @@ while ((s = (*func)()) != NULL)
/* Conditions (but not verbs) are allowed to be negated by an initial
exclamation mark. */

-  while (isspace(*s)) s++;
-  if (*s == '!')
+  if (Uskip_whitespace(&s) == '!')
     {
     negated = TRUE;
     s++;
@@ -859,7 +858,7 @@ while ((s = (*func)()) != NULL)
     }
       cond->u.varname = string_copyn(s, 18);
       s = endptr;
-      while (isspace(*s)) s++;
+      Uskip_whitespace(&s);
       }
     else
 #endif
@@ -895,7 +894,7 @@ while ((s = (*func)()) != NULL)


     cond->u.varname = string_copyn(s + 4, endptr - s - 4);
     s = endptr;
-    while (isspace(*s)) s++;
+    Uskip_whitespace(&s);
     }


   /* For "set", we are now positioned for the data. For the others, only
@@ -909,7 +908,7 @@ while ((s = (*func)()) != NULL)
         conditions[c].is_modifier ? US"modifier" : US"condition");
       return NULL;
       }
-    while (isspace(*s)) s++;
+    Uskip_whitespace(&s);
     cond->arg = string_copy(s);
     }
   }
@@ -3843,16 +3842,16 @@ uschar *yield;


 for(;;)
   {
-  while (isspace(*acl_text)) acl_text++;   /* Leading spaces/empty lines */
-  if (*acl_text == 0) return NULL;         /* No more data */
-  yield = acl_text;                        /* Potential data line */
+  Uskip_whitespace(&acl_text);       /* Leading spaces/empty lines */
+  if (!*acl_text) return NULL;        /* No more data */
+  yield = acl_text;            /* Potential data line */


while (*acl_text && *acl_text != '\n') acl_text++;

/* If we hit the end before a newline, we have the whole logical line. If
it's a comment, there's no more data to be given. Otherwise, yield it. */

- if (*acl_text == 0) return (*yield == '#')? NULL : yield;
+ if (!*acl_text) return *yield == '#' ? NULL : yield;

/* After reaching a newline, end this loop if the physical line does not
start with '#'. If it does, it's a comment, and the loop continues. */
diff --git a/src/src/exim.c b/src/src/exim.c
index 10526ba..bb49ee6 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1629,7 +1629,6 @@ uschar *malware_test_file = NULL;
uschar *real_sender_address;
uschar *originator_home = US"/";
size_t sz;
-rmark reset_point;

struct passwd *pw;
struct stat statbuf;
@@ -1948,11 +1947,16 @@ running in an unprivileged state. */

unprivileged = (real_uid != root_uid && original_euid != root_uid);

+/* For most of the args-parsing we need to use permanent pool memory */
+ {
+ int old_pool = store_pool;
+ store_pool = POOL_PERM;
+
/* Scan the program's arguments. Some can be dealt with right away; others are
simply recorded for checking and handling afterwards. Do a high-level switch
on the second character (the one after '-'), to save some effort. */

-for (i = 1; i < argc; i++)
+ for (i = 1; i < argc; i++)
   {
   BOOL badarg = FALSE;
   uschar * arg = argv[i];
@@ -2401,11 +2405,14 @@ for (i = 1; i < argc; i++)
         else
               {
               /* Well, the trust list at least is up to scratch... */
-              rmark reset_point = store_mark();
+              rmark reset_point;
               uschar *trusted_configs[32];
               int nr_configs = 0;
               int i = 0;
+          int old_pool = store_pool;
+          store_pool = POOL_MAIN;


+              reset_point = store_mark();
               while (Ufgets(big_buffer, big_buffer_size, trust_list))
                 {
                 uschar *start = big_buffer, *nl;
@@ -2443,6 +2450,7 @@ for (i = 1; i < argc; i++)
               else    /* No valid prefixes found in trust_list file. */
                 f.trusted_config = FALSE;
               store_reset(reset_point);
+          store_pool = old_pool;
               }
         }
           else        /* Could not open trust_list file. */
@@ -3210,20 +3218,16 @@ for (i = 1; i < argc; i++)


     if (*argrest)
       {
-      uschar *hn;
+      uschar * hn = Ustrchr(argrest, ':');


       if (received_protocol)
         exim_fail("received_protocol is set already\n");


-      hn = Ustrchr(argrest, ':');
       if (!hn)
         received_protocol = string_copy_taint(argrest, TRUE);
       else
         {
-    int old_pool = store_pool;
-    store_pool = POOL_PERM;
         received_protocol = string_copyn_taint(argrest, hn - argrest, TRUE);
-    store_pool = old_pool;
         sender_host_name = string_copy_taint(hn + 1, TRUE);
         }
       }
@@ -3482,12 +3486,15 @@ for (i = 1; i < argc; i++)


/* If -R or -S have been specified without -q, assume a single queue run. */

-if (  (deliver_selectstring || deliver_selectstring_sender)
-   && queue_interval < 0)
-    queue_interval = 0;
+ if (  (deliver_selectstring || deliver_selectstring_sender)
+    && queue_interval < 0)
+  queue_interval = 0;



END_ARG:
+ store_pool = old_pool;
+ }
+
/* If usage_wanted is set we call the usage function - which never returns */
if (usage_wanted) exim_usage(called_as);

@@ -5088,6 +5095,7 @@ if (host_checking)

   if (smtp_start_session())
     {
+    rmark reset_point;
     for (; (reset_point = store_mark()); store_reset(reset_point))
       {
       if (smtp_setup_msg() <= 0) break;
@@ -5339,7 +5347,7 @@ collapsed). */


while (more)
{
- reset_point = store_mark();
+ rmark reset_point = store_mark();
message_id[0] = 0;

/* Handle the SMTP case; call smtp_setup_mst() to deal with the initial SMTP
diff --git a/src/src/expand.c b/src/src/expand.c
index de53fe4..789f099 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1174,7 +1174,7 @@ static uschar *
expand_getkeyed(uschar * key, const uschar * s)
{
int length = Ustrlen(key);
-while (isspace(*s)) s++;
+Uskip_whitespace(&s);

/* Loop to search for the key */

@@ -1186,14 +1186,13 @@ while (*s)

while (*s && *s != '=' && !isspace(*s)) s++;
dkeylength = s - dkey;
- while (isspace(*s)) s++;
- if (*s == '=') while (isspace((*(++s))));
+ if (Uskip_whitespace(&s) == '=') while (isspace((*(++s))));

   data = string_dequote(&s);
   if (length == dkeylength && strncmpic(key, dkey, length) == 0)
     return data;


- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
}

 return NULL;
@@ -2044,7 +2043,7 @@ switch (vp->type)
     s = find_header(US"reply-to:", newsize,
         exists_only ? FH_EXISTS_ONLY|FH_WANT_RAW : FH_WANT_RAW,
         headers_charset);
-    if (s) while (isspace(*s)) s++;
+    if (s) Uskip_whitespace(&s);
     if (!s || !*s)
       {
       *newsize = 0;                            /* For the *s==0 case */
@@ -2055,8 +2054,8 @@ switch (vp->type)
     if (s)
       {
       uschar *t;
-      while (isspace(*s)) s++;
-      for (t = s; *t != 0; t++) if (*t == '\n') *t = ' ';
+      Uskip_whitespace(&s);
+      for (t = s; *t; t++) if (*t == '\n') *t = ' ';
       while (t > s && isspace(t[-1])) t--;
       *t = 0;
       }
@@ -2144,7 +2143,7 @@ read_subs(uschar **sub, int n, int m, const uschar **sptr, BOOL skipping,
 {
 const uschar *s = *sptr;


-while (isspace(*s)) s++;
+Uskip_whitespace(&s);
 for (int i = 0; i < n; i++)
   {
   if (*s != '{')
@@ -2161,7 +2160,7 @@ for (int i = 0; i < n; i++)
   if (!(sub[i] = expand_string_internal(s+1, TRUE, &s, skipping, TRUE, resetok)))
     return 3;
   if (*s++ != '}') return 1;
-  while (isspace(*s)) s++;
+  Uskip_whitespace(&s);
   }
 if (check_end && *s++ != '}')
   {
@@ -2284,9 +2283,7 @@ uschar * p = s;
 unsigned depth = 0;
 BOOL quotesmode = wrap[0] == wrap[1];


-while (isspace(*p)) p++;
-
-if (*p == *wrap)
+if (Uskip_whitespace(&p) == *wrap)
{
s = ++p;
wrap++;
@@ -4026,8 +4023,7 @@ int c;
int_eximarith_t n;
uschar *s = *sptr;

-while (isspace(*s)) s++;
-if (isdigit((c = *s)))
+if (isdigit((c = Uskip_whitespace(&s))))
   {
   int count;
   (void)sscanf(CS s, (decimal? SC_EXIM_DEC "%n" : SC_EXIM_ARITH "%n"), &n, &count);
@@ -4039,7 +4035,7 @@ if (isdigit((c = *s)))
     case 'm': n *= 1024*1024; s++; break;
     case 'g': n *= 1024*1024*1024; s++; break;
     }
-  while (isspace (*s)) s++;
+  Uskip_whitespace(&s);
   }
 else if (c == '(')
   {
@@ -4061,7 +4057,7 @@ eval_op_unary(uschar **sptr, BOOL decimal, uschar **error)
 {
 uschar *s = *sptr;
 int_eximarith_t x;
-while (isspace(*s)) s++;
+Uskip_whitespace(&s);
 if (*s == '+' || *s == '-' || *s == '~')
   {
   int op = *s++;
@@ -4819,12 +4815,12 @@ while (*s != 0)
       kinds. Allow everything except space or { to appear; the actual content
       is checked by search_findtype_partial. */        /*}*/


-      while (*s != 0 && *s != '{' && !isspace(*s))    /*}*/
+      while (*s && *s != '{' && !isspace(*s))        /*}*/
         {
         if (nameptr < sizeof(name) - 1) name[nameptr++] = *s;
         s++;
         }
-      name[nameptr] = 0;
+      name[nameptr] = '\0';
       while (isspace(*s)) s++;


       /* Now check for the individual search type and any partial or default
diff --git a/src/src/filter.c b/src/src/filter.c
index 90e83e6..c508169 100644
--- a/src/src/filter.c
+++ b/src/src/filter.c
@@ -2386,12 +2386,11 @@ Previously the test was for "auto-". */


for (h = header_list; h; h = h->next)
{
- uschar *s;
if (h->type == htype_old) continue;

   if (strncmpic(h->text, US"List-", 5) == 0)
     {
-    s = h->text + 5;
+    uschar * s = h->text + 5;
     if (strncmpic(s, US"Id:", 3) == 0 ||
         strncmpic(s, US"Help:", 5) == 0 ||
         strncmpic(s, US"Subscribe:", 10) == 0 ||
@@ -2404,12 +2403,12 @@ for (h = header_list; h; h = h->next)


   else if (strncmpic(h->text, US"Auto-submitted:", 15) == 0)
     {
-    s = h->text + 15;
-    while (isspace(*s)) s++;
+    uschar * s = h->text + 15;
+    Uskip_whitespace(&s);
     if (strncmpic(s, US"no", 2) != 0) return FALSE;
     s += 2;
-    while (isspace(*s)) s++;
-    if (*s != 0) return FALSE;
+    Uskip_whitespace(&s);
+    if (*s) return FALSE;
     }
   }


@@ -2422,13 +2421,13 @@ self_to = rewrite_one(self, rewrite_to, NULL, FALSE, US"",
global_rewrite_rules);


-if (self_from == NULL) self_from = self;
-if (self_to == NULL) self_to = self;
+if (!self_from) self_from = self;
+if (self_to) self_to = self;

/* If there's a prefix or suffix set, we must include the prefixed/
suffixed version of the local part in the tests. */

-if (deliver_localpart_prefix != NULL || deliver_localpart_suffix != NULL)
+if (deliver_localpart_prefix || deliver_localpart_suffix)
   {
   psself = string_sprintf("%s%s%s@%s",
     (deliver_localpart_prefix == NULL)? US"" : deliver_localpart_prefix,
diff --git a/src/src/functions.h b/src/src/functions.h
index f387756..28d6f26 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -13,6 +13,7 @@ are in in fact in separate headers. */
 #ifndef _FUNCTIONS_H_
 #define _FUNCTIONS_H_


+#include <ctype.h>
#include <sys/time.h>


@@ -666,6 +667,15 @@ return US strncpy(CS dst, CCS src, n);
/*XXX will likely need unchecked copy also */


+/* Advance the string pointer given over any whitespace.
+Return the next char as there's enought places using it to be useful. */
+
+#define Uskip_whitespace(sp) skip_whitespace(CUSS sp)
+
+static inline uschar skip_whitespace(const uschar ** sp)
+{ while (isspace(**sp)) (*sp)++; return **sp; }
+
+
/******************************************************************************/

 #if !defined(MACRO_PREDEF) && !defined(COMPILE_UTILITY)
diff --git a/src/src/globals.h b/src/src/globals.h
index 882f289..b46e20b 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -344,7 +344,7 @@ extern gid_t  *admin_groups;           /* List of admin groups */
 extern BOOL    allow_domain_literals;  /* As it says */
 extern BOOL    allow_mx_to_ip;         /* Allow MX records to -> ip address */
 #ifdef EXPERIMENTAL_ARC
-struct arc_set *arc_received;           /* highest ARC instance evaluation struct */
+extern struct arc_set *arc_received;   /* highest ARC instance evaluation struct */
 extern int     arc_received_instance;  /* highest ARC instance number in headers */
 extern int     arc_oldest_pass;        /* lowest passing instance number in headers */
 extern const uschar *arc_state;           /* verification state */
diff --git a/src/src/header.c b/src/src/header.c
index cbfc4f8..8573519 100644
--- a/src/src/header.c
+++ b/src/src/header.c
@@ -321,9 +321,8 @@ while (bot < top)


   if (c == 0)
     {
-    uschar *s = text + mid->len;
-    while (isspace(*s)) s++;
-    if (*s == ':')
+    uschar * s = text + mid->len;
+    if (Uskip_whitespace(&s) == ':')
       return (!is_resent || mid->allow_resent)? mid->htype : htype_other;
     c = 1;
     }
diff --git a/src/src/log.c b/src/src/log.c
index d9cf23a..5fa0017 100644
--- a/src/src/log.c
+++ b/src/src/log.c
@@ -1298,14 +1298,14 @@ decode_bits(unsigned int *selector, size_t selsize, int *notall,
   uschar *string, bit_table *options, int count, uschar *which, int flags)
 {
 uschar *errmsg;
-if (string == NULL) return;
+if (!string) return;


 if (*string == '=')
   {
   char *end;    /* Not uschar */
   memset(selector, 0, sizeof(*selector)*selsize);
   *selector = strtoul(CS string+1, &end, 0);
-  if (*end == 0) return;
+  if (!*end) return;
   errmsg = string_sprintf("malformed numeric %s_selector setting: %s", which,
     string);
   goto ERROR_RETURN;
@@ -1320,8 +1320,8 @@ else for(;;)
   int len;
   bit_table *start, *end;


- while (isspace(*string)) string++;
- if (*string == 0) return;
+ Uskip_whitespace(&string);
+ if (!*string) return;

   if (*string != '+' && *string != '-')
     {
@@ -1343,7 +1343,6 @@ else for(;;)
     bit_table *middle = start + (end - start)/2;
     int c = Ustrncmp(s, middle->name, len);
     if (c == 0)
-      {
       if (middle->name[len] != 0) c = -1; else
         {
         unsigned int bit = middle->bit;
@@ -1365,7 +1364,6 @@ else for(;;)


         break;  /* Out of loop to match selector name */
         }
-      }
     if (c < 0) end = middle; else start = middle + 1;
     }  /* Loop to match selector name */


diff --git a/src/src/lookups/sqlite.c b/src/src/lookups/sqlite.c
index a7cca54..deb3b4e 100644
--- a/src/src/lookups/sqlite.c
+++ b/src/src/lookups/sqlite.c
@@ -79,7 +79,7 @@ sqlite_find(void * handle, const uschar * filename, const uschar * query,
int ret;
gstring * res = NULL;

-ret = sqlite3_exec(handle, CS query, sqlite_callback, &res, (char **)errmsg);
+ret = sqlite3_exec(handle, CS query, sqlite_callback, &res, CSS errmsg);
if (ret != SQLITE_OK)
{
debug_printf_indent("sqlite3_exec failed: %s\n", *errmsg);
diff --git a/src/src/match.c b/src/src/match.c
index 2ad28a9..a0899bf 100644
--- a/src/src/match.c
+++ b/src/src/match.c
@@ -276,14 +276,14 @@ if (!cb->use_partial) partial = -1;
/* Set the parameters for the three different kinds of lookup. */

keyquery = semicolon + 1;
-while (isspace(*keyquery)) keyquery++;
+Uskip_whitespace(&keyquery);

if (mac_islookup(search_type, lookup_absfilequery))
{
filename = keyquery;
- while (*keyquery != 0 && !isspace(*keyquery)) keyquery++;
+ while (*keyquery && !isspace(*keyquery)) keyquery++;
filename = string_copyn(filename, keyquery - filename);
- while (isspace(*keyquery)) keyquery++;
+ Uskip_whitespace(&keyquery);
}

else if (!mac_islookup(search_type, lookup_querystyle))
@@ -301,7 +301,7 @@ if (!(handle = search_open(filename, search_type, 0, NULL, NULL)))
result = search_find(handle, filename, keyquery, partial, affix, affixlen,
starflags, &expand_setup, opts);

-if (!result) return f.search_find_defer? DEFER : FAIL;
+if (!result) return f.search_find_defer ? DEFER : FAIL;
if (valueptr) *valueptr = result;

 expand_nmax = expand_setup;
diff --git a/src/src/moan.c b/src/src/moan.c
index 48d4f90..7d49c4c 100644
--- a/src/src/moan.c
+++ b/src/src/moan.c
@@ -63,7 +63,7 @@ if (!message_id)
     if (h->type == htype_id)
       {
       message_id = Ustrchr(h->text, ':') + 1;
-      while (isspace(*message_id)) message_id++;
+      Uskip_whitespace(&message_id);
       }


 for (h = header_list; h; h = h->next)
diff --git a/src/src/parse.c b/src/src/parse.c
index 5d50d68..9bc76c3 100644
--- a/src/src/parse.c
+++ b/src/src/parse.c
@@ -197,10 +197,10 @@ last_comment_position = s;
 while (*s)
   {
   int c, level;
-  while (isspace(*s)) s++;
-  if (*s != '(') break;
+
+  if (Uskip_whitespace(&s) != '(') break;
   level = 1;
-  while((c = *(++s)) != 0)
+  while((c = *(++s)))
     {
     if (c == '(') level++;
     else if (c == ')') { if (--level <= 0) { s++; break; } }
@@ -2190,7 +2190,7 @@ while (Ufgets(buffer, sizeof(buffer), stdin) != NULL)
       }


     s = ss + (terminator? 1:0);
-    while (isspace(*s)) s++;
+    Uskip_whitespace(&s);
     }
   }


diff --git a/src/src/rda.c b/src/src/rda.c
index 0dc8591..aed8abc 100644
--- a/src/src/rda.c
+++ b/src/src/rda.c
@@ -42,7 +42,7 @@ Returns:   FILTER_EXIM    if it starts with "# Exim filter"
 static BOOL
 match_tag(const uschar *s, const uschar *tag)
 {
-for (; *tag != 0; s++, tag++)
+for (; *tag; s++, tag++)
   if (*tag == ' ')
     {
     while (*s == ' ' || *s == '\t') s++;
@@ -60,10 +60,10 @@ tags for other types of filter. */
 int
 rda_is_filter(const uschar *s)
 {
-while (isspace(*s)) s++;     /* Skips initial blank lines */
-if (match_tag(s, CUS"# exim filter")) return FILTER_EXIM;
-  else if (match_tag(s, CUS"# sieve filter")) return FILTER_SIEVE;
-    else return FILTER_FORWARD;
+Uskip_whitespace(&s);            /* Skips initial blank lines */
+if (match_tag(s, CUS"# exim filter"))        return FILTER_EXIM;
+else if (match_tag(s, CUS"# sieve filter"))    return FILTER_SIEVE;
+else                        return FILTER_FORWARD;
 }



diff --git a/src/src/readconf.c b/src/src/readconf.c
index 2bf1e63..04b3e11 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -692,7 +692,7 @@ while (isalnum(*s) || *s == '_')
}
name[namelen] = 0;

-while (isspace(*s)) s++;
+Uskip_whitespace(&s);
if (*s++ != '=')
{
log_write(0, LOG_PANIC|LOG_CONFIG_IN, "malformed macro definition");
@@ -704,7 +704,7 @@ if (*s == '=')
redef = TRUE;
s++;
}
-while (isspace(*s)) s++;
+Uskip_whitespace(&s);

/* If an existing macro of the same name was defined on the command line, we
just skip this definition. It's an error to attempt to redefine a macro without
@@ -796,7 +796,7 @@ uschar * s;
/* Find the true start of the physical line - leading spaces are always
ignored. */

-while (isspace(*ss)) ss++;
+Uskip_whitespace(&ss);

 /* Process the physical line for macros. If this is the start of the logical
 line, skip over initial text at the start of the line if it starts with an
@@ -808,8 +808,7 @@ s = ss;
 if (len == 0 && isupper(*s))
   {
   while (isalnum(*s) || *s == '_') s++;
-  while (isspace(*s)) s++;
-  if (*s != '=') s = ss;          /* Not a macro definition */
+  if (Uskip_whitespace(&s) != '=') s = ss;          /* Not a macro definition */
   }


/* Skip leading chars which cannot start a macro name, to avoid multiple
@@ -872,7 +871,7 @@ if (*s) for (macro_item * m = *s == '_' ? macros : macros_user; m; m = m->next)
/* An empty macro replacement at the start of a line could mean that ss no
longer points to the first non-blank character. */

-while (isspace(*ss)) ss++;
+Uskip_whitespace(&ss);
return ss;
}

@@ -1045,7 +1044,7 @@ for (;;)
     struct stat statbuf;


     ss += 9 + include_if_exists;
-    while (isspace(*ss)) ss++;
+    Uskip_whitespace(&ss);
     t = ss + Ustrlen(ss);
     while (t > ss && isspace(t[-1])) t--;
     if (*ss == '\"' && t[-1] == '\"')
@@ -1136,7 +1135,7 @@ if (config_lines)
 if (strncmpic(s, US"begin ", 6) == 0)
   {
   s += 6;
-  while (isspace(*s)) s++;
+  Uskip_whitespace(&s);
   if (big_buffer + len - s > sizeof(next_section) - 2)
     s[sizeof(next_section) - 2] = 0;
   Ustrcpy(next_section, s);
@@ -1170,17 +1169,16 @@ uschar *
 readconf_readname(uschar *name, int len, uschar *s)
 {
 int p = 0;
-while (isspace(*s)) s++;
-if (isalpha(*s))
-  {
+
+if (isalpha(Uskip_whitespace(&s)))
   while (isalnum(*s) || *s == '_')
     {
     if (p < len-1) name[p++] = *s;
     s++;
     }
-  }
+
 name[p] = 0;
-while (isspace(*s)) s++;
+Uskip_whitespace(&s);
 return s;
 }


@@ -1416,15 +1414,15 @@ rewrite_rule *next = store_get(sizeof(rewrite_rule), FALSE);
next->next = NULL;
next->key = string_dequote(&p);

-while (isspace(*p)) p++;
-if (*p == 0)
+Uskip_whitespace(&p);
+if (!*p)
   log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
     "missing rewrite replacement string");


next->flags = 0;
next->replacement = string_dequote(&p);

-while (*p != 0) switch (*p++)
+while (*p) switch (*p++)
{
case ' ': case '\t': break;

@@ -3001,13 +2999,13 @@ if (*numberp >= max)
  log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "too many named %ss (max is %d)\n",
    tname, max);


-while (isspace(*s)) s++;
+Uskip_whitespace(&s);
ss = s;
while (isalnum(*s) || *s == '_') s++;
t = store_get(sizeof(tree_node) + s-ss, is_tainted(ss));
Ustrncpy(t->name, ss, s-ss);
t->name[s-ss] = 0;
-while (isspace(*s)) s++;
+Uskip_whitespace(&s);

if (!tree_insertnode(anchorp, t))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
@@ -3020,7 +3018,7 @@ nb->hide = hide;

if (*s++ != '=') log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
"missing '=' after \"%s\"", t->name);
-while (isspace(*s)) s++;
+Uskip_whitespace(&s);
nb->string = read_string(s, t->name);
nb->cache_data = NULL;

@@ -3763,7 +3761,7 @@ while ((buffer = get_config_line()))

     /* Check nothing more on this line, then do the next loop iteration. */


-    while (isspace(*s)) s++;
+    Uskip_whitespace(&s);
     if (*s) extra_chars_error(s, US"driver name ", name, US"");
     continue;
     }
@@ -4016,7 +4014,7 @@ const uschar *pp;


if (*p++ != ',') log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "comma expected");

-while (isspace(*p)) p++;
+Uskip_whitespace(&p);
pp = p;
while (isalnum(*p) || (type == 1 && *p == '.')) p++;

@@ -4057,7 +4055,7 @@ while ((p = get_config_line()))
rchain = &(next->rules);

next->pattern = string_dequote(&p);
- while (isspace(*p)) p++;
+ Uskip_whitespace(&p);
pp = p;
while (mac_isgraph(*p)) p++;
if (p - pp <= 0) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
@@ -4074,22 +4072,22 @@ while ((p = get_config_line()))
fudge. Anything that is not a retry rule starting "F," or "G," is treated as
an address list. */

-  while (isspace(*p)) p++;
+  Uskip_whitespace(&p);
   if (Ustrncmp(p, "senders", 7) == 0)
     {
     p += 7;
-    while (isspace(*p)) p++;
+    Uskip_whitespace(&p);
     if (*p++ != '=') log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
       "\"=\" expected after \"senders\" in retry rule");
-    while (isspace(*p)) p++;
+    Uskip_whitespace(&p);
     next->senders = string_dequote(&p);
     }


/* Now the retry rules. Keep the maximum timeout encountered. */

- while (isspace(*p)) p++;
+ Uskip_whitespace(&p);

-  while (*p != 0)
+  while (*p)
     {
     retry_rule *rule = store_get(sizeof(retry_rule), FALSE);
     *rchain = rule;
@@ -4122,13 +4120,12 @@ while ((p = get_config_line()))
       log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
         "bad parameters for retry rule");


-    while (isspace(*p)) p++;
-    if (*p == ';')
+    if (Uskip_whitespace(&p) == ';')
       {
       p++;
-      while (isspace(*p)) p++;
+      Uskip_whitespace(&p);
       }
-    else if (*p != 0)
+    else if (*p)
       log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "semicolon expected");
     }
   }
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 9055020..2c54a4c 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -3194,7 +3194,7 @@ for (;;)
     {
     smtp_printf("%.3s-%.*s%.*s\r\n", TRUE, code, esclen, esc, (int)(nl - msg), msg);
     msg = nl + 1;
-    while (isspace(*msg)) msg++;
+    Uskip_whitespace(&msg);
     }
   }
 }
diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c
index 12ed5bc..7ea5a7c 100644
--- a/src/src/smtp_out.c
+++ b/src/src/smtp_out.c
@@ -63,8 +63,8 @@ if (is_tainted(expint))
   return FALSE;
   }


-while (isspace(*expint)) expint++;
-if (*expint == 0) return TRUE;
+Uskip_whitespace(&expint);
+if (!*expint) return TRUE;

 while ((iface = string_nextinlist(&expint, &sep, big_buffer,
           big_buffer_size)))
diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c
index 426a8c1..f96d001 100644
--- a/src/src/transports/appendfile.c
+++ b/src/src/transports/appendfile.c
@@ -289,9 +289,9 @@ for (int i = 0; i < 5; i++)
        rest += sizeof("/no_check") - 1;
       }


-    while (isspace(*rest)) rest++;
+    Uskip_whitespace(&rest);


-    if (*rest != 0)
+    if (*rest)
       {
       *errmsg = string_sprintf("Malformed value \"%s\" (expansion of \"%s\") "
         "in %s transport", s, q, tblock->name);
diff --git a/src/src/verify.c b/src/src/verify.c
index dc2e576..4b584c0 100644
--- a/src/src/verify.c
+++ b/src/src/verify.c
@@ -2417,7 +2417,7 @@ for (int i = 0; i < recipients_count; i++)


     colon = Ustrchr(h->text, ':');
     s = colon + 1;
-    while (isspace(*s)) s++;
+    Uskip_whitespace(&s);


     /* Loop for multiple addresses in the header, enabling group syntax. Note
     that we have to reset this after the header has been scanned. */
@@ -2455,7 +2455,7 @@ for (int i = 0; i < recipients_count; i++)
       /* Advance to the next address */


       s = ss + (terminator ? 1:0);
-      while (isspace(*s)) s++;
+      Uskip_whitespace(&s);
       }   /* Next address */


     f.parse_allow_group = FALSE;