diff --git a/src/util/u_debug.c b/src/util/u_debug.c index a86b37a67e9..3a5d3a691a8 100644 --- a/src/util/u_debug.c +++ b/src/util/u_debug.c @@ -423,18 +423,17 @@ parse_debug_string(const char *debug, if (debug != NULL) { for (; control->string != NULL; control++) { - if (!strncmp(debug, "all", strlen("all"))) { - flag |= control->flag; + const char *s = debug; + unsigned n; - } else { - const char *s = debug; - unsigned n; + for (; n = strcspn(s, ", "), *s; s += MAX2(1, n)) { + if (!n) + continue; - for (; n = strcspn(s, ", "), *s; s += MAX2(1, n)) { - if (strlen(control->string) == n && - !strncmp(control->string, s, n)) - flag |= control->flag; - } + if (!strncmp("all", s, n) || + (strlen(control->string) == n && + !strncmp(control->string, s, n))) + flag |= control->flag; } } }