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)
found = TRUE;
s = h->text + len; /* text to insert */
if (!(flags & FH_WANT_RAW)) /* unless wanted raw, */
- while (isspace(*s)) s++; /* remove leading white space */
+ Uskip_whitespace(&s); /* remove leading white space */
t = h->text + h->slen; /* end-point */
/* Unless wanted raw, remove trailing whitespace, including the
unsigned array_depth = 0, object_depth = 0;
const uschar * s = *list, * item;
-while (isspace(*s)) s++;
+skip_whitespace(&s);
for (item = s;
*s && (*s != ',' || array_depth != 0 || object_depth != 0);
const uschar *rerror;
for (;;)
- {
- while (isspace(*s)) s++;
- if (*s == '!') { testfor = !testfor; s++; } else break;
- }
+ if (Uskip_whitespace(&s) == '!') { testfor = !testfor; s++; } else break;
switch(cond_type = identify_operator(&s, &opname))
{
case ECOND_LDAPAUTH:
case ECOND_PWCHECK:
- while (isspace(*s)) s++;
- if (*s != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
+ if (Uskip_whitespace(&s) != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
sub[0] = expand_string_internal(s+1, TRUE, &s, yield == NULL, TRUE, resetok);
if (!sub[0]) return NULL;
uschar *user_msg;
BOOL cond = FALSE;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{') goto COND_FAILED_CURLY_START; /*}*/
switch(read_subs(sub, nelem(sub), 1,
#else
{
uschar *sub[4];
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
switch(read_subs(sub, nelem(sub), 2, &s, yield == NULL, TRUE, name,
resetok))
if ((i > 0) && !sub2_honour_dollar)
honour_dollar = FALSE;
- while (isspace(*s)) s++;
- if (*s != '{')
+ if (Uskip_whitespace(&s) != '{')
{
if (i == 0) goto COND_FAILED_CURLY_START;
expand_string_message = string_sprintf("missing 2nd string in {} "
subcondptr = (yield == NULL) ? NULL : &tempcond;
combined_cond = (cond_type == ECOND_AND);
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
for (;;)
{
- while (isspace(*s)) s++;
/* {-for-text-editors */
- if (*s == '}') break;
+ if (Uskip_whitespace(&s) == '}') break;
if (*s != '{') /* }-for-text-editors */
{
expand_string_message = string_sprintf("each subcondition "
expand_string_message, opname);
return NULL;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
/* {-for-text-editors */
if (*s++ != '}')
DEBUG(D_expand) debug_printf_indent("condition: %s\n", opname);
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
if (!(sub[0] = expand_string_internal(s, TRUE, &s, yield == NULL, TRUE, resetok)))
return NULL;
/* {-for-text-editors */
if (*s++ != '}') goto COND_FAILED_CURLY_END;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
sub[1] = s;
expand_string_message, opname);
return NULL;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
/* {-for-text-editors */
if (*s++ != '}')
uschar *ourname;
size_t len;
BOOL boolvalue = FALSE;
- while (isspace(*s)) s++;
- if (*s != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
+
+ if (Uskip_whitespace(&s) != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
ourname = cond_type == ECOND_BOOL_LAX ? US"bool_lax" : US"bool";
switch(read_subs(sub_arg, 1, 1, &s, yield == NULL, FALSE, ourname, resetok))
{
case 3: return NULL;
}
t = sub_arg[0];
- while (isspace(*t)) t++;
- len = Ustrlen(t);
- if (len)
+ Uskip_whitespace(&t);
+ if ((len = Ustrlen(t)))
{
/* trailing whitespace: seems like a good idea to ignore it too */
t2 = t + len - 1;
"true" is substituted. In the fail case, nothing is substituted for all three
items. */
-while (isspace(*s)) s++;
-if (*s == '}')
+if (skip_whitespace(&s) == '}')
{
if (type[0] == 'i')
{
set skipping in the nested call if we don't want this string, or if we were
already skipping. */
-while (isspace(*s)) s++;
-if (*s == '{')
+if (skip_whitespace(&s) == '{')
{
sub2 = expand_string_internal(s+1, TRUE, &s, yes || skipping, TRUE, resetok);
if (sub2 == NULL && (!yes || !f.expand_string_forcedfail)) goto FAILED;
{
if (!yes && !skipping)
{
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '}')
{
errwhere = US"did not close with '}' after forcedfail";
/* All we have to do now is to check on the final closing brace. */
-while (isspace(*s)) s++;
+skip_whitespace(&s);
if (*s++ != '}')
{
errwhere = US"did not close with '}'";
if (*s != ')')
*error = US"expecting closing parenthesis";
else
- while (isspace(*(++s)));
+ while (isspace(*++s));
else if (*s)
*error = US"expecting operator";
*sptr = s;
int save_expand_nmax =
save_expand_strings(save_expand_nstring, save_expand_nlength);
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (!(next_s = eval_condition(s, &resetok, skipping ? NULL : &cond)))
goto EXPAND_FAILED; /* message already set */
/* Get the key we are to look up for single-key+file style lookups.
Otherwise set the key NULL pro-tem. */
- while (isspace(*s)) s++;
- if (*s == '{') /*}*/
+ if (Uskip_whitespace(&s) == '{') /*}*/
{
key = expand_string_internal(s+1, TRUE, &s, skipping, TRUE, &resetok);
if (!key) goto EXPAND_FAILED; /*{{*/
expand_string_message = US"missing '}' after lookup key";
goto EXPAND_FAILED_CURLY;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
}
else key = NULL;
s++;
}
name[nameptr] = '\0';
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
/* Now check for the individual search type and any partial or default
options. Only those types that are actually in the binary are valid. */
expand_string_message = US"missing '}' closing lookup file-or-query arg";
goto EXPAND_FAILED_CURLY;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
/* If this isn't a single-key+file lookup, re-arrange the variables
to be appropriate for the search_ functions. For query-style lookups,
if (!key)
{
- while (isspace(*filename)) filename++;
+ Uskip_whitespace(&filename);
key = filename;
if (mac_islookup(stype, lookup_querystyle))
/* Sort out timeout, if given. The second arg is a list with the first element
being a time value. Any more are options of form "name=value". Currently the
- only option recognised is "shutdown". */
+ only options recognised are "shutdown" and "tls". */
if (sub_arg[2])
{
expand_string_message = US"missing '}' closing failstring for readsocket";
goto EXPAND_FAILED_CURLY;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
}
READSOCK_DONE:
expand_string_message = US"missing '}' closing failstring for readsocket";
goto EXPAND_FAILED_CURLY;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
goto READSOCK_DONE;
}
goto EXPAND_FAILED;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s != '{')
{
expand_string_message = US"missing '{' for command arg of run";
}
if (!(arg = expand_string_internal(s+1, TRUE, &s, skipping, TRUE, &resetok)))
goto EXPAND_FAILED;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '}')
{
expand_string_message = US"missing '}' closing command arg of run";
enum {extract_basic, extract_json, extract_jsons} fmt = extract_basic;
- while (isspace(*s)) s++;
-
/* Check for a format-variant specifier */
- if (*s != '{') /*}*/
+ if (Uskip_whitespace(&s) != '{') /*}*/
if (Ustrncmp(s, "json", 4) == 0)
if (*(s += 4) == 's')
{fmt = extract_jsons; s++;}
expand_string_message = US"missing '{' for arg of extract";
goto EXPAND_FAILED_CURLY;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
}
if ( Ustrncmp(s, "fail", 4) == 0 /*'{'*/
&& (s[4] == '}' || s[4] == ' ' || s[4] == '\t' || !s[4])
)
{
s += 4;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
} /*'{'*/
if (*s != '}')
{
else for (int i = 0, j = 2; i < j; i++) /* Read the proper number of arguments */
{
- while (isspace(*s)) s++;
- if (*s == '{') /*'}'*/
+ if (Uskip_whitespace(&s) == '{') /*'}'*/
{
if (!(sub[i] = expand_string_internal(s+1, TRUE, &s, skipping, TRUE, &resetok)))
goto EXPAND_FAILED; /*'{'*/
int x = 0;
uschar *p = sub[0];
- while (isspace(*p)) p++;
+ Uskip_whitespace(&p);
sub[0] = p;
len = Ustrlen(p);
if (Ustrcmp(item, sub[0]) == 0) /*XXX should be a UTF8-compare */
{
s = item + Ustrlen(item) + 1;
- while (isspace(*s)) s++;
- if (*s != ':')
+ if (Uskip_whitespace(&s) != ':')
{
expand_string_message =
US"missing object value-separator for extract json";
goto EXPAND_FAILED_CURLY;
}
s++;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
lookup_value = s;
break;
}
for (int i = 0; i < 2; i++)
{
- skip_whitespace(&s);
- if (*s != '{') /*'}'*/
+ if (Uskip_whitespace(&s) != '{') /*'}'*/
{
expand_string_message = string_sprintf(
"missing '{' for arg %d of listextract", i+1);
int x = 0;
uschar *p = sub[0];
- while (isspace(*p)) p++;
+ Uskip_whitespace(&p);
sub[0] = p;
len = Ustrlen(p);
save_expand_strings(save_expand_nstring, save_expand_nlength);
/* Read the field argument */
- skip_whitespace(&s);
- if (*s != '{') /*}*/
+ if (Uskip_whitespace(&s) != '{') /*}*/
{
expand_string_message = US"missing '{' for field arg of certextract";
goto EXPAND_FAILED_CURLY;
int len;
uschar *p = sub[0];
- while (isspace(*p)) p++;
+ Uskip_whitespace(&p);
sub[0] = p;
len = Ustrlen(p);
}
/* inspect the cert argument */
- while (isspace(*s)) s++;
- if (*s != '{') /*}*/
+ if (Uskip_whitespace(&s) != '{') /*}*/
{
expand_string_message = US"missing '{' for cert variable arg of certextract";
goto EXPAND_FAILED_CURLY;
uschar *save_iterate_item = iterate_item;
uschar *save_lookup_value = lookup_value;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{')
{
expand_string_message =
if (item_type == EITEM_REDUCE)
{
uschar * t;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{')
{
expand_string_message = US"missing '{' for second arg of reduce";
}
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{')
{
expand_string_message =
goto EXPAND_FAILED;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '}')
{ /*{*/
expand_string_message = string_sprintf("missing } at end of condition "
goto EXPAND_FAILED;
}
- while (isspace(*s)) s++; /*{*/
+ Uskip_whitespace(&s); /*{*/
if (*s++ != '}')
{ /*{*/
expand_string_message = string_sprintf("missing } at end of \"%s\"",
uschar * tmp;
uschar *save_iterate_item = iterate_item;
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{')
{
expand_string_message = US"missing '{' for list arg of sort";
goto EXPAND_FAILED_CURLY;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{')
{
expand_string_message = US"missing '{' for comparator arg of sort";
goto EXPAND_FAILED;
}
- while (isspace(*s)) s++;
+ Uskip_whitespace(&s);
if (*s++ != '{')
{
expand_string_message = US"missing '{' for extractor arg of sort";
uschar * key;
uschar *save_lookup_value = lookup_value;
- while (isspace(*s)) s++;
- if (*s != '{') /*}*/
+ if (Uskip_whitespace(&s) != '{') /*}*/
goto EXPAND_FAILED;
key = expand_string_internal(s+1, TRUE, &s, skipping, TRUE, &resetok);
int save_ptr = gstring_length(yield);
int start, end, domain; /* Not really used */
- while (isspace(*sub)) sub++;
- if (*sub == '>')
+ if (Uskip_whitespace(&sub) == '>')
if (*outsep = *++sub) ++sub;
else
{
noop change since strtol skips it anyway (provided that there is a number
to find at all). */
if (isspace(*s))
- {
- while (isspace(*s)) ++s;
- if (*s == '\0')
+ if (Uskip_whitespace(&s) == '\0')
{
DEBUG(D_expand)
debug_printf_indent("treating blank string as number 0\n");
return 0;
}
- }
value = strtoll(CS s, CSS &endptr, 10);
if (endptr == s)
- {
msg = US"integer expected but \"%s\" found";
- }
else if (value < 0 && isplus)
- {
msg = US"non-negative integer expected but \"%s\" found";
- }
else
{
switch (tolower(*endptr))
if (errno == ERANGE)
msg = US"absolute value of integer \"%s\" is too large (overflow)";
else
- {
- while (isspace(*endptr)) endptr++;
- if (*endptr == 0) return value;
- }
+ if (Uskip_whitespace(&endptr) == 0) return value;
}
expand_string_message = string_sprintf(CS msg, s);