X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Ffilter%2Ffilter-visitor-generate-ir.c;h=e3dc1aab9481467ec4140341255b099b4d71ff76;hp=f734b56e3fb4f6bbbd2a9d6609d9222f85f3b379;hb=9f449915b9d44ce3c9c9255f5d491a62545fee25;hpb=9c55c24114a3ba83a423690b0e86d64c9b2fb027 diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c index f734b56e3..e3dc1aab9 100644 --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c @@ -31,6 +31,7 @@ #include "filter-ir.h" #include +#include static struct ir_op *generate_ir_recursive(struct filter_parser_ctx *ctx, @@ -68,6 +69,22 @@ struct ir_op *make_op_root(struct ir_op *child, enum ir_side side) return op; } +static +enum ir_load_string_type get_literal_string_type(const char *string) +{ + assert(string); + + if (strutils_is_star_glob_pattern(string)) { + if (strutils_is_star_at_the_end_only_glob_pattern(string)) { + return IR_LOAD_STRING_TYPE_GLOB_STAR_END; + } + + return IR_LOAD_STRING_TYPE_GLOB_STAR; + } + + return IR_LOAD_STRING_TYPE_PLAIN; +} + static struct ir_op *make_op_load_string(char *string, enum ir_side side) { @@ -80,8 +97,9 @@ struct ir_op *make_op_load_string(char *string, enum ir_side side) op->data_type = IR_DATA_STRING; op->signedness = IR_SIGN_UNKNOWN; op->side = side; - op->u.load.u.string = strdup(string); - if (!op->u.load.u.string) { + op->u.load.u.string.type = get_literal_string_type(string); + op->u.load.u.string.value = strdup(string); + if (!op->u.load.u.string.value) { free(op); return NULL; } @@ -366,7 +384,7 @@ void filter_free_ir_recursive(struct ir_op *op) case IR_OP_LOAD: switch (op->data_type) { case IR_DATA_STRING: - free(op->u.load.u.string); + free(op->u.load.u.string.value); break; case IR_DATA_FIELD_REF: /* fall-through */ case IR_DATA_GET_CONTEXT_REF: