Clean-up: replace uses of `int found` as bool by `bool found`
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 28 Jan 2023 18:10:39 +0000 (13:10 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 2 Feb 2023 03:03:08 +0000 (22:03 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I95c4cefdc0836203d3bf8e6b9c273cf5f1cbf3fc

src/bin/lttng-sessiond/trace-kernel.cpp
src/bin/lttng/commands/clear.cpp
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/commands/help.cpp

index e1d591761977af24332bcb0c2d3f3cf8df7a7c0c..e695f12955b9ee0092ac0c60a13e4577540fbf16 100644 (file)
@@ -76,7 +76,7 @@ struct ltt_kernel_event *trace_kernel_find_event(char *name,
                                                 struct lttng_bytecode *filter)
 {
        struct ltt_kernel_event *ev;
-       int found = 0;
+       bool found = false;
 
        LTTNG_ASSERT(name);
        LTTNG_ASSERT(channel);
@@ -97,9 +97,11 @@ struct ltt_kernel_event *trace_kernel_find_event(char *name,
                                continue;
                        }
                }
-               found = 1;
+
+               found = true;
                break;
        }
+
        if (found) {
                DBG("Found event %s for channel %s", name, channel->channel->name);
                return ev;
@@ -116,7 +118,7 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(char *name,
                                                        enum lttng_event_type type)
 {
        struct ltt_kernel_event *ev;
-       int found = 0;
+       bool found = false;
 
        LTTNG_ASSERT(name);
        LTTNG_ASSERT(channel);
@@ -128,9 +130,11 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(char *name,
                if (strcmp(name, ev->event->name) != 0) {
                        continue;
                }
-               found = 1;
+
+               found = true;
                break;
        }
+
        if (found) {
                DBG("Found event %s for channel %s", name, channel->channel->name);
                return ev;
index f26e6e5b998445a0c973a60dc3eb5eed2f5997f1..1637cf240360da58c3a66f0de0291523631fc78b 100644 (file)
@@ -156,7 +156,7 @@ int cmd_clear(int argc, const char **argv)
        const char *leftover = nullptr;
        struct lttng_session *sessions = nullptr;
        int count;
-       int found;
+       bool found;
 
        pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
@@ -251,10 +251,10 @@ int cmd_clear(int argc, const char **argv)
                }
        } else {
                /* Find the corresponding lttng_session struct */
-               found = 0;
+               found = false;
                for (i = 0; i < count; i++) {
                        if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) {
-                               found = 1;
+                               found = true;
                                command_ret = clear_session(&sessions[i]);
                                if (command_ret) {
                                        ERR("%s", lttng_strerror(command_ret));
index 270cefffcbcc3688e045da692894e863c8accf60..83e23ab757e23a715776fbc42461e990531a3888 100644 (file)
@@ -269,7 +269,7 @@ int cmd_destroy(int argc, const char **argv)
 
        struct lttng_session *sessions = nullptr;
        int count;
-       int found;
+       bool found;
 
        pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
@@ -354,10 +354,10 @@ int cmd_destroy(int argc, const char **argv)
                }
 
                /* Find the corresponding lttng_session struct */
-               found = 0;
+               found = false;
                for (i = 0; i < count; i++) {
                        if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) {
-                               found = 1;
+                               found = true;
                                command_ret = destroy_session(&sessions[i]);
                                if (command_ret) {
                                        success = 0;
index 00af516de0129bef113303e0853738e057b06c5f..57b73a6b0a94198d90fdda62c68afb58ba4c8780 100644 (file)
@@ -50,7 +50,7 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
        const char *arg_cmd_name;
        static poptContext pc;
        const struct cmd_struct *cmd;
-       int found = 0;
+       bool found = false;
        const char *cmd_argv[2];
 
        pc = poptGetContext(nullptr, argc, argv, long_options, 0);
@@ -95,7 +95,7 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
 
        while (cmd->name != nullptr) {
                if (strcmp(cmd->name, arg_cmd_name) == 0) {
-                       found = 1;
+                       found = true;
                        break;
                }
 
This page took 0.028071 seconds and 4 git commands to generate.