diff options
Diffstat (limited to 'ws.c')
-rw-r--r-- | ws.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -29,6 +29,7 @@ unsigned parse_whitespace_rule(const char *string) int i; size_t len; const char *ep; + const char *arg; int negated = 0; string = string + strspn(string, ", \t\n\r"); @@ -52,15 +53,15 @@ unsigned parse_whitespace_rule(const char *string) rule |= whitespace_rule_names[i].rule_bits; break; } - if (strncmp(string, "tabwidth=", 9) == 0) { - unsigned tabwidth = atoi(string + 9); + if (skip_prefix(string, "tabwidth=", &arg)) { + unsigned tabwidth = atoi(arg); if (0 < tabwidth && tabwidth < 0100) { rule &= ~WS_TAB_WIDTH_MASK; rule |= tabwidth; } else warning("tabwidth %.*s out of range", - (int)(len - 9), string + 9); + (int)(ep - arg), arg); } string = ep; } |