Clean-up: modernize pretty_xml.cpp
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl-health.cpp
index 016e2a8a4b01c068dea859b3435457d8f90051f2..c490f8993c0c1ca55b31613dbad82d1142bce47b 100644 (file)
@@ -14,6 +14,7 @@
 #include "lttng-ctl-helper.hpp"
 
 #include <common/compat/errno.hpp>
+#include <common/compiler.hpp>
 #include <common/defaults.hpp>
 #include <common/utils.hpp>
 
@@ -48,7 +49,7 @@ struct lttng_health {
        char health_sock_path[PATH_MAX];
        /* For consumer health only */
        enum lttng_health_consumerd consumerd_type;
-       struct lttng_health_thread thread[];
+       struct lttng_health_thread thread[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH];
 };
 
 static const char *get_sessiond_thread_name(health_type_sessiond type)
@@ -201,7 +202,7 @@ static int set_health_socket_path(struct lttng_health *lh, int tracing_group)
         * required size (excluding closing null).
         */
        home = utils_get_home_dir();
-       if (home == NULL) {
+       if (home == nullptr) {
                /* Fallback in /tmp */
                home = "/tmp";
        }
@@ -224,7 +225,7 @@ static struct lttng_health *lttng_health_create(enum health_component hc, unsign
 
        lh = zmalloc<lttng_health>(sizeof(*lh) + sizeof(lh->thread[0]) * nr_threads);
        if (!lh) {
-               return NULL;
+               return nullptr;
        }
 
        lh->component = hc;
@@ -242,7 +243,7 @@ struct lttng_health *lttng_health_create_sessiond(void)
 
        lh = lttng_health_create(HEALTH_COMPONENT_SESSIOND, NR_HEALTH_SESSIOND_TYPES);
        if (!lh) {
-               return NULL;
+               return nullptr;
        }
        return lh;
 }
@@ -253,7 +254,7 @@ struct lttng_health *lttng_health_create_consumerd(enum lttng_health_consumerd c
 
        lh = lttng_health_create(HEALTH_COMPONENT_CONSUMERD, NR_HEALTH_CONSUMERD_TYPES);
        if (!lh) {
-               return NULL;
+               return nullptr;
        }
        lh->consumerd_type = consumerd;
        return lh;
@@ -262,7 +263,7 @@ struct lttng_health *lttng_health_create_consumerd(enum lttng_health_consumerd c
 struct lttng_health *lttng_health_create_relayd(const char *path)
 {
        int ret;
-       struct lttng_health *lh = NULL;
+       struct lttng_health *lh = nullptr;
 
        if (!path) {
                goto error;
@@ -282,7 +283,7 @@ struct lttng_health *lttng_health_create_relayd(const char *path)
 
 error:
        free(lh);
-       return NULL;
+       return nullptr;
 }
 
 void lttng_health_destroy(struct lttng_health *lh)
@@ -381,7 +382,7 @@ const struct lttng_health_thread *lttng_health_get_thread(const struct lttng_hea
                                                          unsigned int nth_thread)
 {
        if (!health || nth_thread >= health->nr_threads) {
-               return NULL;
+               return nullptr;
        }
        return &health->thread[nth_thread];
 }
@@ -399,7 +400,7 @@ const char *lttng_health_thread_name(const struct lttng_health_thread *thread)
        unsigned int nr;
 
        if (!thread) {
-               return NULL;
+               return nullptr;
        }
        nr = thread - &thread->p->thread[0];
        return get_thread_name(thread->p->component, nr);
This page took 0.024385 seconds and 4 git commands to generate.