From 867df2bacd7fb9cac1f95b4f88e0b0eff7172c5b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 5 Apr 2016 09:30:31 -0400 Subject: [PATCH] Fix: remove dead code from filter interpreter This has been detected in the lttng-modules port of the filter interpreter by Coverity. The intent of the code in UST is similar, and we can find the same dead code, although Coverity may not see it as dead code because it cannot prove that the string is not modified between the two uses. Since we know it is not modified, remove the dead code. Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-filter-interpreter.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/liblttng-ust/lttng-filter-interpreter.c b/liblttng-ust/lttng-filter-interpreter.c index df4add22..29e94eb9 100644 --- a/liblttng-ust/lttng-filter-interpreter.c +++ b/liblttng-ust/lttng-filter-interpreter.c @@ -71,16 +71,12 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type) } } 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 (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); -- 2.34.1