From: Francis Deslauriers Date: Tue, 12 May 2020 15:38:15 +0000 (-0400) Subject: Cleanup: have interpreter functions return _DISCARD instead of 0 X-Git-Tag: v2.13.0-rc1~496 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4526ba6908b141a77d711bb38d2971f640ce5a7e;p=lttng-ust.git Cleanup: have interpreter functions return _DISCARD instead of 0 It's easier to understand the meaning of the zero return value of these function using the enum. It makes it obvious. Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers Change-Id: Id8f199d82b17228fdc882e3ccbab8b3535840984 --- diff --git a/liblttng-ust/lttng-filter-interpreter.c b/liblttng-ust/lttng-filter-interpreter.c index 6f13aa04..5255bb73 100644 --- a/liblttng-ust/lttng-filter-interpreter.c +++ b/liblttng-ust/lttng-filter-interpreter.c @@ -164,7 +164,7 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type) uint64_t lttng_filter_false(void *filter_data, const char *filter_stack_data) { - return 0; + return LTTNG_FILTER_DISCARD; } #ifdef INTERPRETER_USE_SWITCH @@ -793,7 +793,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, goto end; OP(FILTER_OP_RETURN): - /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */ + /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */ /* Handle dynamic typing. */ switch (estack_ax_t) { case REG_S64: @@ -810,7 +810,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, goto end; OP(FILTER_OP_RETURN_S64): - /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */ + /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */ retval = !!estack_ax_v; ret = 0; goto end; @@ -2367,9 +2367,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, END_OP end: - /* return 0 (discard) on error */ + /* Return _DISCARD on error. */ if (ret) - return 0; + return LTTNG_FILTER_DISCARD; return retval; }