Refactoring: syscall: break loops when found
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 5 Nov 2021 19:20:46 +0000 (15:20 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 5 Nov 2021 19:20:46 +0000 (15:20 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If30584dbedd47e891a823a180204aad7a7a6ddff

src/lttng-syscalls.c

index 2e8324133d53ed069ec325bd29fd958ca6360d28..14c79bc1ccb3a200c679c1472f41d6529b797674 100644 (file)
@@ -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);
This page took 0.027199 seconds and 4 git commands to generate.