Clean-up: replace uses of `int found` as bool by `bool found`
[lttng-tools.git] / src / bin / lttng / commands / clear.cpp
index b3829c499dfd4186aeb5fe62454f5888ddc50a72..1637cf240360da58c3a66f0de0291523631fc78b 100644 (file)
@@ -41,10 +41,10 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "all", 'a', POPT_ARG_VAL, &opt_clear_all, 1, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "all", 'a', POPT_ARG_VAL, &opt_clear_all, 1, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -53,7 +53,7 @@ static struct poptOption long_options[] = {
 static int clear_session(struct lttng_session *session)
 {
        enum lttng_clear_handle_status status = LTTNG_CLEAR_HANDLE_STATUS_OK;
-       struct lttng_clear_handle *handle = NULL;
+       struct lttng_clear_handle *handle = nullptr;
        enum lttng_error_code ret_code;
        bool printed_wait_msg = false;
        int ret;
@@ -151,14 +151,14 @@ int cmd_clear(int argc, const char **argv)
        int opt;
        int ret = CMD_SUCCESS, i, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       char *session_name = NULL;
-       const char *arg_session_name = NULL;
-       const char *leftover = NULL;
-       struct lttng_session *sessions = NULL;
+       char *session_name = nullptr;
+       const char *arg_session_name = nullptr;
+       const char *leftover = nullptr;
+       struct lttng_session *sessions = nullptr;
        int count;
-       int found;
+       bool found;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -213,12 +213,12 @@ int cmd_clear(int argc, const char **argv)
                        session_name = get_session_name();
                } else {
                        session_name = strdup(arg_session_name);
-                       if (session_name == NULL) {
+                       if (session_name == nullptr) {
                                PERROR("Failed to copy session name");
                        }
                }
 
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        command_ret = CMD_ERROR;
                        success = 0;
                        goto mi_closing;
@@ -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));
This page took 0.02546 seconds and 4 git commands to generate.