diff options
author | Francisco Jerez <[email protected]> | 2015-09-03 15:20:04 +0300 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2015-09-04 12:49:36 +0200 |
commit | 6cf4142db88796ff66a73a36530467101533fdb6 (patch) | |
tree | 4b36576ea9d35f5ecdab302ec4c97b9fd107b2bb /src/mesa/drivers/dri/common | |
parent | 3d4f75506c9233ca4039021024c4b918cc974f86 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r-- | src/mesa/drivers/dri/common/utils.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 1e3b15b6190..1246bec6e02 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -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; + } + } } } |