From: Mathieu Desnoyers Date: Sat, 11 Mar 2017 13:38:49 +0000 (-0500) Subject: filter: use SIZE_MAX rather than UINT_MAX and tuncating -1ULL X-Git-Tag: v2.10.0-rc1~8 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a63d0dc8be804cab34db94489e15dd99fd1f05a2;p=lttng-ust.git filter: use SIZE_MAX rather than UINT_MAX and tuncating -1ULL The backing type is a size_t, so use SIZE_MAX to represent infinity. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-filter-interpreter.c b/liblttng-ust/lttng-filter-interpreter.c index afea3f15..258c43c9 100644 --- a/liblttng-ust/lttng-filter-interpreter.c +++ b/liblttng-ust/lttng-filter-interpreter.c @@ -26,6 +26,7 @@ #define _LGPL_SOURCE #include +#include #include "lttng-filter.h" #include "string-utils.h" @@ -56,17 +57,13 @@ int parse_char(const char **p) } /* - * Returns -1ULL if the string is null-terminated, or the number of + * Returns SIZE_MAX if the string is null-terminated, or the number of * characters if not. */ static size_t get_str_or_seq_len(const struct estack_entry *entry) { - if (entry->u.s.seq_len == UINT_MAX) { - return -1ULL; - } else { - return entry->u.s.seq_len; - } + return entry->u.s.seq_len; } static @@ -1300,7 +1297,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, ret = -EINVAL; goto end; } - estack_ax(stack, top)->u.s.seq_len = UINT_MAX; + estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_NONE; estack_ax_t = REG_STRING; @@ -1374,7 +1371,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, dbg_printf("load string %s\n", insn->data); estack_push(stack, top, ax, bx, ax_t, bx_t); estack_ax(stack, top)->u.s.str = insn->data; - estack_ax(stack, top)->u.s.seq_len = UINT_MAX; + estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_PLAIN; estack_ax_t = REG_STRING; @@ -1389,7 +1386,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, dbg_printf("load globbing pattern %s\n", insn->data); estack_push(stack, top, ax, bx, ax_t, bx_t); estack_ax(stack, top)->u.s.str = insn->data; - estack_ax(stack, top)->u.s.seq_len = UINT_MAX; + estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_STAR_GLOB; estack_ax_t = REG_STAR_GLOB_STRING; @@ -1495,7 +1492,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, ret = -EINVAL; goto end; } - estack_ax(stack, top)->u.s.seq_len = UINT_MAX; + estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_NONE; dbg_printf("ref get context dynamic string %s\n", estack_ax(stack, top)->u.s.str); @@ -1530,7 +1527,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, ret = -EINVAL; goto end; } - estack_ax(stack, top)->u.s.seq_len = UINT_MAX; + estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_NONE; estack_ax_t = REG_STRING;