aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2023-03-24 16:09:24 -0400
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-03-27 17:56:03 -0400
commitda2ea6bc6079b16ffb42957128ce784cc2230dac (patch)
tree8bb062b1199bb95ad7663fe84724fa21035b30b1
parente6f7cfa0f0d432451b77d228f87287310f34d7c2 (diff)
downloadlibtraceevent-da2ea6bc6079b16ffb42957128ce784cc2230dac.tar.gz
libtraceevent: Rename "ok" to "token_has_paren" in process_sizeof()
The "ok" variable is set to true if at the end of the if/else blocks the token contains the last element of "sizeof(..)", which would be that ")" parenthesis. Calling it "ok" is meaningless and confusing. Call the variable what it is for "token_has_paren". That will make the logic much easier to understand. Link: https://lore.kernel.org/linux-trace-devel/20230324200924.287521-4-rostedt@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--src/event-parse.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/event-parse.c b/src/event-parse.c
index 4a8b81c..acf7fde 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -3522,7 +3522,7 @@ process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
struct tep_format_field *field;
enum tep_event_type type;
char *token = NULL;
- bool ok = false;
+ bool token_has_paren = false;
int ret;
type = read_token_item(event->tep, &token);
@@ -3537,11 +3537,12 @@ process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
if (type == TEP_EVENT_ERROR)
goto error;
+ /* If it's not an item (like "long") then do not process more */
if (type != TEP_EVENT_ITEM)
- ok = true;
+ token_has_paren = true;
}
- if (ok || strcmp(token, "int") == 0) {
+ if (token_has_paren || strcmp(token, "int") == 0) {
arg->atom.atom = strdup("4");
} else if (strcmp(token, "long") == 0) {
@@ -3563,7 +3564,7 @@ process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
goto error;
}
/* The token is the next token */
- ok = true;
+ token_has_paren = true;
}
} else if (strcmp(token, "REC") == 0) {
@@ -3590,7 +3591,7 @@ process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
goto error;
}
- if (!ok) {
+ if (!token_has_paren) {
/* The token contains the last item before the parenthesis */
free_token(token);
type = read_token_item(event->tep, &token);