Commit e5e5fcef authored by Jim Cromie's avatar Jim Cromie Committed by Greg Kroah-Hartman

dyndbg: use keyword, arg varnames for query term pairs

optimize for clarity by replacing word[i,i+1] refs with temps.
no functional changes.
Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
Link: https://lore.kernel.org/r/20200921190433.1149521-3-jim.cromie@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b8530017
...@@ -384,10 +384,13 @@ static int ddebug_parse_query(char *words[], int nwords, ...@@ -384,10 +384,13 @@ static int ddebug_parse_query(char *words[], int nwords,
query->module = modname; query->module = modname;
for (i = 0; i < nwords; i += 2) { for (i = 0; i < nwords; i += 2) {
if (!strcmp(words[i], "func")) { char *keyword = words[i];
rc = check_set(&query->function, words[i+1], "func"); char *arg = words[i+1];
} else if (!strcmp(words[i], "file")) {
if (check_set(&query->filename, words[i+1], "file")) if (!strcmp(keyword, "func")) {
rc = check_set(&query->function, arg, "func");
} else if (!strcmp(keyword, "file")) {
if (check_set(&query->filename, arg, "file"))
return -EINVAL; return -EINVAL;
/* tail :$info is function or line-range */ /* tail :$info is function or line-range */
...@@ -403,18 +406,18 @@ static int ddebug_parse_query(char *words[], int nwords, ...@@ -403,18 +406,18 @@ static int ddebug_parse_query(char *words[], int nwords,
if (parse_linerange(query, fline)) if (parse_linerange(query, fline))
return -EINVAL; return -EINVAL;
} }
} else if (!strcmp(words[i], "module")) { } else if (!strcmp(keyword, "module")) {
rc = check_set(&query->module, words[i+1], "module"); rc = check_set(&query->module, arg, "module");
} else if (!strcmp(words[i], "format")) { } else if (!strcmp(keyword, "format")) {
string_unescape_inplace(words[i+1], UNESCAPE_SPACE | string_unescape_inplace(arg, UNESCAPE_SPACE |
UNESCAPE_OCTAL | UNESCAPE_OCTAL |
UNESCAPE_SPECIAL); UNESCAPE_SPECIAL);
rc = check_set(&query->format, words[i+1], "format"); rc = check_set(&query->format, arg, "format");
} else if (!strcmp(words[i], "line")) { } else if (!strcmp(keyword, "line")) {
if (parse_linerange(query, words[i+1])) if (parse_linerange(query, arg))
return -EINVAL; return -EINVAL;
} else { } else {
pr_err("unknown keyword \"%s\"\n", words[i]); pr_err("unknown keyword \"%s\"\n", keyword);
return -EINVAL; return -EINVAL;
} }
if (rc) if (rc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment