dri/common: Tokenize driParseDebugString() argument before matching debug flags.

Fixes debug string parsing when one of the supported flags is a
substring of another.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
Francisco Jerez 2015-09-03 15:20:04 +03:00 committed by Iago Toral Quiroga
parent 3d4f75506c
commit 6cf4142db8

View file

@ -50,10 +50,19 @@ driParseDebugString(const char *debug,
if (debug != NULL) {
for (; control->string != NULL; control++) {
if (!strcmp(debug, "all") ||
strstr(debug, control->string) != NULL) {
flag |= control->flag;
}
if (!strcmp(debug, "all")) {
flag |= control->flag;
} else {
const char *s = debug;
unsigned n;
for (; n = strcspn(s, ", "), *s; s += MAX2(1, n)) {
if (strlen(control->string) == n &&
!strncmp(control->string, s, n))
flag |= control->flag;
}
}
}
}