X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl-health.cpp;h=c490f8993c0c1ca55b31613dbad82d1142bce47b;hb=d0eca33e3e66b6d76fa4b64cfe49295bdb5b9c17;hp=016e2a8a4b01c068dea859b3435457d8f90051f2;hpb=28ab034a2c3582d07d3423d2d746731f87d3969f;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl-health.cpp b/src/lib/lttng-ctl/lttng-ctl-health.cpp index 016e2a8a4..c490f8993 100644 --- a/src/lib/lttng-ctl/lttng-ctl-health.cpp +++ b/src/lib/lttng-ctl/lttng-ctl-health.cpp @@ -14,6 +14,7 @@ #include "lttng-ctl-helper.hpp" #include +#include #include #include @@ -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(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);