|
@@ -2710,7 +2710,6 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
|
|
struct print_arg *farg;
|
|
struct print_arg *farg;
|
|
enum event_type type;
|
|
enum event_type type;
|
|
char *token;
|
|
char *token;
|
|
- const char *test;
|
|
|
|
int i;
|
|
int i;
|
|
|
|
|
|
arg->type = PRINT_FUNC;
|
|
arg->type = PRINT_FUNC;
|
|
@@ -2727,15 +2726,19 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
|
|
}
|
|
}
|
|
|
|
|
|
type = process_arg(event, farg, &token);
|
|
type = process_arg(event, farg, &token);
|
|
- if (i < (func->nr_args - 1))
|
|
|
|
- test = ",";
|
|
|
|
- else
|
|
|
|
- test = ")";
|
|
|
|
-
|
|
|
|
- if (test_type_token(type, token, EVENT_DELIM, test)) {
|
|
|
|
- free_arg(farg);
|
|
|
|
- free_token(token);
|
|
|
|
- return EVENT_ERROR;
|
|
|
|
|
|
+ if (i < (func->nr_args - 1)) {
|
|
|
|
+ if (type != EVENT_DELIM || strcmp(token, ",") != 0) {
|
|
|
|
+ warning("Error: function '%s()' expects %d arguments but event %s only uses %d",
|
|
|
|
+ func->name, func->nr_args,
|
|
|
|
+ event->name, i + 1);
|
|
|
|
+ goto err;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (type != EVENT_DELIM || strcmp(token, ")") != 0) {
|
|
|
|
+ warning("Error: function '%s()' only expects %d arguments but event %s has more",
|
|
|
|
+ func->name, func->nr_args, event->name);
|
|
|
|
+ goto err;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
*next_arg = farg;
|
|
*next_arg = farg;
|
|
@@ -2747,6 +2750,11 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
|
|
*tok = token;
|
|
*tok = token;
|
|
|
|
|
|
return type;
|
|
return type;
|
|
|
|
+
|
|
|
|
+err:
|
|
|
|
+ free_arg(farg);
|
|
|
|
+ free_token(token);
|
|
|
|
+ return EVENT_ERROR;
|
|
}
|
|
}
|
|
|
|
|
|
static enum event_type
|
|
static enum event_type
|