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: Jim Cromie <jim.cromie@gmail.com> Link: https://lore.kernel.org/r/20200921190433.1149521-3-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b85300173d
commit
e5e5fcef60
|
@ -384,10 +384,13 @@ static int ddebug_parse_query(char *words[], int nwords,
|
|||
query->module = modname;
|
||||
|
||||
for (i = 0; i < nwords; i += 2) {
|
||||
if (!strcmp(words[i], "func")) {
|
||||
rc = check_set(&query->function, words[i+1], "func");
|
||||
} else if (!strcmp(words[i], "file")) {
|
||||
if (check_set(&query->filename, words[i+1], "file"))
|
||||
char *keyword = words[i];
|
||||
char *arg = words[i+1];
|
||||
|
||||
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;
|
||||
|
||||
/* tail :$info is function or line-range */
|
||||
|
@ -403,18 +406,18 @@ static int ddebug_parse_query(char *words[], int nwords,
|
|||
if (parse_linerange(query, fline))
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (!strcmp(words[i], "module")) {
|
||||
rc = check_set(&query->module, words[i+1], "module");
|
||||
} else if (!strcmp(words[i], "format")) {
|
||||
string_unescape_inplace(words[i+1], UNESCAPE_SPACE |
|
||||
} else if (!strcmp(keyword, "module")) {
|
||||
rc = check_set(&query->module, arg, "module");
|
||||
} else if (!strcmp(keyword, "format")) {
|
||||
string_unescape_inplace(arg, UNESCAPE_SPACE |
|
||||
UNESCAPE_OCTAL |
|
||||
UNESCAPE_SPECIAL);
|
||||
rc = check_set(&query->format, words[i+1], "format");
|
||||
} else if (!strcmp(words[i], "line")) {
|
||||
if (parse_linerange(query, words[i+1]))
|
||||
rc = check_set(&query->format, arg, "format");
|
||||
} else if (!strcmp(keyword, "line")) {
|
||||
if (parse_linerange(query, arg))
|
||||
return -EINVAL;
|
||||
} else {
|
||||
pr_err("unknown keyword \"%s\"\n", words[i]);
|
||||
pr_err("unknown keyword \"%s\"\n", keyword);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (rc)
|
||||
|
|
Loading…
Reference in New Issue
Block a user