use char variants of the <ctype.h> isxxxx() family

This commit is contained in:
rlar
2016-03-09 20:24:36 +01:00
parent d0c5a495ca
commit 71a7c3459b
41 changed files with 259 additions and 259 deletions
+29 -29
View File
@@ -148,7 +148,7 @@ scannum(char *str)
{
int i = 0;
while(isdigit(*str))
while(isdigit_c(*str))
i = i * 10 + *(str++) - '0';
return(i);
}
@@ -160,8 +160,8 @@ int
cieq(const char *p, const char *s)
{
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) !=
(isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) !=
(isupper_c(*s) ? tolower(*s) : *s))
return(FALSE);
p++;
s++;
@@ -175,8 +175,8 @@ int
ciprefix(const char *p, const char *s)
{
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) !=
(isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) !=
(isupper_c(*s) ? tolower(*s) : *s))
return(FALSE);
p++;
s++;
@@ -189,7 +189,7 @@ strtolower(char *str)
{
if (str)
while (*str) {
if(isupper(*str))
if(isupper_c(*str))
*str = (char) tolower(*str);
str++;
}
@@ -200,7 +200,7 @@ strtoupper(char *str)
{
if (str)
while (*str) {
if(islower(*str))
if(islower_c(*str))
*str = (char) toupper(*str);
str++;
}
@@ -228,7 +228,7 @@ register int n)
if (!p || !s) return( 0 );
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) != (isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) != (isupper_c(*s) ? tolower(*s) : *s))
return( 0 );
p++;
s++;
@@ -255,7 +255,7 @@ register char *p, register char *s)
if (!p || !s) return( 0 );
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) != (isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) != (isupper_c(*s) ? tolower(*s) : *s))
return( n );
p++;
s++;
@@ -282,12 +282,12 @@ gettok(char **s)
char *beg, *token ; /* return token */
paren = 0;
while (isspace(**s))
while (isspace_c(**s))
(*s)++;
if (!**s)
return (NULL);
beg = *s ;
while ((c = **s) != '\0' && !isspace(c)) {
while ((c = **s) != '\0' && !isspace_c(c)) {
if (c == '(')
paren += 1;
else if (c == ')')
@@ -297,7 +297,7 @@ gettok(char **s)
(*s)++ ;
}
token = copy_substring(beg, *s) ;
while (isspace(**s) || **s == ',')
while (isspace_c(**s) || **s == ',')
(*s)++;
return ( token ) ;
}
@@ -316,7 +316,7 @@ gettok_iv(char **s)
SPICE_DSTRING buf ; /* allow any length string */
paren = 0;
while ((isspace(**s)) || (**s=='='))
while ((isspace_c(**s)) || (**s=='='))
(*s)++;
if ((!**s) || ((**s != 'v') && (**s != 'i') && (**s != 'V') && (**s != 'I')))
return (NULL);
@@ -329,14 +329,14 @@ gettok_iv(char **s)
paren += 1;
else if (c == ')')
paren -= 1;
if (isspace(c))
if (isspace_c(c))
(*s)++;
else {
spice_dstring_append_char( &buf, *(*s)++ ) ;
if (paren == 0) break;
}
}
while (isspace(**s) || **s == ',')
while (isspace_c(**s) || **s == ',')
(*s)++;
token = copy( spice_dstring_value(&buf) ) ;
spice_dstring_free(&buf) ;
@@ -357,7 +357,7 @@ gettok_noparens(char **s)
char c;
char *beg, *token ; /* return token */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++; /* iterate over whitespace */
if (!**s)
@@ -365,7 +365,7 @@ gettok_noparens(char **s)
beg = *s ;
while ((c = **s) != '\0' &&
!isspace(c) &&
!isspace_c(c) &&
( **s != '(' ) &&
( **s != ')' ) &&
( **s != ',')
@@ -376,7 +376,7 @@ gettok_noparens(char **s)
token = copy_substring(beg, *s) ;
/* Now iterate up to next non-whitespace char */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++;
return ( token ) ;
@@ -388,7 +388,7 @@ gettok_instance(char **s)
char c;
char *beg, *token ; /* return token */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++; /* iterate over whitespace */
if (!**s)
@@ -396,7 +396,7 @@ gettok_instance(char **s)
beg = *s ;
while ((c = **s) != '\0' &&
!isspace(c) &&
!isspace_c(c) &&
( **s != '(' ) &&
( **s != ')' )
) {
@@ -406,7 +406,7 @@ gettok_instance(char **s)
token = copy_substring(beg, *s) ;
/* Now iterate up to next non-whitespace char */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++;
return ( token ) ;
@@ -424,7 +424,7 @@ gettok_char(char **s, char p, bool inc_p, bool nested)
char c;
char *beg, *token ; /* return token */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++; /* iterate over whitespace */
if (!**s)
@@ -472,7 +472,7 @@ gettok_char(char **s, char p, bool inc_p, bool nested)
token = copy_substring(beg, *s) ;
/* Now iterate up to next non-whitespace char */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++;
return ( token ) ;
@@ -493,7 +493,7 @@ gettok_node(char **s)
if (*s == NULL)
return NULL;
while (isspace(**s) ||
while (isspace_c(**s) ||
( **s == '(' ) ||
( **s == ')' ) ||
( **s == ',')
@@ -505,7 +505,7 @@ gettok_node(char **s)
token = *s;
while ((c = **s) != '\0' &&
!isspace(c) &&
!isspace_c(c) &&
( **s != '(' ) &&
( **s != ')' ) &&
( **s != ',')
@@ -516,7 +516,7 @@ gettok_node(char **s)
token = copy_substring(token, *s);
/* Now iterate up to next non-whitespace char */
while (isspace(**s) ||
while (isspace_c(**s) ||
( **s == '(' ) ||
( **s == ')' ) ||
( **s == ',')
@@ -665,12 +665,12 @@ get_comma_separated_values( char *values[], char *str ) {
while ( ( comma_ptr = strstr( str, "," ) ) != NULL ) {
ptr = comma_ptr - 1;
while ( isspace(*ptr) ) ptr--;
while ( isspace_c(*ptr) ) ptr--;
ptr++; keep = *ptr; *ptr = '\0';
values[count++] = strdup(str);
*ptr = keep;
str = comma_ptr + 1;
while ( isspace(*str) ) str++;
while ( isspace_c(*str) ) str++;
}
values[count++] = strdup(str);
return count;
@@ -711,7 +711,7 @@ model_name_match(const char *token, const char *model_name)
// all of them digits
for (; *p; p++)
if (!isdigit(*p))
if (!isdigit_c(*p))
return 0;
return 2;