diff mbox series

[2/3] libtraceevent: No need for testing ok in else if (!ok) in process_sizeof()

Message ID 20230324200145.287158-3-rostedt@goodmis.org (mailing list archive)
State Superseded
Headers show
Series libtraceevent | expand

Commit Message

Steven Rostedt March 24, 2023, 8:01 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The if/else if logic in process_sizeof() has:

	if (ok || strcmp(token, "int") == 0) {
		[..]
	} else if (strcmp(token, "long") == 0) {
		[..]
	} else if (strcmp(token, "REC") == 0) {
		[..]
	} else if (!ok) {
		goto error;
	}

By the time we get to } else if (!ok) {, ok will always be false as if it
were true, it would enter the first if block.

Just make it end with:
	} else {
		goto error;
	}

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/event-parse.c b/src/event-parse.c
index 2584b3605136..4a8b81c33a45 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -3586,7 +3586,7 @@  process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
 		if (ret < 0)
 			goto error;
 
-	} else if (!ok) {
+	} else {
 		goto error;
 	}