Cleanup: have interpreter functions return _DISCARD instead of 0
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 12 May 2020 15:38:15 +0000 (11:38 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 12 May 2020 17:37:14 +0000 (13:37 -0400)
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 <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id8f199d82b17228fdc882e3ccbab8b3535840984

liblttng-ust/lttng-filter-interpreter.c

index 6f13aa04e47f9d43973df802f2262687b2257b10..5255bb73238ea7bb6def6dfd136229028ab326e0 100644 (file)
@@ -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;
 }
 
This page took 0.026838 seconds and 4 git commands to generate.