Fix: remove dead code from filter interpreter
[lttng-ust.git] / liblttng-ust / lttng-filter-interpreter.c
index 1f43decee2e32414cb71b3f06e2cd2e9d3afbbaf..29e94eb98b4277b3c1d0052358b137ca3d13e425 100644 (file)
@@ -58,8 +58,8 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
        for (;;) {
                int escaped_r0 = 0;
 
-               if (unlikely(p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0')) {
-                       if (q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0') {
+               if (unlikely(p - estack_bx(stack, top)->u.s.str >= estack_bx(stack, top)->u.s.seq_len || *p == '\0')) {
+                       if (q - estack_ax(stack, top)->u.s.str >= estack_ax(stack, top)->u.s.seq_len || *q == '\0') {
                                return 0;
                        } else {
                                if (estack_ax(stack, top)->u.s.literal) {
@@ -70,17 +70,13 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
                                return -1;
                        }
                }
-               if (unlikely(q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0')) {
-                       if (p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0') {
-                               return 0;
-                       } else {
-                               if (estack_bx(stack, top)->u.s.literal) {
-                                       ret = parse_char(&p);
-                                       if (ret == -1)
-                                               return 0;
-                               }
-                               return 1;
+               if (unlikely(q - estack_ax(stack, top)->u.s.str >= estack_ax(stack, top)->u.s.seq_len || *q == '\0')) {
+                       if (estack_bx(stack, top)->u.s.literal) {
+                               ret = parse_char(&p);
+                               if (ret == -1)
+                                       return 0;
                        }
+                       return 1;
                }
                if (estack_bx(stack, top)->u.s.literal) {
                        ret = parse_char(&p);
@@ -176,7 +172,6 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                const char *filter_stack_data)
 {
        struct bytecode_runtime *bytecode = filter_data;
-       struct lttng_ctx *ctx = bytecode->p.bc->enabler->chan->ctx;
        void *pc, *next_pc, *start_pc;
        int ret = -EINVAL;
        uint64_t retval = 0;
@@ -864,7 +859,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printf("get context ref offset %u type string\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx);
                        estack_ax(stack, top)->u.s.str = v.str;
@@ -889,7 +884,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printf("get context ref offset %u type s64\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx);
                        estack_ax_v = v.s64;
@@ -907,7 +902,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printf("get context ref offset %u type double\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx);
                        memcpy(&estack_ax(stack, top)->u.d, &v.d, sizeof(struct literal_double));
This page took 0.02439 seconds and 4 git commands to generate.