From: Mathieu Desnoyers Date: Fri, 5 Nov 2021 19:20:46 +0000 (-0400) Subject: Refactoring: syscall: break loops when found X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6768203a5a4f1e8ef32629d3b25e83b91e3645fe;p=lttng-modules.git Refactoring: syscall: break loops when found Signed-off-by: Mathieu Desnoyers Change-Id: If30584dbedd47e891a823a180204aad7a7a6ddff --- diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index 2e832413..14c79bc1 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -649,7 +649,7 @@ void lttng_syscall_event_enabler_create_matching_syscall_table_events(struct ltt for (i = 0; i < table_len; i++) { struct lttng_kernel_event_common_private *event_priv; struct hlist_head *head; - int found = 0; + bool found = false; desc = table[i].desc; if (!desc) { @@ -665,8 +665,10 @@ void lttng_syscall_event_enabler_create_matching_syscall_table_events(struct ltt */ head = utils_borrow_hash_table_bucket(events_ht->table, LTTNG_EVENT_HT_SIZE, desc->event_name); lttng_hlist_for_each_entry(event_priv, head, hlist_node) { - if (lttng_event_enabler_desc_match_event(syscall_event_enabler_common, desc, event_priv->pub)) - found = 1; + if (lttng_event_enabler_desc_match_event(syscall_event_enabler_common, desc, event_priv->pub)) { + found = true; + break; + } } if (found) continue; @@ -741,8 +743,10 @@ void create_unknown_syscall_event(struct lttng_event_enabler_common *event_enabl */ head = utils_borrow_hash_table_bucket(events_ht->table, LTTNG_EVENT_HT_SIZE, desc->event_name); lttng_hlist_for_each_entry(event_priv, head, hlist_node) { - if (lttng_event_enabler_desc_match_event(event_enabler, desc, event_priv->pub)) + if (lttng_event_enabler_desc_match_event(event_enabler, desc, event_priv->pub)) { found = true; + break; + } } if (!found) lttng_syscall_event_enabler_create_event(event_enabler, desc, unknown_dispatch_list, type, -1U);