diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-12-13 22:19:13 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-12-13 22:24:25 -0500 |
commit | 0f8a6152370582f1c1a812eca0b5f14540fef4b9 (patch) | |
tree | 885bcb9f4d7521a2335e63de8143391251cf67de | |
parent | 4fb990a5a922d13dff847939a565a0adfa4e1b37 (diff) | |
download | libtraceevent-0f8a6152370582f1c1a812eca0b5f14540fef4b9.tar.gz |
libtraceevent: Allow function parameters to have operators
It is perfectly fine if a function parameter has operators. Parse them
properly.
Link: https://lore.kernel.org/linux-trace-devel/20221213221913.0cc8e17c@gandalf.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | src/event-parse.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/event-parse.c b/src/event-parse.c index 8ec95a2..1aeed95 100644 --- a/src/event-parse.c +++ b/src/event-parse.c @@ -2570,19 +2570,31 @@ static int alloc_and_process_delim(struct tep_event *event, char *next_token, type = process_arg(event, field, &token); - if (test_type_token(type, token, TEP_EVENT_DELIM, next_token)) { - errno = EINVAL; - ret = -1; - free_arg(field); - goto out_free_token; + /* We do allow operators */ + if (type == TEP_EVENT_OP) { + type = process_op(event, field, &token); + + if (consolidate_op_arg(field) < 0) + type = TEP_EVENT_ERROR; + + if (type == TEP_EVENT_ERROR) + goto out_error; } + if (test_type_token(type, token, TEP_EVENT_DELIM, next_token)) + goto out_error; + *print_arg = field; out_free_token: free_token(token); return ret; +out_error: + errno = EINVAL; + ret = -1; + free_arg(field); + goto out_free_token; } static char *arg_eval (struct tep_print_arg *arg); |