* [PATCH] libtraceevent: Allow function parameters to have operators
@ 2022-12-14 3:19 Steven Rostedt
0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2022-12-14 3:19 UTC (permalink / raw)
To: Linux Trace Devel
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
It is perfectly fine if a function parameter has operators. Parse them
properly.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
src/event-parse.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/event-parse.c b/src/event-parse.c
index 8ec95a2ac069..1aeed953a120 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);
--
2.35.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-14 3:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-14 3:19 [PATCH] libtraceevent: Allow function parameters to have operators Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).