precedence makes it necessary, or unless the operands are themselves
expressions that use && and ||. Thus:
- if (!isdigit(s[0]) || !isdigit(s[1]) || !isdigit(s[2])) {
+ if (!isdigit((unsigned char)s[0])
+ || !isdigit((unsigned char)s[1])
+ || !isdigit((unsigned char)s[2])) {
printf("string %s does not start with 3-digit code\n", s);
}
- svec_init(&new_br);
- for (i = 0; i < raw_new_br.n; i++) {
- const char *name = raw_new_br.names[i];
-- if (!strncmp(name, "dp", 2) && isdigit(name[2])) {
+- if (!strncmp(name, "dp", 2) && isdigit((unsigned char)name[2])) {
- VLOG_ERR("%s is not a valid bridge name (bridges may not be "
- "named \"dp\" followed by a digit)", name);
- } else {
out = prompt("Ctlr rate limit:", in,
"^(Disabled|("NUM100_TO_99999_RE")/s)$");
free(in);
- config.rate_limit = isdigit(out[0]) ? atoi(out) : -1;
+ config.rate_limit
+ = isdigit((unsigned char)out[0]) ? atoi(out) : -1;
free(out);
break;
out = prompt("Activity probe:", in,
"^(Default|("NUM5_TO_99999_RE") s)$");
free(in);
- config.inactivity_probe = isdigit(out[0]) ? atoi(out) : -1;
+ config.inactivity_probe
+ = isdigit((unsigned char)out[0]) ? atoi(out) : -1;
free(out);
break;
out = prompt("Max backoff:", in,
"^(Default|("NUM1_TO_99999_RE") s)$");
free(in);
- config.max_backoff = isdigit(out[0]) ? atoi(out) : -1;
+ config.max_backoff
+ = isdigit((unsigned char)out[0]) ? atoi(out) : -1;
free(out);
break;
}
{
int minor;
- minor = !strncmp(name, "dp", 2) && isdigit(name[2]) ? atoi(name + 2) : -1;
+ minor = !strncmp(name, "dp", 2)
+ && isdigit((unsigned char)name[2]) ? atoi(name + 2) : -1;
if (create) {
if (minor >= 0) {
return create_minor(suffix, minor, dpifp);
static int
name_to_dp_idx(const char *name)
{
- if (!strncmp(name, "dp", 2) && isdigit(name[2])) {
+ if (!strncmp(name, "dp", 2) && isdigit((unsigned char)name[2])) {
int dp_idx = atoi(name + 2);
if (dp_idx >= 0 && dp_idx < N_DP_NETDEVS) {
return dp_idx;
s = ds_cstr(&line);
if (*reply_code == -1) {
- if (!isdigit(s[0]) || !isdigit(s[1]) || !isdigit(s[2])) {
+ if (!isdigit((unsigned char)s[0])
+ || !isdigit((unsigned char)s[1])
+ || !isdigit((unsigned char)s[2])) {
VLOG_WARN("reply from %s does not start with 3-digit code",
client->connect_path);
error = EPROTO;
p++;
}
field = 0;
- while (isdigit(*p)) {
+ while (isdigit((unsigned char)*p)) {
field = (field * 10) + (*p - '0');
p++;
}