clang-tidy: add Chrome-inspired checks
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 13 Jan 2023 22:14:04 +0000 (17:14 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 16 Jan 2023 19:49:24 +0000 (14:49 -0500)
Add the checks used by the Chrome project. Most of these changes
were produced and applied by clang-tidy.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4058dafbdef00e81ac04f202fdfe377384a99e6b

289 files changed:
.clang-tidy
doc/examples/trigger-condition-event-matches/notification-client.cpp
include/lttng/channel-internal.hpp
include/lttng/error-query-internal.hpp
include/lttng/event-field-value-internal.hpp
include/lttng/health-internal.hpp
include/lttng/trigger/trigger-internal.hpp
src/bin/lttng-consumerd/health-consumerd.cpp
src/bin/lttng-consumerd/lttng-consumerd.cpp
src/bin/lttng-crash/lttng-crash.cpp
src/bin/lttng-relayd/backward-compatibility-group-by.cpp
src/bin/lttng-relayd/cmd-2-1.cpp
src/bin/lttng-relayd/cmd-2-11.cpp
src/bin/lttng-relayd/cmd-2-2.cpp
src/bin/lttng-relayd/connection.cpp
src/bin/lttng-relayd/ctf-trace.cpp
src/bin/lttng-relayd/health-relayd.cpp
src/bin/lttng-relayd/index.cpp
src/bin/lttng-relayd/live.cpp
src/bin/lttng-relayd/main.cpp
src/bin/lttng-relayd/session.cpp
src/bin/lttng-relayd/sessiond-trace-chunks.cpp
src/bin/lttng-relayd/stream.cpp
src/bin/lttng-relayd/tcp_keep_alive.cpp
src/bin/lttng-relayd/thread-utils.cpp
src/bin/lttng-relayd/tracefile-array.cpp
src/bin/lttng-relayd/utils.cpp
src/bin/lttng-relayd/viewer-session.cpp
src/bin/lttng-relayd/viewer-stream.cpp
src/bin/lttng-sessiond/action-executor.cpp
src/bin/lttng-sessiond/agent-thread.cpp
src/bin/lttng-sessiond/agent.cpp
src/bin/lttng-sessiond/buffer-registry.cpp
src/bin/lttng-sessiond/channel.cpp
src/bin/lttng-sessiond/clear.cpp
src/bin/lttng-sessiond/client.cpp
src/bin/lttng-sessiond/cmd.cpp
src/bin/lttng-sessiond/condition-internal.cpp
src/bin/lttng-sessiond/consumer.cpp
src/bin/lttng-sessiond/consumer.hpp
src/bin/lttng-sessiond/context.cpp
src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp
src/bin/lttng-sessiond/dispatch.cpp
src/bin/lttng-sessiond/event-notifier-error-accounting.cpp
src/bin/lttng-sessiond/event.cpp
src/bin/lttng-sessiond/fd-limit.cpp
src/bin/lttng-sessiond/field.cpp
src/bin/lttng-sessiond/field.hpp
src/bin/lttng-sessiond/globals.cpp
src/bin/lttng-sessiond/health-sessiond.hpp
src/bin/lttng-sessiond/health.cpp
src/bin/lttng-sessiond/kernel-consumer.cpp
src/bin/lttng-sessiond/kernel.cpp
src/bin/lttng-sessiond/lttng-syscall.cpp
src/bin/lttng-sessiond/main.cpp
src/bin/lttng-sessiond/manage-apps.cpp
src/bin/lttng-sessiond/manage-consumer.cpp
src/bin/lttng-sessiond/manage-kernel.cpp
src/bin/lttng-sessiond/modprobe.cpp
src/bin/lttng-sessiond/notification-thread-commands.cpp
src/bin/lttng-sessiond/notification-thread-events.cpp
src/bin/lttng-sessiond/notification-thread.cpp
src/bin/lttng-sessiond/notify-apps.cpp
src/bin/lttng-sessiond/process-utils.cpp
src/bin/lttng-sessiond/register.cpp
src/bin/lttng-sessiond/rotation-thread.cpp
src/bin/lttng-sessiond/save.cpp
src/bin/lttng-sessiond/session.cpp
src/bin/lttng-sessiond/session.hpp
src/bin/lttng-sessiond/sessiond-config.cpp
src/bin/lttng-sessiond/snapshot.cpp
src/bin/lttng-sessiond/snapshot.hpp
src/bin/lttng-sessiond/thread-utils.cpp
src/bin/lttng-sessiond/thread.cpp
src/bin/lttng-sessiond/thread.hpp
src/bin/lttng-sessiond/timer.cpp
src/bin/lttng-sessiond/trace-kernel.cpp
src/bin/lttng-sessiond/trace-kernel.hpp
src/bin/lttng-sessiond/trace-ust.cpp
src/bin/lttng-sessiond/tracker.cpp
src/bin/lttng-sessiond/tracker.hpp
src/bin/lttng-sessiond/trigger-error-query.cpp
src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp
src/bin/lttng-sessiond/ust-app.cpp
src/bin/lttng-sessiond/ust-app.hpp
src/bin/lttng-sessiond/ust-clock-class.cpp
src/bin/lttng-sessiond/ust-consumer.cpp
src/bin/lttng-sessiond/ust-field-convert.cpp
src/bin/lttng-sessiond/ust-registry-channel.cpp
src/bin/lttng-sessiond/ust-registry-channel.hpp
src/bin/lttng-sessiond/ust-registry-event.hpp
src/bin/lttng-sessiond/ust-registry-session.cpp
src/bin/lttng-sessiond/ust-registry-session.hpp
src/bin/lttng-sessiond/ust-registry.hpp
src/bin/lttng/commands/add_context.cpp
src/bin/lttng/commands/add_trigger.cpp
src/bin/lttng/commands/clear.cpp
src/bin/lttng/commands/create.cpp
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/commands/disable_channels.cpp
src/bin/lttng/commands/disable_events.cpp
src/bin/lttng/commands/disable_rotation.cpp
src/bin/lttng/commands/enable_channels.cpp
src/bin/lttng/commands/enable_events.cpp
src/bin/lttng/commands/enable_rotation.cpp
src/bin/lttng/commands/help.cpp
src/bin/lttng/commands/list.cpp
src/bin/lttng/commands/list_triggers.cpp
src/bin/lttng/commands/load.cpp
src/bin/lttng/commands/metadata.cpp
src/bin/lttng/commands/regenerate.cpp
src/bin/lttng/commands/remove_trigger.cpp
src/bin/lttng/commands/rotate.cpp
src/bin/lttng/commands/save.cpp
src/bin/lttng/commands/set_session.cpp
src/bin/lttng/commands/snapshot.cpp
src/bin/lttng/commands/start.cpp
src/bin/lttng/commands/status.cpp
src/bin/lttng/commands/stop.cpp
src/bin/lttng/commands/track-untrack.cpp
src/bin/lttng/commands/version.cpp
src/bin/lttng/commands/view.cpp
src/bin/lttng/conf.cpp
src/bin/lttng/loglevel.cpp
src/bin/lttng/lttng.cpp
src/bin/lttng/uprobe.cpp
src/bin/lttng/utils.cpp
src/common/actions/action.cpp
src/common/actions/list.cpp
src/common/actions/notify.cpp
src/common/actions/path.cpp
src/common/actions/rate-policy.cpp
src/common/actions/rotate-session.cpp
src/common/actions/snapshot-session.cpp
src/common/actions/start-session.cpp
src/common/actions/stop-session.cpp
src/common/argpar-utils/argpar-utils.cpp
src/common/buffer-view.cpp
src/common/channel.cpp
src/common/compat/directory-handle.cpp
src/common/compat/getenv.hpp
src/common/compat/poll.cpp
src/common/compat/poll.hpp
src/common/compat/tid.hpp
src/common/conditions/buffer-usage.cpp
src/common/conditions/condition.cpp
src/common/conditions/event-rule-matches.cpp
src/common/conditions/session-consumed-size.cpp
src/common/conditions/session-rotation.cpp
src/common/config/session-config.cpp
src/common/consumer/consumer-metadata-cache.cpp
src/common/consumer/consumer-stream.cpp
src/common/consumer/consumer-timer.cpp
src/common/consumer/consumer-timer.hpp
src/common/consumer/consumer.cpp
src/common/consumer/consumer.hpp
src/common/context.cpp
src/common/defaults.cpp
src/common/defaults.hpp
src/common/dynamic-array.cpp
src/common/dynamic-array.hpp
src/common/dynamic-buffer.cpp
src/common/error-query.cpp
src/common/error.cpp
src/common/error.hpp
src/common/event-expr/event-expr.cpp
src/common/event-field-value.cpp
src/common/event-rule/event-rule.cpp
src/common/event-rule/jul-logging.cpp
src/common/event-rule/kernel-kprobe.cpp
src/common/event-rule/kernel-syscall.cpp
src/common/event-rule/kernel-tracepoint.cpp
src/common/event-rule/kernel-uprobe.cpp
src/common/event-rule/log4j-logging.cpp
src/common/event-rule/python-logging.cpp
src/common/event-rule/user-tracepoint.cpp
src/common/event.cpp
src/common/fd-handle.cpp
src/common/fd-tracker/fd-tracker.cpp
src/common/fd-tracker/inode.cpp
src/common/fd-tracker/utils.cpp
src/common/file-descriptor.hpp
src/common/filter.cpp
src/common/format.hpp
src/common/futex.cpp
src/common/hashtable/hashtable.cpp
src/common/health/health.cpp
src/common/index-allocator.cpp
src/common/index/index.cpp
src/common/ini-config/ini-config.cpp
src/common/ini-config/ini.cpp
src/common/kernel-consumer/kernel-consumer.cpp
src/common/kernel-ctl/kernel-ctl.cpp
src/common/kernel-probe.cpp
src/common/location.cpp
src/common/log-level-rule.cpp
src/common/lttng-elf.cpp
src/common/mi-lttng.cpp
src/common/notification.cpp
src/common/path.cpp
src/common/payload-view.cpp
src/common/pipe.cpp
src/common/pthread-lock.hpp
src/common/relayd/relayd.cpp
src/common/runas.cpp
src/common/runas.hpp
src/common/scope-exit.hpp
src/common/session-descriptor.cpp
src/common/sessiond-comm/inet.cpp
src/common/sessiond-comm/inet.hpp
src/common/sessiond-comm/inet6.cpp
src/common/sessiond-comm/sessiond-comm.cpp
src/common/sessiond-comm/sessiond-comm.hpp
src/common/shm.cpp
src/common/snapshot.cpp
src/common/spawn-viewer.cpp
src/common/string-utils/string-utils.cpp
src/common/testpoint/testpoint.cpp
src/common/time.cpp
src/common/time.hpp
src/common/trace-chunk-registry.hpp
src/common/trace-chunk.cpp
src/common/trace-chunk.hpp
src/common/tracker.cpp
src/common/tracker.hpp
src/common/trigger.cpp
src/common/unix.cpp
src/common/uri.cpp
src/common/userspace-probe.cpp
src/common/ust-consumer/ust-consumer.cpp
src/common/utils.cpp
src/common/utils.hpp
src/common/waiter.cpp
src/lib/lttng-ctl/channel.cpp
src/lib/lttng-ctl/clear.cpp
src/lib/lttng-ctl/destruction-handle.cpp
src/lib/lttng-ctl/event.cpp
src/lib/lttng-ctl/load.cpp
src/lib/lttng-ctl/lttng-ctl-health.cpp
src/lib/lttng-ctl/lttng-ctl.cpp
src/lib/lttng-ctl/rotate.cpp
src/lib/lttng-ctl/save.cpp
src/lib/lttng-ctl/snapshot.cpp
src/lib/lttng-ctl/tracker.cpp
tests/regression/kernel/select_poll_epoll.cpp
tests/regression/tools/live/live_test.cpp
tests/regression/tools/notification/consumer_testpoints.cpp
tests/regression/tools/notification/default_pipe_size_getter.cpp
tests/regression/tools/notification/notification.cpp
tests/regression/tools/notification/sessiond_testpoints.cpp
tests/regression/tools/trigger/hidden/hidden_trigger.cpp
tests/regression/tools/trigger/name/trigger_name.cpp
tests/regression/tools/trigger/utils/register-some-triggers.cpp
tests/unit/ini_config/ini_config.cpp
tests/unit/test_action.cpp
tests/unit/test_buffer_view.cpp
tests/unit/test_condition.cpp
tests/unit/test_directory_handle.cpp
tests/unit/test_event_expr_to_bytecode.cpp
tests/unit/test_event_rule.cpp
tests/unit/test_fd_tracker.cpp
tests/unit/test_kernel_data.cpp
tests/unit/test_kernel_probe.cpp
tests/unit/test_log_level_rule.cpp
tests/unit/test_notification.cpp
tests/unit/test_payload.cpp
tests/unit/test_rate_policy.cpp
tests/unit/test_relayd_backward_compat_group_by_session.cpp
tests/unit/test_session.cpp
tests/unit/test_string_utils.cpp
tests/unit/test_unix_socket.cpp
tests/unit/test_uri.cpp
tests/unit/test_ust_data.cpp
tests/unit/test_utils_compat_poll.cpp
tests/unit/test_utils_compat_pthread.cpp
tests/unit/test_utils_expand_path.cpp
tests/unit/test_utils_parse_size_suffix.cpp
tests/unit/test_utils_parse_time_suffix.cpp
tests/unit/test_uuid.cpp
tests/utils/testapp/gen-ns-events/gen-ns-events.cpp
tests/utils/testapp/gen-ust-events-ns/gen-ust-events-ns.cpp
tests/utils/testapp/gen-ust-events/gen-ust-events.cpp
tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.cpp
tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.cpp
tests/utils/testapp/signal-helper.hpp
tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary.cpp
tests/utils/utils.cpp
tests/utils/xml-utils/extract_xml.cpp
tests/utils/xml-utils/validate_xml.cpp

index af914d23bf6f8b46b472cc8dad4abc95dcf57722..f2bcc43978a83a48dd884dd27b9a2965d509f8da 100644 (file)
@@ -1,3 +1,38 @@
 HeaderFilterRegex: '.*((include/.*-internal)|(src/common.*)|(src/bin.*)|(src/lib.*)|(tests.*))\.(h|hpp)$'
-Checks: '-*,modernize-use-using'
+Checks:          '-*,
+                  bugprone-argument-comment,
+                  bugprone-assert-side-effect,
+                  bugprone-dangling-handle,
+                  bugprone-inaccurate-erase,
+                  bugprone-string-constructor,
+                  bugprone-string-integer-assignment,
+                  bugprone-undefined-memory-manipulation,
+                  bugprone-unused-raii,
+                  bugprone-use-after-move,
+                  google-build-explicit-make-pair,
+                  google-explicit-constructor,
+                  modernize-avoid-bind,
+                  modernize-concat-nested-namespaces,
+                  modernize-loop-convert,
+                  modernize-make-shared,
+                  modernize-make-unique,
+                  modernize-redundant-void-arg,
+                  modernize-replace-random-shuffle,
+                  modernize-shrink-to-fit,
+                  modernize-use-bool-literals,
+                  modernize-use-default-member-init,
+                  modernize-use-emplace,
+                  modernize-use-equals-default,
+                  modernize-use-equals-delete,
+                  modernize-use-noexcept,
+                  modernize-use-nullptr,
+                  modernize-use-override,
+                  modernize-use-transparent-functors,
+                  modernize-use-using,
+                  performance-*,
+                  -performance-no-int-to-ptr,
+                  readability-redundant-member-init'
 FormatStyle: 'file'
+CheckOptions:
+  - key:          bugprone-assert-side-effect.AssertMacros
+    value:        assert,LTTNG_ASSERT
\ No newline at end of file
index 91a1d0711a86fdca19657fed6e89306e45cb19b4..05c7387c2417e850f9be61a1517bea50a01a4cb2 100644 (file)
@@ -81,7 +81,7 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
                enum lttng_event_expr_status status;
 
                parent_expr = lttng_event_expr_array_field_element_get_parent_expr(event_expr);
-               LTTNG_ASSERT(parent_expr != NULL);
+               LTTNG_ASSERT(parent_expr != nullptr);
 
                print_one_event_expr(parent_expr);
 
@@ -128,7 +128,7 @@ static int print_capture(const struct lttng_condition *condition,
        uint64_t u_val;
        int64_t s_val;
        double d_val;
-       const char *string_val = NULL;
+       const char *string_val = nullptr;
 
        switch (lttng_event_field_value_get_type(capture)) {
        case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT:
@@ -216,7 +216,7 @@ end:
        return ret;
 }
 
-static void print_unavailabe(void)
+static void print_unavailabe()
 {
        printf("Capture unavailable");
 }
@@ -236,7 +236,7 @@ static int print_array(const struct lttng_condition *condition,
        }
 
        for (unsigned int i = 0; i < captured_field_count; i++) {
-               const struct lttng_event_field_value *captured_field = NULL;
+               const struct lttng_event_field_value *captured_field = nullptr;
                const struct lttng_event_expr *expr =
                        lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
                                condition, i);
@@ -283,7 +283,7 @@ static int print_captures(struct lttng_notification *notification)
        enum lttng_condition_status condition_status;
        enum lttng_evaluation_event_rule_matches_status evaluation_status;
 
-       const struct lttng_event_field_value *captured_field_array = NULL;
+       const struct lttng_event_field_value *captured_field_array = nullptr;
        unsigned int expected_capture_field_count;
 
        LTTNG_ASSERT(lttng_evaluation_get_type(evaluation) ==
@@ -341,9 +341,9 @@ static int print_notification(struct lttng_notification *notification)
                char time_str[64];
                struct timeval tv;
                time_t the_time;
-               const struct lttng_trigger *trigger = NULL;
+               const struct lttng_trigger *trigger = nullptr;
 
-               gettimeofday(&tv, NULL);
+               gettimeofday(&tv, nullptr);
                the_time = tv.tv_sec;
 
                strftime(time_str, sizeof(time_str), "[%m-%d-%Y] %T", localtime(&the_time));
@@ -377,10 +377,10 @@ end:
 int main(int argc, char **argv)
 {
        int ret;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int count, i, j, subcription_count = 0, trigger_count;
        enum lttng_trigger_status trigger_status;
-       struct lttng_notification_channel *notification_channel = NULL;
+       struct lttng_notification_channel *notification_channel = nullptr;
 
        if (argc < 2) {
                fprintf(stderr, "Missing trigger name(s)\n");
@@ -419,7 +419,7 @@ int main(int argc, char **argv)
                const struct lttng_action *action = lttng_trigger_get_const_action(trigger);
                const enum lttng_action_type action_type = lttng_action_get_type(action);
                enum lttng_notification_channel_status channel_status;
-               const char *trigger_name = NULL;
+               const char *trigger_name = nullptr;
                bool subscribe = false;
 
                lttng_trigger_get_name(trigger, &trigger_name);
index d4960828ec2da0844ada398f150ef916d96a3ae0..4a7a53bb43820bc5088349db2ad72463033d24ce 100644 (file)
@@ -40,7 +40,7 @@ struct lttng_channel_comm {
        int64_t blocking_timeout;
 } LTTNG_PACKED;
 
-struct lttng_channel *lttng_channel_create_internal(void);
+struct lttng_channel *lttng_channel_create_internal();
 
 struct lttng_channel *lttng_channel_copy(const struct lttng_channel *src);
 
index 7bf4da7481da438b53d2c1add3ca023287a28754..ece2b0ce9021b63c096be41c4fc51dd417cfffa2 100644 (file)
@@ -67,7 +67,7 @@ lttng_error_query_result_counter_create(
 
 void lttng_error_query_result_destroy(struct lttng_error_query_result *result);
 
-struct lttng_error_query_results *lttng_error_query_results_create(void);
+struct lttng_error_query_results *lttng_error_query_results_create();
 
 /* Ownership of `result` is transferred on success. */
 int lttng_error_query_results_add_result(
index 03ef8960b2d509b9ccd5c85c598195a192ab7ff3..96196db873af0fd6ccb2b866caa5b749641f88d3 100644 (file)
@@ -153,7 +153,7 @@ struct lttng_event_field_value *lttng_event_field_value_string_create(
 struct lttng_event_field_value *lttng_event_field_value_string_create_with_size(
                const char *val, size_t size);
 
-struct lttng_event_field_value *lttng_event_field_value_array_create(void);
+struct lttng_event_field_value *lttng_event_field_value_array_create();
 
 int lttng_event_field_value_enum_append_label(
                struct lttng_event_field_value *field_val, const char *label);
index 67bdc6a5eeec383b9ce7706b62c6a61d36769c9e..b1dc33047db713aec10181496d8edd83c4dbd6fa 100644 (file)
@@ -70,7 +70,7 @@ extern DECLARE_URCU_TLS(struct health_state, health_state);
  * blocking state caused by a poll(). If the counter's value is not an even
  * number (meaning a code execution flow), an LTTNG_ASSERT() is raised.
  */
-static inline void health_poll_entry(void)
+static inline void health_poll_entry()
 {
        /* Code MUST be in code execution state which is an even number. */
        LTTNG_ASSERT(!(uatomic_read(&URCU_TLS(health_state).current)
@@ -84,7 +84,7 @@ static inline void health_poll_entry(void)
  * If the counter's value is not an odd number (a poll execution), an LTTNG_ASSERT()
  * is raised.
  */
-static inline void health_poll_exit(void)
+static inline void health_poll_exit()
 {
        /* Code MUST be in poll execution state which is an odd number. */
        LTTNG_ASSERT(uatomic_read(&URCU_TLS(health_state).current)
@@ -97,7 +97,7 @@ static inline void health_poll_exit(void)
  * Update current counter by 2 indicates progress in execution of a
  * thread.
  */
-static inline void health_code_update(void)
+static inline void health_code_update()
 {
        uatomic_add(&URCU_TLS(health_state).current, HEALTH_CODE_VALUE);
 }
@@ -105,7 +105,7 @@ static inline void health_code_update(void)
 /*
  * Set health "error" flag.
  */
-static inline void health_error(void)
+static inline void health_error()
 {
        uatomic_or(&URCU_TLS(health_state).flags, HEALTH_ERROR);
 }
index a05a36ed3a2b4a5b1b5901a35b5b316be03613bb..30675523e7876a0534d702dfe114161bd9a7c0f6 100644 (file)
@@ -149,7 +149,7 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
  * Allocate a new set of triggers.
  * The returned object must be freed via lttng_triggers_destroy.
  */
-struct lttng_triggers *lttng_triggers_create(void);
+struct lttng_triggers *lttng_triggers_create();
 
 /*
  * Return the a pointer to a mutable element at index "index" of an
index fc4988d682e149f2ad5d774f2b683ff0627885a2..d0a6ce14fd451e35cc3036533dc8fcb59bc71352 100644 (file)
@@ -60,7 +60,7 @@ static int send_unix_sock(int sock, void *buf, size_t len)
        return lttcomm_send_unix_sock(sock, buf, len);
 }
 
-static int setup_health_path(void)
+static int setup_health_path()
 {
        int is_root, ret = 0;
        enum lttng_consumer_type type;
@@ -95,7 +95,7 @@ static int setup_health_path(void)
                }
        } else {
                home_path = utils_get_home_dir();
-               if (home_path == NULL) {
+               if (home_path == nullptr) {
                        /* TODO: Add --socket PATH option */
                        ERR("Can't get HOME directory for sockets creation.");
                        ret = -EPERM;
@@ -224,7 +224,7 @@ void *thread_manage_health_consumerd(void *data __attribute__((unused)))
        cmm_smp_mb__before_uatomic_dec();
        uatomic_dec(&lttng_consumer_ready);
 
-       while (1) {
+       while (true) {
                DBG("Health check ready");
 
                /* Inifinite blocking call, waiting for transmission */
@@ -334,5 +334,5 @@ error:
        lttng_poll_clean(&events);
 
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
index 407545d8aa1ddc8821ea35155ba07ae96424fa90..e46b6b6716ccddecea67ff43e0295ca364287d9f 100644 (file)
@@ -115,7 +115,7 @@ static void sighandler(int sig, siginfo_t *siginfo, void *arg __attribute__((unu
  * Setup signal handler for :
  *      SIGINT, SIGTERM, SIGPIPE, SIGBUS
  */
-static int set_signal_handler(void)
+static int set_signal_handler()
 {
        int ret = 0;
        struct sigaction sa;
@@ -130,24 +130,24 @@ static int set_signal_handler(void)
        sa.sa_flags = SA_SIGINFO;
 
        sa.sa_sigaction = sighandler;
-       if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGTERM, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
-       if ((ret = sigaction(SIGINT, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGINT, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
-       if ((ret = sigaction(SIGBUS, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGBUS, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
        sa.sa_flags = 0;
        sa.sa_handler = SIG_IGN;
-       if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGPIPE, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
@@ -206,21 +206,21 @@ static int parse_args(int argc, char **argv)
 {
        int c, ret = 0;
 
-       static struct option long_options[] = { { "consumerd-cmd-sock", 1, 0, 'c' },
-                                               { "consumerd-err-sock", 1, 0, 'e' },
-                                               { "daemonize", 0, 0, 'd' },
-                                               { "group", 1, 0, 'g' },
-                                               { "help", 0, 0, 'h' },
-                                               { "quiet", 0, 0, 'q' },
-                                               { "verbose", 0, 0, 'v' },
-                                               { "version", 0, 0, 'V' },
-                                               { "kernel", 0, 0, 'k' },
+       static struct option long_options[] = { { "consumerd-cmd-sock", 1, nullptr, 'c' },
+                                               { "consumerd-err-sock", 1, nullptr, 'e' },
+                                               { "daemonize", 0, nullptr, 'd' },
+                                               { "group", 1, nullptr, 'g' },
+                                               { "help", 0, nullptr, 'h' },
+                                               { "quiet", 0, nullptr, 'q' },
+                                               { "verbose", 0, nullptr, 'v' },
+                                               { "version", 0, nullptr, 'V' },
+                                               { "kernel", 0, nullptr, 'k' },
 #ifdef HAVE_LIBLTTNG_UST_CTL
-                                               { "ust", 0, 0, 'u' },
+                                               { "ust", 0, nullptr, 'u' },
 #endif
-                                               { NULL, 0, 0, 0 } };
+                                               { nullptr, 0, nullptr, 0 } };
 
-       while (1) {
+       while (true) {
                int option_index = 0;
                c = getopt_long(argc,
                                argv,
@@ -308,7 +308,7 @@ end:
  * Set open files limit to unlimited. This daemon can open a large number of
  * file descriptors in order to consumer multiple kernel traces.
  */
-static void set_ulimit(void)
+static void set_ulimit()
 {
        int ret;
        struct rlimit lim;
@@ -334,7 +334,7 @@ int main(int argc, char **argv)
 
        rcu_register_thread();
 
-       if (run_as_create_worker(argv[0], NULL, NULL) < 0) {
+       if (run_as_create_worker(argv[0], nullptr, nullptr) < 0) {
                goto exit_set_signal_handler;
        }
 
@@ -442,8 +442,11 @@ int main(int argc, char **argv)
        }
 
        /* create the consumer instance with and assign the callbacks */
-       the_consumer_context = lttng_consumer_create(
-               opt_type, lttng_consumer_read_subbuffer, NULL, lttng_consumer_on_recv_stream, NULL);
+       the_consumer_context = lttng_consumer_create(opt_type,
+                                                    lttng_consumer_read_subbuffer,
+                                                    nullptr,
+                                                    lttng_consumer_on_recv_stream,
+                                                    nullptr);
        if (!the_consumer_context) {
                retval = -1;
                goto exit_init_data;
@@ -521,7 +524,7 @@ int main(int argc, char **argv)
        ret = pthread_create(&health_thread,
                             default_pthread_attr(),
                             thread_manage_health_consumerd,
-                            (void *) NULL);
+                            (void *) nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create health");
@@ -542,8 +545,10 @@ int main(int argc, char **argv)
         * Create the thread to manage the UST metadata periodic timer and
         * live timer.
         */
-       ret = pthread_create(
-               &metadata_timer_thread, NULL, consumer_timer_thread, (void *) the_consumer_context);
+       ret = pthread_create(&metadata_timer_thread,
+                            nullptr,
+                            consumer_timer_thread,
+                            (void *) the_consumer_context);
        if (ret) {
                errno = ret;
                PERROR("pthread_create");
@@ -687,7 +692,7 @@ exit_init_data:
                metadata_timer_thread_online = false;
        }
        tmp_ctx = the_consumer_context;
-       the_consumer_context = NULL;
+       the_consumer_context = nullptr;
        cmm_barrier(); /* Clear ctx for signal handler. */
        lttng_consumer_destroy(tmp_ctx);
 
index 8b1e41be4409f9c8892ba179d9ccac75e65d4546..bd548236317bb09927b7634bdf28ca7cc0beb537 100644 (file)
@@ -53,7 +53,7 @@ static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-crash.1.h>
 #else
-       NULL
+       nullptr
 #endif
        ;
 
@@ -176,8 +176,8 @@ struct lttng_crash_layout {
 
 /* Variables */
 static const char *progname;
-static char *opt_viewer_path = NULL;
-static char *opt_output_path = NULL;
+static char *opt_viewer_path = nullptr;
+static char *opt_output_path = nullptr;
 
 static char *the_input_path;
 
@@ -189,13 +189,13 @@ enum {
 
 /* Getopt options. No first level command. */
 static struct option long_options[] = {
-       { "version", 0, NULL, 'V' }, { "help", 0, NULL, 'h' },
-       { "verbose", 0, NULL, 'v' }, { "viewer", 1, NULL, 'e' },
-       { "extract", 1, NULL, 'x' }, { "list-options", 0, NULL, OPT_DUMP_OPTIONS },
-       { NULL, 0, NULL, 0 },
+       { "version", 0, nullptr, 'V' }, { "help", 0, nullptr, 'h' },
+       { "verbose", 0, nullptr, 'v' }, { "viewer", 1, nullptr, 'e' },
+       { "extract", 1, nullptr, 'x' }, { "list-options", 0, nullptr, OPT_DUMP_OPTIONS },
+       { nullptr, 0, nullptr, 0 },
 };
 
-static void usage(void)
+static void usage()
 {
        int ret = utils_show_help(1, "lttng-crash", help_msg);
 
@@ -224,10 +224,10 @@ static void version(FILE *ofp)
 static void list_options(FILE *ofp)
 {
        int i = 0;
-       struct option *option = NULL;
+       struct option *option = nullptr;
 
        option = &long_options[i];
-       while (option->name != NULL) {
+       while (option->name != nullptr) {
                fprintf(ofp, "--%s\n", option->name);
 
                if (isprint(option->val)) {
@@ -253,7 +253,7 @@ static int parse_args(int argc, char **argv)
                exit(EXIT_FAILURE);
        }
 
-       while ((opt = getopt_long(argc, argv, "+Vhve:x:", long_options, NULL)) != -1) {
+       while ((opt = getopt_long(argc, argv, "+Vhve:x:", long_options, nullptr)) != -1) {
                switch (opt) {
                case 'V':
                        version(stdout);
@@ -505,7 +505,7 @@ static int get_crash_layout(struct lttng_crash_layout *layout, int fd, const cha
                    RB_CRASH_DUMP_ABI_LEN);
                return -1;
        }
-       map = (char *) mmap(NULL, RB_CRASH_DUMP_ABI_LEN, PROT_READ, MAP_PRIVATE, fd, 0);
+       map = (char *) mmap(nullptr, RB_CRASH_DUMP_ABI_LEN, PROT_READ, MAP_PRIVATE, fd, 0);
        if (map == MAP_FAILED) {
                PERROR("Mapping file");
                return -1;
@@ -1178,7 +1178,7 @@ int main(int argc, char *argv[])
 {
        int ret;
        bool has_warning = false;
-       const char *output_path = NULL;
+       const char *output_path = nullptr;
        char tmppath[] = "/tmp/lttng-crash-XXXXXX";
 
        progname = argv[0] ? argv[0] : "lttng-crash";
index c56742720066b74c86d8277d3e3eb973bfce6295..a14a33accd86691a4f33f9924034677b97e38d88 100644 (file)
@@ -33,10 +33,10 @@ char *backward_compat_group_by_session(const char *path,
        int ret;
        size_t len;
        char *leftover_ptr;
-       char *local_copy = NULL;
-       char *datetime = NULL;
-       char *partial_base_path = NULL;
-       char *filepath_per_session = NULL;
+       char *local_copy = nullptr;
+       char *datetime = nullptr;
+       char *partial_base_path = nullptr;
+       char *filepath_per_session = nullptr;
        const char *second_token_ptr;
        const char *leftover_second_token_ptr;
        const char *hostname_ptr;
@@ -78,7 +78,7 @@ char *backward_compat_group_by_session(const char *path,
                goto error;
        }
 
-       second_token_ptr = strtok_r(NULL, "/", &leftover_ptr);
+       second_token_ptr = strtok_r(nullptr, "/", &leftover_ptr);
        if (!second_token_ptr) {
                ERR("Failed to parse session path \"%s\": couldn't identify session name", path);
                goto error;
@@ -155,7 +155,7 @@ char *backward_compat_group_by_session(const char *path,
                 * session_name. If this is a auto session name, we need to
                 * fetch the creation datetime.
                 */
-               ret = regexec(&regex, local_session_name, 0, NULL, 0);
+               ret = regexec(&regex, local_session_name, 0, nullptr, 0);
                if (ret == 0) {
                        const ssize_t local_session_name_offset =
                                strlen(local_session_name) - DATETIME_STR_LEN + 1;
@@ -181,7 +181,7 @@ char *backward_compat_group_by_session(const char *path,
                        }
                }
        } else if (len == DATETIME_STR_LEN &&
-                  !regexec(&regex, leftover_second_token_ptr, 0, NULL, 0)) {
+                  !regexec(&regex, leftover_second_token_ptr, 0, nullptr, 0)) {
                /*
                 * The leftover from the second token is of format
                 * "-<datetime>", use it as the creation time.
@@ -200,8 +200,8 @@ char *backward_compat_group_by_session(const char *path,
                 * "name-<datetime>" format. Using the datetime from such a
                 * session would be invalid.
                 * */
-               LTTNG_ASSERT(partial_base_path == NULL);
-               LTTNG_ASSERT(datetime == NULL);
+               LTTNG_ASSERT(partial_base_path == nullptr);
+               LTTNG_ASSERT(datetime == nullptr);
 
                partial_base_path = strdup(second_token_ptr);
                if (!partial_base_path) {
@@ -220,7 +220,7 @@ char *backward_compat_group_by_session(const char *path,
                       partial_base_path ? "/" : "",
                       leftover_ptr);
        if (ret < 0) {
-               filepath_per_session = NULL;
+               filepath_per_session = nullptr;
                goto error;
        }
 error_regex:
index 8894c4863c0b2feef898a823b6e62a427aa79193..27a800c7d50ad50671b833b5337abef2bfc55a50 100644 (file)
@@ -27,8 +27,8 @@ int cmd_recv_stream_2_1(const struct lttng_buffer_view *payload,
 {
        int ret;
        struct lttcomm_relayd_add_stream stream_info;
-       char *path_name = NULL;
-       char *channel_name = NULL;
+       char *path_name = nullptr;
+       char *channel_name = nullptr;
        size_t len;
 
        if (payload->size < sizeof(stream_info)) {
index 8b6a99723ef81ecf9add19e64e5901a55c9486c9..cc004555fe2b0c92c25b8149430730ea4b9219e8 100644 (file)
@@ -181,8 +181,8 @@ int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
        size_t header_len, received_names_size;
        struct lttng_buffer_view channel_name_view;
        struct lttng_buffer_view pathname_view;
-       char *path_name = NULL;
-       char *channel_name = NULL;
+       char *path_name = nullptr;
+       char *channel_name = nullptr;
 
        header_len = sizeof(header);
 
@@ -271,8 +271,8 @@ int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
        *ret_path_name = path_name;
        *ret_channel_name = channel_name;
        /* Move ownership to caller */
-       path_name = NULL;
-       channel_name = NULL;
+       path_name = nullptr;
+       channel_name = nullptr;
        ret = 0;
 error:
        free(channel_name);
index 9b82b0f25073844c8b0d7bc8b742687bbeb31113..dcdd1bac14cb9f14057fb0fb8a8119cad6fa439b 100644 (file)
@@ -31,8 +31,8 @@ int cmd_recv_stream_2_2(const struct lttng_buffer_view *payload,
 {
        int ret;
        struct lttcomm_relayd_add_stream_2_2 stream_info;
-       char *path_name = NULL;
-       char *channel_name = NULL;
+       char *path_name = nullptr;
+       char *channel_name = nullptr;
        size_t len;
 
        if (payload->size < sizeof(stream_info)) {
index f8b364272e0374b0f43773de7903275d51d13cc2..139f2e4dc5cbef3f59f0d1425a6095df0b899bf5 100644 (file)
@@ -25,7 +25,7 @@ struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connectio
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
-       struct relay_connection *conn = NULL;
+       struct relay_connection *conn = nullptr;
 
        LTTNG_ASSERT(sock >= 0);
 
@@ -38,7 +38,7 @@ struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connectio
        }
        conn = lttng::utils::container_of(node, &relay_connection::sock_n);
        if (!connection_get(conn)) {
-               conn = NULL;
+               conn = nullptr;
        }
 end:
        rcu_read_unlock();
@@ -110,7 +110,7 @@ static void rcu_free_connection(struct rcu_head *head)
        lttcomm_destroy_sock(conn->sock);
        if (conn->viewer_session) {
                viewer_session_destroy(conn->viewer_session);
-               conn->viewer_session = NULL;
+               conn->viewer_session = nullptr;
        }
        if (conn->type == RELAY_CONTROL) {
                lttng_dynamic_buffer_reset(&conn->protocol.ctrl.reception_buffer);
@@ -140,7 +140,7 @@ static void connection_release(struct urcu_ref *ref)
                if (session_close(conn->session)) {
                        ERR("session_close");
                }
-               conn->session = NULL;
+               conn->session = nullptr;
        }
        if (conn->viewer_session) {
                viewer_session_close(conn->viewer_session);
@@ -159,7 +159,7 @@ void connection_ht_add(struct lttng_ht *relay_connections_ht, struct relay_conne
 {
        LTTNG_ASSERT(!conn->in_socket_ht);
        lttng_ht_add_unique_ulong(relay_connections_ht, &conn->sock_n);
-       conn->in_socket_ht = 1;
+       conn->in_socket_ht = true;
        conn->socket_ht = relay_connections_ht;
 }
 
index 9e8693333ebda098f02a8943c71016c2b8b2f9a2..826f0e9e48b304ca2a608a37ef7c5542edde8a70 100644 (file)
@@ -44,9 +44,9 @@ static void ctf_trace_destroy(struct ctf_trace *trace)
        ASSERT_RCU_READ_LOCKED();
 
        session_put(trace->session);
-       trace->session = NULL;
+       trace->session = nullptr;
        free(trace->path);
-       trace->path = NULL;
+       trace->path = nullptr;
        call_rcu(&trace->rcu_node, rcu_destroy_ctf_trace);
 }
 
@@ -120,8 +120,8 @@ static struct ctf_trace *ctf_trace_create(struct relay_session *session, const c
 
        lttng_ht_node_init_str(&trace->node, trace->path);
        trace->session = session;
-       pthread_mutex_init(&trace->lock, NULL);
-       pthread_mutex_init(&trace->stream_list_lock, NULL);
+       pthread_mutex_init(&trace->lock, nullptr);
+       pthread_mutex_init(&trace->stream_list_lock, nullptr);
        lttng_ht_add_str(session->ctf_traces_ht, &trace->node);
 
        DBG("Created ctf_trace %" PRIu64 " of session \"%s\" from host \"%s\" with path: %s",
@@ -134,7 +134,7 @@ end:
        return trace;
 error:
        ctf_trace_put(trace);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -147,7 +147,7 @@ struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session,
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
-       struct ctf_trace *trace = NULL;
+       struct ctf_trace *trace = nullptr;
 
        rcu_read_lock();
        lttng_ht_lookup(session->ctf_traces_ht, subpath, &iter);
@@ -158,7 +158,7 @@ struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session,
        }
        trace = lttng::utils::container_of(node, &ctf_trace::node);
        if (!ctf_trace_get(trace)) {
-               trace = NULL;
+               trace = nullptr;
        }
 end:
        rcu_read_unlock();
@@ -207,7 +207,7 @@ struct relay_viewer_stream *ctf_trace_get_viewer_metadata_stream(struct ctf_trac
                goto end;
        }
        if (!viewer_stream_get(vstream)) {
-               vstream = NULL;
+               vstream = nullptr;
        }
 end:
        rcu_read_unlock();
index a8f2899ea742ac7628cf645334c06a3f95268b4c..d1b619d3972d9f0a21d30adb2cd164a990fe4c6c 100644 (file)
@@ -111,7 +111,7 @@ error:
        return ret;
 }
 
-static int parse_health_env(void)
+static int parse_health_env()
 {
        const char *health_path;
 
@@ -124,11 +124,11 @@ static int parse_health_env(void)
        return 0;
 }
 
-static int setup_health_path(void)
+static int setup_health_path()
 {
        int is_root, ret = 0;
-       const char *home_path = NULL;
-       char *rundir = NULL, *relayd_path = NULL;
+       const char *home_path = nullptr;
+       char *rundir = nullptr, *relayd_path = nullptr;
 
        ret = parse_health_env();
        if (ret) {
@@ -150,7 +150,7 @@ static int setup_health_path(void)
                 */
                home_path = utils_get_home_dir();
 
-               if (home_path == NULL) {
+               if (home_path == nullptr) {
                        /* TODO: Add --socket PATH option */
                        ERR("Can't get HOME directory for sockets creation.");
                        ret = -EPERM;
@@ -341,7 +341,7 @@ void *thread_manage_health_relayd(void *data __attribute__((unused)))
 
        lttng_relay_notify_ready();
 
-       while (1) {
+       while (true) {
                char *accepted_socket_name;
 
                DBG("Health check ready");
@@ -419,7 +419,7 @@ void *thread_manage_health_relayd(void *data __attribute__((unused)))
                if (ret <= 0) {
                        DBG("Nothing recv() from client... continuing");
                        ret = fd_tracker_close_unsuspendable_fd(
-                               the_fd_tracker, &new_sock, 1, fd_tracker_util_close_fd, NULL);
+                               the_fd_tracker, &new_sock, 1, fd_tracker_util_close_fd, nullptr);
                        if (ret) {
                                PERROR("close");
                        }
@@ -451,7 +451,7 @@ void *thread_manage_health_relayd(void *data __attribute__((unused)))
 
                /* End of transmission */
                ret = fd_tracker_close_unsuspendable_fd(
-                       the_fd_tracker, &new_sock, 1, fd_tracker_util_close_fd, NULL);
+                       the_fd_tracker, &new_sock, 1, fd_tracker_util_close_fd, nullptr);
                if (ret) {
                        PERROR("close");
                }
@@ -468,7 +468,7 @@ exit:
        unlink(health_unix_sock_path);
        if (sock >= 0) {
                ret = fd_tracker_close_unsuspendable_fd(
-                       the_fd_tracker, &sock, 1, fd_tracker_util_close_fd, NULL);
+                       the_fd_tracker, &sock, 1, fd_tracker_util_close_fd, nullptr);
                if (ret) {
                        PERROR("close");
                }
@@ -482,5 +482,5 @@ exit:
        (void) fd_tracker_util_poll_clean(the_fd_tracker, &events);
 
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
index 426a34b2470e3b7acf0053bbba60fd58edc9b751..94e2d557a8d54aa8305e683893e2e7dea4873d89 100644 (file)
@@ -42,13 +42,13 @@ static struct relay_index *relay_index_create(struct relay_stream *stream, uint6
        if (!stream_get(stream)) {
                ERR("Cannot get stream");
                free(index);
-               index = NULL;
+               index = nullptr;
                goto end;
        }
        index->stream = stream;
 
        lttng_ht_node_init_u64(&index->index_n, net_seq_num);
-       pthread_mutex_init(&index->lock, NULL);
+       pthread_mutex_init(&index->lock, nullptr);
        urcu_ref_init(&index->ref);
 
 end:
@@ -81,7 +81,7 @@ static struct relay_index *relay_index_add_unique(struct relay_stream *stream,
        if (node_ptr != &index->index_n.node) {
                _index = caa_container_of(node_ptr, struct relay_index, index_n.node);
        } else {
-               _index = NULL;
+               _index = nullptr;
        }
        return _index;
 }
@@ -113,7 +113,7 @@ struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream,
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
-       struct relay_index *index = NULL;
+       struct relay_index *index = nullptr;
 
        DBG3("Finding index for stream id %" PRIu64 " and seq_num %" PRIu64,
             stream->stream_handle,
@@ -140,7 +140,7 @@ struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream,
                        relay_index_put(index);
                        index = oldindex;
                        if (!relay_index_get(index)) {
-                               index = NULL;
+                               index = nullptr;
                        }
                } else {
                        stream->indexes_in_flight++;
@@ -219,7 +219,7 @@ static void index_release(struct urcu_ref *ref)
 
        if (index->index_file) {
                lttng_index_file_put(index->index_file);
-               index->index_file = NULL;
+               index->index_file = nullptr;
        }
        if (index->in_hash_table) {
                /* Delete index from hash table. */
@@ -230,7 +230,7 @@ static void index_release(struct urcu_ref *ref)
        }
 
        stream_put(index->stream);
-       index->stream = NULL;
+       index->stream = nullptr;
 
        call_rcu(&index->rcu_node, index_destroy_rcu);
 }
index 869c88d98b645d26783408efca8fff0cc07ae53a..f862709ac7838840c33f554edec59e415602e391 100644 (file)
@@ -176,7 +176,7 @@ lttng_viewer_get_packet_return_code_str(enum lttng_viewer_get_packet_return_code
 /*
  * Cleanup the daemon
  */
-static void cleanup_relayd_live(void)
+static void cleanup_relayd_live()
 {
        DBG("Cleaning up");
 
@@ -318,7 +318,7 @@ send_viewer_streams(struct lttcomm_sock *sock, uint64_t session_id, unsigned int
                }
 
                DBG("Sending stream %" PRIu64 " to viewer", vstream->stream->stream_handle);
-               vstream->sent_flag = 1;
+               vstream->sent_flag = true;
                pthread_mutex_unlock(&vstream->stream->lock);
 
                ret = send_response(sock, &send_stream, sizeof(send_stream));
@@ -357,7 +357,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
        int ret;
        struct lttng_ht_iter iter;
        struct ctf_trace *ctf_trace;
-       struct relay_stream *relay_stream = NULL;
+       struct relay_stream *relay_stream = nullptr;
 
        LTTNG_ASSERT(relay_session);
        ASSERT_LOCKED(relay_session->lock);
@@ -399,7 +399,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
                        }
                }
 
-               relay_stream = NULL;
+               relay_stream = nullptr;
 
                /*
                 * If there is no metadata stream in this trace at the moment
@@ -428,7 +428,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
                        }
                        viewer_stream = viewer_stream_get_by_id(relay_stream->stream_handle);
                        if (!viewer_stream) {
-                               struct lttng_trace_chunk *viewer_stream_trace_chunk = NULL;
+                               struct lttng_trace_chunk *viewer_stream_trace_chunk = nullptr;
 
                                /*
                                 * Save that we sent the metadata stream to the
@@ -500,7 +500,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
                                viewer_stream = viewer_stream_create(
                                        relay_stream, viewer_stream_trace_chunk, seek_t);
                                lttng_trace_chunk_put(viewer_stream_trace_chunk);
-                               viewer_stream_trace_chunk = NULL;
+                               viewer_stream_trace_chunk = nullptr;
                                if (!viewer_stream) {
                                        ret = -1;
                                        ctf_trace_put(ctf_trace);
@@ -547,7 +547,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
                        pthread_mutex_unlock(&relay_stream->lock);
                        stream_put(relay_stream);
                }
-               relay_stream = NULL;
+               relay_stream = nullptr;
                ctf_trace_put(ctf_trace);
        }
 
@@ -564,7 +564,7 @@ error_unlock:
        return ret;
 }
 
-int relayd_live_stop(void)
+int relayd_live_stop()
 {
        /* Stop dispatch thread */
        CMM_STORE_SHARED(live_dispatch_thread_exit, 1);
@@ -614,8 +614,8 @@ end:
 static struct lttcomm_sock *accept_live_sock(struct lttcomm_sock *listening_sock, const char *name)
 {
        int out_fd, ret;
-       struct lttcomm_sock *socks[2] = { listening_sock, NULL };
-       struct lttcomm_sock *new_sock = NULL;
+       struct lttcomm_sock *socks[2] = { listening_sock, nullptr };
+       struct lttcomm_sock *new_sock = nullptr;
 
        ret = fd_tracker_open_unsuspendable_fd(
                the_fd_tracker, &out_fd, (const char **) &name, 1, accept_sock, &socks);
@@ -634,12 +634,12 @@ end:
 static struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
 {
        int ret, sock_fd;
-       struct lttcomm_sock *sock = NULL;
+       struct lttcomm_sock *sock = nullptr;
        char uri_str[LTTNG_PATH_MAX];
-       char *formated_name = NULL;
+       char *formated_name = nullptr;
 
        sock = lttcomm_alloc_sock_from_uri(uri);
-       if (sock == NULL) {
+       if (sock == nullptr) {
                ERR("Allocating socket");
                goto error;
        }
@@ -653,14 +653,14 @@ static struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
        if (ret >= 0) {
                ret = asprintf(&formated_name, "%s socket @ %s", name, uri_str);
                if (ret < 0) {
-                       formated_name = NULL;
+                       formated_name = nullptr;
                }
        }
 
        ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker,
                                               &sock_fd,
                                               (const char **) (formated_name ? &formated_name :
-                                                                               NULL),
+                                                                               nullptr),
                                               1,
                                               create_sock,
                                               sock);
@@ -689,7 +689,7 @@ error:
                lttcomm_destroy_sock(sock);
        }
        free(formated_name);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -732,7 +732,7 @@ static void *thread_listener(void *data __attribute__((unused)))
                goto error_testpoint;
        }
 
-       while (1) {
+       while (true) {
                health_code_update();
 
                DBG("Listener accepting live viewers connections");
@@ -799,7 +799,7 @@ static void *thread_listener(void *data __attribute__((unused)))
                                        goto error;
                                }
                                /* Ownership assumed by the connection. */
-                               newsock = NULL;
+                               newsock = nullptr;
 
                                /* Enqueue request for the dispatcher thread. */
                                cds_wfcq_head_ptr_t head;
@@ -850,7 +850,7 @@ error_sock_control:
        if (lttng_relay_stop_threads()) {
                ERR("Error stopping threads");
        }
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -861,7 +861,7 @@ static void *thread_dispatcher(void *data __attribute__((unused)))
        int err = -1;
        ssize_t ret;
        struct cds_wfcq_node *node;
-       struct relay_connection *conn = NULL;
+       struct relay_connection *conn = nullptr;
 
        DBG("[thread] Live viewer relay dispatcher started");
 
@@ -889,7 +889,7 @@ static void *thread_dispatcher(void *data __attribute__((unused)))
                        /* Dequeue commands */
                        node = cds_wfcq_dequeue_blocking(&viewer_conn_queue.head,
                                                         &viewer_conn_queue.tail);
-                       if (node == NULL) {
+                       if (node == nullptr) {
                                DBG("Woken up but nothing in the live-viewer "
                                    "relay command queue");
                                /* Continue thread execution */
@@ -910,7 +910,7 @@ static void *thread_dispatcher(void *data __attribute__((unused)))
                                connection_put(conn);
                                goto error;
                        }
-               } while (node != NULL);
+               } while (node != nullptr);
 
                /* Futex wait on queue. Blocking call on futex() */
                health_poll_entry();
@@ -932,7 +932,7 @@ error_testpoint:
        if (lttng_relay_stop_threads()) {
                ERR("Error stopping threads");
        }
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -945,7 +945,7 @@ static int viewer_connect(struct relay_connection *conn)
        int ret;
        struct lttng_viewer_connect reply, msg;
 
-       conn->version_check_done = 1;
+       conn->version_check_done = true;
 
        health_code_update();
 
@@ -1031,7 +1031,7 @@ static int viewer_list_sessions(struct relay_connection *conn)
        struct lttng_viewer_list_sessions session_list;
        struct lttng_ht_iter iter;
        struct relay_session *session;
-       struct lttng_viewer_session *send_session_buf = NULL;
+       struct lttng_viewer_session *send_session_buf = nullptr;
        uint32_t buf_count = SESSION_BUF_DEFAULT_COUNT;
        uint32_t count = 0;
 
@@ -1131,7 +1131,7 @@ static int viewer_get_new_streams(struct relay_connection *conn)
        uint32_t nb_created = 0, nb_unsent = 0, nb_streams = 0, nb_total = 0;
        struct lttng_viewer_new_streams_request request;
        struct lttng_viewer_new_streams_response response;
-       struct relay_session *session = NULL;
+       struct relay_session *session = nullptr;
        uint64_t session_id;
        bool closed = false;
 
@@ -1263,7 +1263,7 @@ static int viewer_attach_session(struct relay_connection *conn)
        enum lttng_viewer_seek seek_type;
        struct lttng_viewer_attach_session_request request;
        struct lttng_viewer_attach_session_response response;
-       struct relay_session *session = NULL;
+       struct relay_session *session = nullptr;
        enum lttng_viewer_attach_return_code viewer_attach_status;
        bool closed = false;
        uint64_t session_id;
@@ -1346,13 +1346,13 @@ static int viewer_attach_session(struct relay_connection *conn)
        }
 
        ret = make_viewer_streams(
-               session, conn->viewer_session, seek_type, &nb_streams, NULL, NULL, &closed);
+               session, conn->viewer_session, seek_type, &nb_streams, nullptr, nullptr, &closed);
        if (ret < 0) {
                goto end_put_session;
        }
        pthread_mutex_unlock(&session->lock);
        session_put(session);
-       session = NULL;
+       session = nullptr;
 
        response.streams_count = htobe32(nb_streams);
        /*
@@ -1633,10 +1633,10 @@ static int viewer_get_next_index(struct relay_connection *conn)
        struct lttng_viewer_get_next_index request_index;
        struct lttng_viewer_index viewer_index;
        struct ctf_packet_index packet_index;
-       struct relay_viewer_stream *vstream = NULL;
-       struct relay_stream *rstream = NULL;
-       struct ctf_trace *ctf_trace = NULL;
-       struct relay_viewer_stream *metadata_viewer_stream = NULL;
+       struct relay_viewer_stream *vstream = nullptr;
+       struct relay_stream *rstream = nullptr;
+       struct ctf_trace *ctf_trace = nullptr;
+       struct relay_viewer_stream *metadata_viewer_stream = nullptr;
        bool viewer_stream_and_session_in_same_chunk, viewer_stream_one_rotation_behind;
        uint64_t stream_file_chunk_id = -1ULL, viewer_session_chunk_id = -1ULL;
        enum lttng_trace_chunk_status status;
@@ -1847,7 +1847,7 @@ static int viewer_get_next_index(struct relay_connection *conn)
                                             rstream->channel_name,
                                             rstream->tracefile_size,
                                             vstream->current_tracefile_id,
-                                            NULL,
+                                            nullptr,
                                             file_path,
                                             sizeof(file_path));
                if (ret < 0) {
@@ -1984,10 +1984,10 @@ static int viewer_get_packet(struct relay_connection *conn)
 {
        int ret;
        off_t lseek_ret;
-       char *reply = NULL;
+       char *reply = nullptr;
        struct lttng_viewer_get_packet get_packet_info;
        struct lttng_viewer_trace_packet reply_header;
-       struct relay_viewer_stream *vstream = NULL;
+       struct relay_viewer_stream *vstream = nullptr;
        uint32_t reply_size = sizeof(reply_header);
        uint32_t packet_data_len = 0;
        ssize_t read_len;
@@ -2103,10 +2103,10 @@ static int viewer_get_metadata(struct relay_connection *conn)
        int fd = -1;
        ssize_t read_len;
        uint64_t len = 0;
-       char *data = NULL;
+       char *data = nullptr;
        struct lttng_viewer_get_metadata request;
        struct lttng_viewer_metadata_packet reply;
-       struct relay_viewer_stream *vstream = NULL;
+       struct relay_viewer_stream *vstream = nullptr;
 
        LTTNG_ASSERT(conn);
 
@@ -2223,7 +2223,7 @@ static int viewer_get_metadata(struct relay_connection *conn)
                                             rstream->channel_name,
                                             rstream->tracefile_size,
                                             vstream->current_tracefile_id,
-                                            NULL,
+                                            nullptr,
                                             file_path,
                                             sizeof(file_path));
                if (ret < 0) {
@@ -2407,7 +2407,7 @@ static int viewer_detach_session(struct relay_connection *conn)
        int ret;
        struct lttng_viewer_detach_session_response response;
        struct lttng_viewer_detach_session_request request;
-       struct relay_session *session = NULL;
+       struct relay_session *session = nullptr;
        uint64_t viewer_session_to_close;
 
        LTTNG_ASSERT(conn);
@@ -2548,7 +2548,7 @@ static void cleanup_connection_pollfd(struct lttng_poll_event *events, int pollf
        (void) lttng_poll_del(events, pollfd);
 
        ret = fd_tracker_close_unsuspendable_fd(
-               the_fd_tracker, &pollfd, 1, fd_tracker_util_close_fd, NULL);
+               the_fd_tracker, &pollfd, 1, fd_tracker_util_close_fd, nullptr);
        if (ret < 0) {
                ERR("Closing pollfd %d", pollfd);
        }
@@ -2594,7 +2594,7 @@ static void *thread_worker(void *data __attribute__((unused)))
        }
 
 restart:
-       while (1) {
+       while (true) {
                int i;
 
                health_code_update();
@@ -2737,20 +2737,20 @@ error_testpoint:
                ERR("Error stopping threads");
        }
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 /*
  * Create the relay command pipe to wake thread_manage_apps.
  * Closed in cleanup().
  */
-static int create_conn_pipe(void)
+static int create_conn_pipe()
 {
        return fd_tracker_util_pipe_open_cloexec(
                the_fd_tracker, "Live connection pipe", live_conn_pipe);
 }
 
-int relayd_live_join(void)
+int relayd_live_join()
 {
        int ret, retval = 0;
        void *status;
@@ -2823,8 +2823,10 @@ int relayd_live_create(struct lttng_uri *uri)
        }
 
        /* Setup the dispatcher thread */
-       ret = pthread_create(
-               &live_dispatcher_thread, default_pthread_attr(), thread_dispatcher, (void *) NULL);
+       ret = pthread_create(&live_dispatcher_thread,
+                            default_pthread_attr(),
+                            thread_dispatcher,
+                            (void *) nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create viewer dispatcher");
@@ -2833,7 +2835,7 @@ int relayd_live_create(struct lttng_uri *uri)
        }
 
        /* Setup the worker thread */
-       ret = pthread_create(&live_worker_thread, default_pthread_attr(), thread_worker, NULL);
+       ret = pthread_create(&live_worker_thread, default_pthread_attr(), thread_worker, nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create viewer worker");
@@ -2843,7 +2845,7 @@ int relayd_live_create(struct lttng_uri *uri)
 
        /* Setup the listener thread */
        ret = pthread_create(
-               &live_listener_thread, default_pthread_attr(), thread_listener, (void *) NULL);
+               &live_listener_thread, default_pthread_attr(), thread_listener, (void *) nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create viewer listener");
index 10db7979852623cbe3611eb0114fde8eba5a654c..e7598974de380e57ce76636d80b4d9474e3ed769 100644 (file)
@@ -80,7 +80,7 @@ static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-relayd.8.h>
 #else
-       NULL
+       nullptr
 #endif
        ;
 
@@ -179,100 +179,100 @@ static struct option long_options[] = {
        {
                "control-port",
                1,
-               0,
+               nullptr,
                'C',
        },
        {
                "data-port",
                1,
-               0,
+               nullptr,
                'D',
        },
        {
                "live-port",
                1,
-               0,
+               nullptr,
                'L',
        },
        {
                "daemonize",
                0,
-               0,
+               nullptr,
                'd',
        },
        {
                "background",
                0,
-               0,
+               nullptr,
                'b',
        },
        {
                "group",
                1,
-               0,
+               nullptr,
                'g',
        },
        {
                "fd-pool-size",
                1,
-               0,
+               nullptr,
                '\0',
        },
        {
                "help",
                0,
-               0,
+               nullptr,
                'h',
        },
        {
                "output",
                1,
-               0,
+               nullptr,
                'o',
        },
        {
                "verbose",
                0,
-               0,
+               nullptr,
                'v',
        },
-       { "config", 1, 0, 'f' },
-       { "version", 0, 0, 'V' },
+       { "config", 1, nullptr, 'f' },
+       { "version", 0, nullptr, 'V' },
        {
                "working-directory",
                1,
-               0,
+               nullptr,
                'w',
        },
        {
                "group-output-by-session",
                0,
-               0,
+               nullptr,
                's',
        },
        {
                "group-output-by-host",
                0,
-               0,
+               nullptr,
                'p',
        },
-       { "disallow-clear", 0, 0, 'x' },
+       { "disallow-clear", 0, nullptr, 'x' },
        {
-               NULL,
-               0,
+               nullptr,
                0,
+               nullptr,
                0,
        },
 };
 
 static const char *config_ignore_options[] = { "help", "config", "version" };
 
-static void print_version(void)
+static void print_version()
 {
        fprintf(stdout, "%s\n", VERSION);
 }
 
-static void relayd_config_log(void)
+static void relayd_config_log()
 {
        DBG("LTTng-relayd " VERSION " - " VERSION_NAME "%s%s",
            GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
@@ -301,7 +301,7 @@ static int set_option(int opt, const char *arg, const char *optname)
                        unsigned long v;
 
                        errno = 0;
-                       v = strtoul(arg, NULL, 0);
+                       v = strtoul(arg, nullptr, 0);
                        if (errno != 0 || !isdigit((unsigned char) arg[0])) {
                                ERR("Wrong value in --fd-pool-size parameter: %s", arg);
                                ret = -1;
@@ -378,7 +378,7 @@ static int set_option(int opt, const char *arg, const char *optname)
                             "-g, --group");
                } else {
                        tracing_group_name = strdup(arg);
-                       if (tracing_group_name == NULL) {
+                       if (tracing_group_name == nullptr) {
                                ret = -errno;
                                PERROR("strdup");
                                goto end;
@@ -522,10 +522,10 @@ end:
        return ret;
 }
 
-static int parse_env_options(void)
+static int parse_env_options()
 {
        int ret = 0;
-       char *value = NULL;
+       char *value = nullptr;
 
        value = lttng_secure_getenv(DEFAULT_LTTNG_RELAYD_WORKING_DIRECTORY_ENV);
        if (value) {
@@ -538,7 +538,7 @@ static int parse_env_options(void)
        return ret;
 }
 
-static int set_fd_pool_size(void)
+static int set_fd_pool_size()
 {
        int ret = 0;
        struct rlimit rlimit;
@@ -596,7 +596,7 @@ static int set_options(int argc, char **argv)
        int c, ret = 0, option_index = 0, retval = 0;
        int orig_optopt = optopt, orig_optind = optind;
        char *default_address, *optstring;
-       char *config_path = NULL;
+       char *config_path = nullptr;
 
        optstring = utils_generate_optstring(long_options,
                                             sizeof(long_options) / sizeof(struct option));
@@ -628,7 +628,7 @@ static int set_options(int argc, char **argv)
        }
 
        ret = config_get_section_entries(
-               config_path, config_section_name, config_entry_handler, NULL);
+               config_path, config_section_name, config_entry_handler, nullptr);
        if (ret) {
                if (ret > 0) {
                        ERR("Invalid configuration option at line %i", ret);
@@ -640,7 +640,7 @@ static int set_options(int argc, char **argv)
        /* Reset getopt's global state */
        optopt = orig_optopt;
        optind = orig_optind;
-       while (1) {
+       while (true) {
                c = getopt_long(argc, argv, optstring, long_options, &option_index);
                if (c == -1) {
                        break;
@@ -654,7 +654,7 @@ static int set_options(int argc, char **argv)
        }
 
        /* assign default values */
-       if (control_uri == NULL) {
+       if (control_uri == nullptr) {
                ret = asprintf(&default_address,
                               "tcp://" DEFAULT_NETWORK_CONTROL_BIND_ADDRESS ":%d",
                               DEFAULT_NETWORK_CONTROL_PORT);
@@ -672,7 +672,7 @@ static int set_options(int argc, char **argv)
                        goto exit;
                }
        }
-       if (data_uri == NULL) {
+       if (data_uri == nullptr) {
                ret = asprintf(&default_address,
                               "tcp://" DEFAULT_NETWORK_DATA_BIND_ADDRESS ":%d",
                               DEFAULT_NETWORK_DATA_PORT);
@@ -690,7 +690,7 @@ static int set_options(int argc, char **argv)
                        goto exit;
                }
        }
-       if (live_uri == NULL) {
+       if (live_uri == nullptr) {
                ret = asprintf(&default_address,
                               "tcp://" DEFAULT_NETWORK_VIEWER_BIND_ADDRESS ":%d",
                               DEFAULT_NETWORK_VIEWER_PORT);
@@ -738,7 +738,7 @@ exit:
        return retval;
 }
 
-static void print_global_objects(void)
+static void print_global_objects()
 {
        print_viewer_streams();
        print_relay_streams();
@@ -750,7 +750,7 @@ static int noop_close(void *data __attribute__((unused)), int *fds __attribute__
        return 0;
 }
 
-static void untrack_stdio(void)
+static void untrack_stdio()
 {
        int fds[] = { fileno(stdout), fileno(stderr) };
 
@@ -758,13 +758,13 @@ static void untrack_stdio(void)
         * noop_close is used since we don't really want to close
         * the stdio output fds; we merely want to stop tracking them.
         */
-       (void) fd_tracker_close_unsuspendable_fd(the_fd_tracker, fds, 2, noop_close, NULL);
+       (void) fd_tracker_close_unsuspendable_fd(the_fd_tracker, fds, 2, noop_close, nullptr);
 }
 
 /*
  * Cleanup the daemon
  */
-static void relayd_cleanup(void)
+static void relayd_cleanup()
 {
        print_global_objects();
 
@@ -826,7 +826,7 @@ end:
 /*
  * Stop all relayd and relayd-live threads.
  */
-int lttng_relay_stop_threads(void)
+int lttng_relay_stop_threads()
 {
        int retval = 0;
 
@@ -885,7 +885,7 @@ static void sighandler(int sig)
  * Setup signal handler for :
  *             SIGINT, SIGTERM, SIGPIPE
  */
-static int set_signal_handler(void)
+static int set_signal_handler()
 {
        int ret = 0;
        struct sigaction sa;
@@ -900,23 +900,23 @@ static int set_signal_handler(void)
        sa.sa_flags = 0;
 
        sa.sa_handler = sighandler;
-       if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGTERM, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
-       if ((ret = sigaction(SIGINT, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGINT, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
-       if ((ret = sigaction(SIGUSR1, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGUSR1, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
        sa.sa_handler = SIG_IGN;
-       if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGPIPE, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
@@ -926,7 +926,7 @@ static int set_signal_handler(void)
        return ret;
 }
 
-void lttng_relay_notify_ready(void)
+void lttng_relay_notify_ready()
 {
        /* Notify the parent of the fork() process that we are ready. */
        if (opt_daemon || opt_background) {
@@ -941,7 +941,7 @@ void lttng_relay_notify_ready(void)
  *
  * Return -1 on error or 0 if all pipes are created.
  */
-static int init_health_quit_pipe(void)
+static int init_health_quit_pipe()
 {
        return fd_tracker_util_pipe_open_cloexec(
                the_fd_tracker, "Health quit pipe", health_quit_pipe);
@@ -992,12 +992,12 @@ end:
 static struct lttcomm_sock *relay_socket_create(struct lttng_uri *uri, const char *name)
 {
        int ret, sock_fd;
-       struct lttcomm_sock *sock = NULL;
+       struct lttcomm_sock *sock = nullptr;
        char uri_str[PATH_MAX];
-       char *formated_name = NULL;
+       char *formated_name = nullptr;
 
        sock = lttcomm_alloc_sock_from_uri(uri);
-       if (sock == NULL) {
+       if (sock == nullptr) {
                ERR("Allocating socket");
                goto error;
        }
@@ -1011,14 +1011,14 @@ static struct lttcomm_sock *relay_socket_create(struct lttng_uri *uri, const cha
        if (ret >= 0) {
                ret = asprintf(&formated_name, "%s socket @ %s", name, uri_str);
                if (ret < 0) {
-                       formated_name = NULL;
+                       formated_name = nullptr;
                }
        }
 
        ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker,
                                               &sock_fd,
                                               (const char **) (formated_name ? &formated_name :
-                                                                               NULL),
+                                                                               nullptr),
                                               1,
                                               create_sock,
                                               sock);
@@ -1047,15 +1047,15 @@ error:
                lttcomm_destroy_sock(sock);
        }
        free(formated_name);
-       return NULL;
+       return nullptr;
 }
 
 static struct lttcomm_sock *accept_relayd_sock(struct lttcomm_sock *listening_sock,
                                               const char *name)
 {
        int out_fd, ret;
-       struct lttcomm_sock *socks[2] = { listening_sock, NULL };
-       struct lttcomm_sock *new_sock = NULL;
+       struct lttcomm_sock *socks[2] = { listening_sock, nullptr };
+       struct lttcomm_sock *new_sock = nullptr;
 
        ret = fd_tracker_open_unsuspendable_fd(
                the_fd_tracker, &out_fd, (const char **) &name, 1, accept_sock, &socks);
@@ -1122,7 +1122,7 @@ static void *relay_thread_listener(void *data __attribute__((unused)))
                goto error_testpoint;
        }
 
-       while (1) {
+       while (true) {
                health_code_update();
 
                DBG("Listener accepting connections");
@@ -1167,7 +1167,7 @@ static void *relay_thread_listener(void *data __attribute__((unused)))
                                 */
                                int val = 1;
                                struct relay_connection *new_conn;
-                               struct lttcomm_sock *newsock = NULL;
+                               struct lttcomm_sock *newsock = nullptr;
                                enum connection_type type;
 
                                if (pollfd == data_sock->fd) {
@@ -1266,7 +1266,7 @@ error_sock_control:
        rcu_unregister_thread();
        DBG("Relay listener thread cleanup complete");
        lttng_relay_stop_threads();
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1277,7 +1277,7 @@ static void *relay_thread_dispatcher(void *data __attribute__((unused)))
        int err = -1;
        ssize_t ret;
        struct cds_wfcq_node *node;
-       struct relay_connection *new_conn = NULL;
+       struct relay_connection *new_conn = nullptr;
 
        DBG("[thread] Relay dispatcher started");
 
@@ -1305,7 +1305,7 @@ static void *relay_thread_dispatcher(void *data __attribute__((unused)))
                        /* Dequeue commands */
                        node = cds_wfcq_dequeue_blocking(&relay_conn_queue.head,
                                                         &relay_conn_queue.tail);
-                       if (node == NULL) {
+                       if (node == nullptr) {
                                DBG("Woken up but nothing in the relay command queue");
                                /* Continue thread execution */
                                break;
@@ -1326,7 +1326,7 @@ static void *relay_thread_dispatcher(void *data __attribute__((unused)))
                                connection_put(new_conn);
                                goto error;
                        }
-               } while (node != NULL);
+               } while (node != nullptr);
 
                /* Futex wait on queue. Blocking call on futex() */
                health_poll_entry();
@@ -1346,7 +1346,7 @@ error_testpoint:
        health_unregister(health_relayd);
        DBG("Dispatch thread dying");
        lttng_relay_stop_threads();
-       return NULL;
+       return nullptr;
 }
 
 static bool session_streams_have_index(const struct relay_session *session)
@@ -1365,7 +1365,7 @@ static int relay_create_session(const struct lttcomm_relayd_hdr *recv_hdr __attr
 {
        int ret = 0;
        ssize_t send_ret;
-       struct relay_session *session = NULL;
+       struct relay_session *session = nullptr;
        struct lttcomm_relayd_create_session_reply_2_11 reply = {};
        char session_name[LTTNG_NAME_MAX] = {};
        char hostname[LTTNG_HOST_NAME_MAX] = {};
@@ -1431,9 +1431,9 @@ static int relay_create_session(const struct lttcomm_relayd_hdr *recv_hdr __attr
                                 live_timer,
                                 snapshot,
                                 sessiond_uuid,
-                                id_sessiond.is_set ? &id_sessiond.value : NULL,
-                                current_chunk_id.is_set ? &current_chunk_id.value : NULL,
-                                creation_time.is_set ? &creation_time.value : NULL,
+                                id_sessiond.is_set ? &id_sessiond.value : nullptr,
+                                current_chunk_id.is_set ? &current_chunk_id.value : nullptr,
+                                creation_time.is_set ? &creation_time.value : nullptr,
                                 conn->major,
                                 conn->minor,
                                 session_name_contains_creation_timestamp);
@@ -1566,11 +1566,11 @@ static int relay_add_stream(const struct lttcomm_relayd_hdr *recv_hdr __attribut
        int ret;
        ssize_t send_ret;
        struct relay_session *session = conn->session;
-       struct relay_stream *stream = NULL;
+       struct relay_stream *stream = nullptr;
        struct lttcomm_relayd_status_stream reply;
-       struct ctf_trace *trace = NULL;
+       struct ctf_trace *trace = nullptr;
        uint64_t stream_handle = -1ULL;
-       char *path_name = NULL, *channel_name = NULL;
+       char *path_name = nullptr, *channel_name = nullptr;
        uint64_t tracefile_size = 0, tracefile_count = 0;
        LTTNG_OPTIONAL(uint64_t) stream_chunk_id = {};
 
@@ -1664,8 +1664,8 @@ static int relay_add_stream(const struct lttcomm_relayd_hdr *recv_hdr __attribut
        /* We pass ownership of path_name and channel_name. */
        stream = stream_create(
                trace, stream_handle, path_name, channel_name, tracefile_size, tracefile_count);
-       path_name = NULL;
-       channel_name = NULL;
+       path_name = nullptr;
+       channel_name = nullptr;
 
        /*
         * Streams are the owners of their trace. Reference to trace is
@@ -2062,7 +2062,7 @@ static int relay_data_pending(const struct lttcomm_relayd_hdr *recv_hdr __attrib
        msg.last_net_seq_num = be64toh(msg.last_net_seq_num);
 
        stream = stream_get_by_id(msg.stream_id);
-       if (stream == NULL) {
+       if (stream == nullptr) {
                ret = -1;
                goto end;
        }
@@ -2611,8 +2611,8 @@ static int relay_rotate_session_streams(const struct lttcomm_relayd_hdr *recv_hd
        struct relay_session *session = conn->session;
        struct lttcomm_relayd_rotate_streams rotate_streams;
        struct lttcomm_relayd_generic_reply reply = {};
-       struct relay_stream *stream = NULL;
-       struct lttng_trace_chunk *next_trace_chunk = NULL;
+       struct relay_stream *stream = nullptr;
+       struct lttng_trace_chunk *next_trace_chunk = nullptr;
        struct lttng_buffer_view stream_positions;
        char chunk_id_buf[MAX_INT_DEC_LEN(uint64_t)];
        const char *chunk_id_str = "none";
@@ -2711,7 +2711,7 @@ static int relay_rotate_session_streams(const struct lttcomm_relayd_hdr *recv_hd
                }
 
                stream_put(stream);
-               stream = NULL;
+               stream = nullptr;
        }
 
        reply_code = LTTNG_OK;
@@ -2747,7 +2747,7 @@ static int relay_create_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
        struct lttcomm_relayd_create_trace_chunk *msg;
        struct lttcomm_relayd_generic_reply reply = {};
        struct lttng_buffer_view header_view;
-       struct lttng_trace_chunk *chunk = NULL, *published_chunk = NULL;
+       struct lttng_trace_chunk *chunk = nullptr, *published_chunk = nullptr;
        enum lttng_error_code reply_code = LTTNG_OK;
        enum lttng_trace_chunk_status chunk_status;
        const char *new_path;
@@ -2794,7 +2794,7 @@ static int relay_create_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
                if (!session->has_rotated) {
                        new_path = "";
                } else {
-                       new_path = NULL;
+                       new_path = nullptr;
                }
        } else {
                new_path = DEFAULT_CHUNK_TMP_NEW_DIRECTORY;
@@ -2892,7 +2892,7 @@ static int relay_create_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
        }
        conn->session->pending_closure_trace_chunk = conn->session->current_trace_chunk;
        conn->session->current_trace_chunk = published_chunk;
-       published_chunk = NULL;
+       published_chunk = nullptr;
        if (!conn->session->pending_closure_trace_chunk) {
                session->ongoing_rotation = false;
        }
@@ -2925,7 +2925,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
        struct lttcomm_relayd_close_trace_chunk *msg;
        struct lttcomm_relayd_close_trace_chunk_reply reply = {};
        struct lttng_buffer_view header_view;
-       struct lttng_trace_chunk *chunk = NULL;
+       struct lttng_trace_chunk *chunk = nullptr;
        enum lttng_error_code reply_code = LTTNG_OK;
        enum lttng_trace_chunk_status chunk_status;
        uint64_t chunk_id;
@@ -2933,7 +2933,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
        time_t close_timestamp;
        char closed_trace_chunk_path[LTTNG_PATH_MAX];
        size_t path_length = 0;
-       const char *chunk_name = NULL;
+       const char *chunk_name = nullptr;
        struct lttng_dynamic_buffer reply_payload;
        const char *new_path;
 
@@ -3016,7 +3016,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
                        new_path = "";
                } else {
                        /* Use chunk name for new chunk. */
-                       new_path = NULL;
+                       new_path = nullptr;
                }
                /* Rename new chunk path. */
                chunk_status =
@@ -3035,7 +3035,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
                if (!session->has_rotated) {
                        old_path = "";
                } else {
-                       old_path = NULL;
+                       old_path = nullptr;
                }
                /* We need to move back the .tmp_old_chunk to its rightful place. */
                chunk_status = lttng_trace_chunk_rename_path(chunk, old_path);
@@ -3060,7 +3060,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
                        goto end_unlock_session;
                }
        }
-       chunk_status = lttng_trace_chunk_get_name(chunk, &chunk_name, NULL);
+       chunk_status = lttng_trace_chunk_get_name(chunk, &chunk_name, nullptr);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ERR("Failed to get chunk name");
                ret = -1;
@@ -3123,10 +3123,10 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
                 * the last stream releases its reference to it.
                 */
                lttng_trace_chunk_put(session->current_trace_chunk);
-               session->current_trace_chunk = NULL;
+               session->current_trace_chunk = nullptr;
        }
        lttng_trace_chunk_put(session->pending_closure_trace_chunk);
-       session->pending_closure_trace_chunk = NULL;
+       session->pending_closure_trace_chunk = nullptr;
 end_unlock_session:
        pthread_mutex_unlock(&session->lock);
 
@@ -3750,7 +3750,7 @@ relay_process_data_receive_payload(struct relay_connection *conn)
                goto end_stream_unlock;
        }
 
-       ret = stream_write(stream, NULL, state->header.padding_size);
+       ret = stream_write(stream, nullptr, state->header.padding_size);
        if (ret) {
                status = RELAY_CONNECTION_STATUS_ERROR;
                goto end_stream_unlock;
@@ -3792,7 +3792,7 @@ relay_process_data_receive_payload(struct relay_connection *conn)
         * the new state. Don't use it beyond this point.
         */
        connection_reset_protocol_state(conn);
-       state = NULL;
+       state = nullptr;
 
 end_stream_unlock:
        close_requested = stream->close_requested;
@@ -3841,7 +3841,7 @@ static void cleanup_connection_pollfd(struct lttng_poll_event *events, int pollf
        (void) lttng_poll_del(events, pollfd);
 
        ret = fd_tracker_close_unsuspendable_fd(
-               the_fd_tracker, &pollfd, 1, fd_tracker_util_close_fd, NULL);
+               the_fd_tracker, &pollfd, 1, fd_tracker_util_close_fd, nullptr);
        if (ret < 0) {
                ERR("Closing pollfd %d", pollfd);
        }
@@ -3884,7 +3884,7 @@ static void *relay_thread_worker(void *data __attribute__((unused)))
        struct lttng_poll_event events;
        struct lttng_ht *relay_connections_ht;
        struct lttng_ht_iter iter;
-       struct relay_connection *destroy_conn = NULL;
+       struct relay_connection *destroy_conn = nullptr;
 
        DBG("[thread] Relay worker started");
 
@@ -3915,7 +3915,7 @@ static void *relay_thread_worker(void *data __attribute__((unused)))
        }
 
 restart:
-       while (1) {
+       while (true) {
                int idx = -1, i, seen_control = 0, last_notdel_data_fd = -1;
 
                health_code_update();
@@ -4185,14 +4185,14 @@ error_testpoint:
        health_unregister(health_relayd);
        rcu_unregister_thread();
        lttng_relay_stop_threads();
-       return NULL;
+       return nullptr;
 }
 
 /*
  * Create the relay command pipe to wake thread_manage_apps.
  * Closed in cleanup().
  */
-static int create_relay_conn_pipe(void)
+static int create_relay_conn_pipe()
 {
        return fd_tracker_util_pipe_open_cloexec(
                the_fd_tracker, "Relayd connection pipe", relay_conn_pipe);
@@ -4205,12 +4205,12 @@ static int stdio_open(void *data __attribute__((unused)), int *fds)
        return 0;
 }
 
-static int track_stdio(void)
+static int track_stdio()
 {
        int fds[2];
        const char *names[] = { "stdout", "stderr" };
 
-       return fd_tracker_open_unsuspendable_fd(the_fd_tracker, fds, names, 2, stdio_open, NULL);
+       return fd_tracker_open_unsuspendable_fd(the_fd_tracker, fds, names, 2, stdio_open, nullptr);
 }
 
 /*
@@ -4221,7 +4221,7 @@ int main(int argc, char **argv)
        bool thread_is_rcu_registered = false;
        int ret = 0, retval = 0;
        void *status;
-       char *unlinked_file_directory_path = NULL, *output_path = NULL;
+       char *unlinked_file_directory_path = nullptr, *output_path = nullptr;
 
        /* Parse environment variables */
        ret = parse_env_options();
@@ -4394,8 +4394,10 @@ int main(int argc, char **argv)
        }
 
        /* Create thread to manage the client socket */
-       ret = pthread_create(
-               &health_thread, default_pthread_attr(), thread_manage_health_relayd, (void *) NULL);
+       ret = pthread_create(&health_thread,
+                            default_pthread_attr(),
+                            thread_manage_health_relayd,
+                            (void *) nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create health");
@@ -4404,8 +4406,10 @@ int main(int argc, char **argv)
        }
 
        /* Setup the dispatcher thread */
-       ret = pthread_create(
-               &dispatcher_thread, default_pthread_attr(), relay_thread_dispatcher, (void *) NULL);
+       ret = pthread_create(&dispatcher_thread,
+                            default_pthread_attr(),
+                            relay_thread_dispatcher,
+                            (void *) nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create dispatcher");
@@ -4414,7 +4418,7 @@ int main(int argc, char **argv)
        }
 
        /* Setup the worker thread */
-       ret = pthread_create(&worker_thread, default_pthread_attr(), relay_thread_worker, NULL);
+       ret = pthread_create(&worker_thread, default_pthread_attr(), relay_thread_worker, nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create worker");
@@ -4424,7 +4428,7 @@ int main(int argc, char **argv)
 
        /* Setup the listener thread */
        ret = pthread_create(
-               &listener_thread, default_pthread_attr(), relay_thread_listener, (void *) NULL);
+               &listener_thread, default_pthread_attr(), relay_thread_listener, (void *) nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_create listener");
index 677769ace1c8fd3b38709dbd4d6a084a1cf1d470..1430feef79cb50d9f2e55665e7c5ae5ac405748d 100644 (file)
@@ -40,7 +40,7 @@ static int init_session_output_path_group_by_host(struct relay_session *session)
         * else
         *   hostname/base_path
         */
-       char *session_directory = NULL;
+       char *session_directory = nullptr;
        int ret = 0;
 
        if (session->output_path[0] != '\0') {
@@ -110,7 +110,7 @@ static int init_session_output_path_group_by_session(struct relay_session *sessi
         * integral part of the name and how a user identify a session.
         */
        int ret = 0;
-       char *session_directory = NULL;
+       char *session_directory = nullptr;
        char creation_datetime[DATETIME_STR_LEN];
 
        if (session->output_path[0] != '\0') {
@@ -181,8 +181,8 @@ session_create_output_directory_handle(struct relay_session *session)
         * relayd_output_path/session_directory
         * e.g. /home/user/lttng-traces/hostname/session_name
         */
-       char *full_session_path = NULL;
-       struct lttng_directory_handle *handle = NULL;
+       char *full_session_path = nullptr;
+       struct lttng_directory_handle *handle = nullptr;
 
        pthread_mutex_lock(&session->lock);
        full_session_path = create_output_path(session->output_path);
@@ -206,7 +206,7 @@ end:
 static int session_set_anonymous_chunk(struct relay_session *session)
 {
        int ret = 0;
-       struct lttng_trace_chunk *chunk = NULL;
+       struct lttng_trace_chunk *chunk = nullptr;
        enum lttng_trace_chunk_status status;
        struct lttng_directory_handle *output_directory;
 
@@ -234,7 +234,7 @@ static int session_set_anonymous_chunk(struct relay_session *session)
        }
 
        session->current_trace_chunk = chunk;
-       chunk = NULL;
+       chunk = nullptr;
 end:
        lttng_trace_chunk_put(chunk);
        lttng_directory_handle_put(output_directory);
@@ -293,7 +293,7 @@ struct relay_session *session_create(const char *session_name,
                                     bool session_name_contains_creation_time)
 {
        int ret;
-       struct relay_session *session = NULL;
+       struct relay_session *session = nullptr;
 
        LTTNG_ASSERT(session_name);
        LTTNG_ASSERT(hostname);
@@ -325,8 +325,8 @@ struct relay_session *session_create(const char *session_name,
        lttng_ht_node_init_u64(&session->session_n, session->id);
        urcu_ref_init(&session->ref);
        CDS_INIT_LIST_HEAD(&session->recv_list);
-       pthread_mutex_init(&session->lock, NULL);
-       pthread_mutex_init(&session->recv_list_lock, NULL);
+       pthread_mutex_init(&session->lock, nullptr);
+       pthread_mutex_init(&session->recv_list_lock, nullptr);
 
        if (lttng_strncpy(session->session_name, session_name, sizeof(session->session_name))) {
                WARN("Session name exceeds maximal allowed length");
@@ -343,7 +343,7 @@ struct relay_session *session_create(const char *session_name,
        if (creation_time) {
                LTTNG_OPTIONAL_SET(&session->creation_time, *creation_time);
        } else {
-               LTTNG_OPTIONAL_SET(&session->creation_time, time(NULL));
+               LTTNG_OPTIONAL_SET(&session->creation_time, time(nullptr));
                if (session->creation_time.value == (time_t) -1) {
                        PERROR("Failed to sample session creation time");
                        goto error;
@@ -432,7 +432,7 @@ struct relay_session *session_create(const char *session_name,
 
 error:
        session_put(session);
-       return NULL;
+       return nullptr;
 }
 
 /* Should be called with RCU read-side lock held. */
@@ -450,7 +450,7 @@ bool session_get(struct relay_session *session)
  */
 struct relay_session *session_get_by_id(uint64_t id)
 {
-       struct relay_session *session = NULL;
+       struct relay_session *session = nullptr;
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
 
@@ -464,7 +464,7 @@ struct relay_session *session_get_by_id(uint64_t id)
        session = lttng::utils::container_of(node, &relay_session::session_n);
        DBG("Session find by ID %" PRIu64 " id found", id);
        if (!session_get(session)) {
-               session = NULL;
+               session = nullptr;
        }
 end:
        rcu_read_unlock();
@@ -588,14 +588,14 @@ static void destroy_session(struct relay_session *session)
        ret = session_delete(session);
        LTTNG_ASSERT(!ret);
        lttng_trace_chunk_put(session->current_trace_chunk);
-       session->current_trace_chunk = NULL;
+       session->current_trace_chunk = nullptr;
        lttng_trace_chunk_put(session->pending_closure_trace_chunk);
-       session->pending_closure_trace_chunk = NULL;
+       session->pending_closure_trace_chunk = nullptr;
        ret = sessiond_trace_chunk_registry_session_destroyed(sessiond_trace_chunk_registry,
                                                              session->sessiond_uuid);
        LTTNG_ASSERT(!ret);
        lttng_directory_handle_put(session->output_directory);
-       session->output_directory = NULL;
+       session->output_directory = nullptr;
        call_rcu(&session->rcu_node, rcu_destroy_session);
 }
 
@@ -667,7 +667,7 @@ int session_abort(struct relay_session *session)
        return ret;
 }
 
-void print_sessions(void)
+void print_sessions()
 {
        struct lttng_ht_iter iter;
        struct relay_session *session;
index 7201daed1ef74bb27c9c3d7b51464c659dc2e217..1fb034053eef5bbbadd9b0940c07176a1ccae8bb 100644 (file)
@@ -115,7 +115,7 @@ static void trace_chunk_registry_ht_element_release(struct urcu_ref *ref)
                rcu_read_lock();
                cds_lfht_del(element->sessiond_trace_chunk_registry->ht, &element->ht_node);
                rcu_read_unlock();
-               element->sessiond_trace_chunk_registry = NULL;
+               element->sessiond_trace_chunk_registry = nullptr;
        }
 
        lttng_trace_chunk_registry_destroy(element->trace_chunk_registry);
@@ -142,7 +142,7 @@ static struct trace_chunk_registry_ht_element *
 trace_chunk_registry_ht_element_find(struct sessiond_trace_chunk_registry *sessiond_registry,
                                     const struct trace_chunk_registry_ht_key *key)
 {
-       struct trace_chunk_registry_ht_element *element = NULL;
+       struct trace_chunk_registry_ht_element *element = nullptr;
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
 
@@ -161,7 +161,7 @@ trace_chunk_registry_ht_element_find(struct sessiond_trace_chunk_registry *sessi
                 * could be acquired.
                 */
                if (!trace_chunk_registry_ht_element_get(element)) {
-                       element = NULL;
+                       element = nullptr;
                }
        }
        rcu_read_unlock();
@@ -195,11 +195,11 @@ trace_chunk_registry_ht_element_create(struct sessiond_trace_chunk_registry *ses
        urcu_ref_init(&new_element->ref);
        cds_lfht_node_init(&new_element->ht_node);
        new_element->trace_chunk_registry = trace_chunk_registry;
-       trace_chunk_registry = NULL;
+       trace_chunk_registry = nullptr;
 
        /* Attempt to publish the new element. */
        rcu_read_lock();
-       while (1) {
+       while (true) {
                struct cds_lfht_node *published_node;
                struct trace_chunk_registry_ht_element *published_element;
 
@@ -228,7 +228,7 @@ trace_chunk_registry_ht_element_create(struct sessiond_trace_chunk_registry *ses
                        DBG("Acquired reference to trace chunk registry of sessiond {%s}",
                            uuid_str);
                        trace_chunk_registry_ht_element_put(new_element);
-                       new_element = NULL;
+                       new_element = nullptr;
                        break;
                }
                /*
@@ -246,7 +246,7 @@ end:
        return ret;
 }
 
-struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry_create(void)
+struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry_create()
 {
        struct sessiond_trace_chunk_registry *sessiond_registry =
                zmalloc<sessiond_trace_chunk_registry>();
@@ -256,7 +256,7 @@ struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry_create(void)
        }
 
        sessiond_registry->ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!sessiond_registry->ht) {
                goto error;
        }
@@ -265,12 +265,12 @@ end:
        return sessiond_registry;
 error:
        sessiond_trace_chunk_registry_destroy(sessiond_registry);
-       return NULL;
+       return nullptr;
 }
 
 void sessiond_trace_chunk_registry_destroy(struct sessiond_trace_chunk_registry *sessiond_registry)
 {
-       int ret = cds_lfht_destroy(sessiond_registry->ht, NULL);
+       int ret = cds_lfht_destroy(sessiond_registry->ht, nullptr);
 
        LTTNG_ASSERT(!ret);
        free(sessiond_registry);
@@ -336,10 +336,10 @@ sessiond_trace_chunk_registry_publish_chunk(struct sessiond_trace_chunk_registry
        uint64_t chunk_id;
        bool is_anonymous_chunk;
        struct trace_chunk_registry_ht_key key;
-       struct trace_chunk_registry_ht_element *element = NULL;
+       struct trace_chunk_registry_ht_element *element = nullptr;
        char uuid_str[LTTNG_UUID_STR_LEN];
        char chunk_id_str[MAX_INT_DEC_LEN(typeof(chunk_id))] = "-1";
-       struct lttng_trace_chunk *published_chunk = NULL;
+       struct lttng_trace_chunk *published_chunk = nullptr;
        bool trace_chunk_already_published;
 
        lttng_uuid_to_str(sessiond_uuid, uuid_str);
@@ -409,7 +409,7 @@ struct lttng_trace_chunk *sessiond_trace_chunk_registry_get_anonymous_chunk(
        const lttng_uuid& sessiond_uuid,
        uint64_t session_id)
 {
-       struct lttng_trace_chunk *chunk = NULL;
+       struct lttng_trace_chunk *chunk = nullptr;
        struct trace_chunk_registry_ht_element *element;
        struct trace_chunk_registry_ht_key key;
        char uuid_str[LTTNG_UUID_STR_LEN];
@@ -436,7 +436,7 @@ sessiond_trace_chunk_registry_get_chunk(struct sessiond_trace_chunk_registry *se
                                        uint64_t session_id,
                                        uint64_t chunk_id)
 {
-       struct lttng_trace_chunk *chunk = NULL;
+       struct lttng_trace_chunk *chunk = nullptr;
        struct trace_chunk_registry_ht_element *element;
        struct trace_chunk_registry_ht_key key;
        char uuid_str[LTTNG_UUID_STR_LEN];
index 9df6e52fb52204abfa3bce423503394b72a41b35..60c90bc111a44975a6b7c255879132d77810fde9 100644 (file)
@@ -45,7 +45,7 @@ struct relay_stream *stream_get_by_id(uint64_t stream_id)
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
-       struct relay_stream *stream = NULL;
+       struct relay_stream *stream = nullptr;
 
        rcu_read_lock();
        lttng_ht_lookup(relay_streams_ht, &stream_id, &iter);
@@ -56,7 +56,7 @@ struct relay_stream *stream_get_by_id(uint64_t stream_id)
        }
        stream = lttng::utils::container_of(node, &relay_stream::node);
        if (!stream_get(stream)) {
-               stream = NULL;
+               stream = nullptr;
        }
 end:
        rcu_read_unlock();
@@ -93,7 +93,7 @@ static int stream_create_data_output_file_from_trace_chunk(struct relay_stream *
                                     stream->channel_name,
                                     stream->tracefile_size,
                                     stream->tracefile_current_index,
-                                    NULL,
+                                    nullptr,
                                     stream_path,
                                     sizeof(stream_path));
        if (ret < 0) {
@@ -145,7 +145,7 @@ static int stream_rotate_data_file(struct relay_stream *stream)
 
        if (stream->file) {
                fs_handle_close(stream->file);
-               stream->file = NULL;
+               stream->file = nullptr;
        }
 
        stream->tracefile_wrapped_around = false;
@@ -203,8 +203,8 @@ static int rotate_truncate_stream(struct relay_stream *stream)
        off_t lseek_ret, previous_stream_copy_origin;
        uint64_t copy_bytes_left, misplaced_data_size;
        bool acquired_reference;
-       struct fs_handle *previous_stream_file = NULL;
-       struct lttng_trace_chunk *previous_chunk = NULL;
+       struct fs_handle *previous_stream_file = nullptr;
+       struct lttng_trace_chunk *previous_chunk = nullptr;
 
        if (!LTTNG_OPTIONAL_GET(stream->ongoing_rotation).next_trace_chunk) {
                ERR("Protocol error encoutered in %s(): stream rotation "
@@ -236,7 +236,7 @@ static int rotate_truncate_stream(struct relay_stream *stream)
         */
        LTTNG_ASSERT(stream->file);
        previous_stream_file = stream->file;
-       stream->file = NULL;
+       stream->file = nullptr;
 
        LTTNG_ASSERT(!stream->is_metadata);
        LTTNG_ASSERT(stream->tracefile_size_current > stream->pos_after_last_complete_data_index);
@@ -417,7 +417,7 @@ static int create_index_file(struct relay_stream *stream, struct lttng_trace_chu
 {
        int ret;
        uint32_t major, minor;
-       char *index_subpath = NULL;
+       char *index_subpath = nullptr;
        enum lttng_trace_chunk_status status;
 
        ASSERT_LOCKED(stream->lock);
@@ -425,7 +425,7 @@ static int create_index_file(struct relay_stream *stream, struct lttng_trace_chu
        /* Put ref on previous index_file. */
        if (stream->index_file) {
                lttng_index_file_put(stream->index_file);
-               stream->index_file = NULL;
+               stream->index_file = nullptr;
        }
        major = stream->trace->session->major;
        minor = stream->trace->session->minor;
@@ -516,7 +516,7 @@ static int try_rotate_stream_index(struct relay_stream *stream)
                DBG("Rotating stream %" PRIu64 " index file", stream->stream_handle);
                if (stream->index_file) {
                        lttng_index_file_put(stream->index_file);
-                       stream->index_file = NULL;
+                       stream->index_file = nullptr;
                }
                stream->ongoing_rotation.value.index_rotated = true;
 
@@ -556,7 +556,7 @@ static int stream_set_trace_chunk(struct relay_stream *stream, struct lttng_trac
 
        if (stream->file) {
                fs_handle_close(stream->file);
-               stream->file = NULL;
+               stream->file = nullptr;
        }
        ret = stream_create_data_output_file_from_trace_chunk(stream, chunk, false, &stream->file);
 end:
@@ -574,13 +574,13 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
                                   uint64_t tracefile_count)
 {
        int ret;
-       struct relay_stream *stream = NULL;
+       struct relay_stream *stream = nullptr;
        struct relay_session *session = trace->session;
        bool acquired_reference = false;
        struct lttng_trace_chunk *current_trace_chunk;
 
        stream = zmalloc<relay_stream>();
-       if (stream == NULL) {
+       if (stream == nullptr) {
                PERROR("relay stream zmalloc");
                goto error_no_alloc;
        }
@@ -596,7 +596,7 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
        stream->channel_name = channel_name;
        stream->beacon_ts_end = -1ULL;
        lttng_ht_node_init_u64(&stream->node, stream->stream_handle);
-       pthread_mutex_init(&stream->lock, NULL);
+       pthread_mutex_init(&stream->lock, nullptr);
        urcu_ref_init(&stream->ref);
        ctf_trace_get(trace);
        stream->trace = trace;
@@ -665,10 +665,10 @@ end:
        if (ret) {
                if (stream->file) {
                        fs_handle_close(stream->file);
-                       stream->file = NULL;
+                       stream->file = nullptr;
                }
                stream_put(stream);
-               stream = NULL;
+               stream = nullptr;
        }
        if (acquired_reference) {
                lttng_trace_chunk_put(current_trace_chunk);
@@ -682,7 +682,7 @@ error_no_alloc:
         */
        free(path_name);
        free(channel_name);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -788,19 +788,19 @@ static void stream_release(struct urcu_ref *ref)
 
        if (stream->file) {
                fs_handle_close(stream->file);
-               stream->file = NULL;
+               stream->file = nullptr;
        }
        if (stream->index_file) {
                lttng_index_file_put(stream->index_file);
-               stream->index_file = NULL;
+               stream->index_file = nullptr;
        }
        if (stream->trace) {
                ctf_trace_put(stream->trace);
-               stream->trace = NULL;
+               stream->trace = nullptr;
        }
        stream_complete_rotation(stream);
        lttng_trace_chunk_put(stream->trace_chunk);
-       stream->trace_chunk = NULL;
+       stream->trace_chunk = nullptr;
 
        call_rcu(&stream->rcu_node, stream_destroy_rcu);
 }
@@ -972,14 +972,14 @@ void try_stream_close(struct relay_stream *stream)
        /* Put stream fd before put chunk. */
        if (stream->file) {
                fs_handle_close(stream->file);
-               stream->file = NULL;
+               stream->file = nullptr;
        }
        if (stream->index_file) {
                lttng_index_file_put(stream->index_file);
-               stream->index_file = NULL;
+               stream->index_file = nullptr;
        }
        lttng_trace_chunk_put(stream->trace_chunk);
-       stream->trace_chunk = NULL;
+       stream->trace_chunk = nullptr;
        pthread_mutex_unlock(&stream->lock);
        DBG("Succeeded in closing stream %" PRIu64, stream->stream_handle);
        stream_put(stream);
@@ -1029,7 +1029,7 @@ int stream_init_packet(struct relay_stream *stream, size_t packet_size, bool *fi
 
                if (stream->file) {
                        fs_handle_close(stream->file);
-                       stream->file = NULL;
+                       stream->file = nullptr;
                }
                ret = stream_create_data_output_file_from_trace_chunk(
                        stream, stream->trace_chunk, false, &stream->file);
@@ -1169,7 +1169,7 @@ int stream_update_index(struct relay_stream *stream,
                            stream->stream_handle);
                        /* Put self-ref for this index due to error. */
                        relay_index_put(index);
-                       index = NULL;
+                       index = nullptr;
                        goto end;
                }
        }
@@ -1178,7 +1178,7 @@ int stream_update_index(struct relay_stream *stream,
                ret = -1;
                /* Put self-ref for this index due to error. */
                relay_index_put(index);
-               index = NULL;
+               index = nullptr;
                goto end;
        }
 
@@ -1342,7 +1342,7 @@ int stream_reset_file(struct relay_stream *stream)
                            stream->channel_name,
                            stream->stream_handle);
                }
-               stream->file = NULL;
+               stream->file = nullptr;
        }
 
        DBG("%s: reset tracefile_size_current for stream %" PRIu64 " was %" PRIu64,
@@ -1360,7 +1360,7 @@ int stream_reset_file(struct relay_stream *stream)
                stream, stream->trace_chunk, true, &stream->file);
 }
 
-void print_relay_streams(void)
+void print_relay_streams()
 {
        struct lttng_ht_iter iter;
        struct relay_stream *stream;
index dec536ed1f6385dd8c25a2e8a53a9cb192d193ca..93bc0b396e09a79055cedf5fb829f8e53fccfd16 100644 (file)
@@ -129,7 +129,7 @@ static int get_env_int(const char *env_var, const char *value)
 {
        int ret;
        long tmp;
-       char *endptr = NULL;
+       char *endptr = nullptr;
 
        errno = 0;
        tmp = strtol(value, &endptr, 0);
@@ -493,7 +493,7 @@ error:
 }
 
 /* Initialize the TCP keep-alive configuration. */
-__attribute__((constructor)) static void tcp_keep_alive_init(void)
+__attribute__((constructor)) static void tcp_keep_alive_init()
 {
        tcp_keep_alive_init_support(&the_support);
        (void) tcp_keep_alive_init_config(&the_support, &the_config);
index fc6c64dbd55cf47b17dbd6e56b31bc53c9a5b5d8..8e09f6c54dd3e845d6f16de27c0925cffb757ccc 100644 (file)
@@ -39,7 +39,7 @@ static int notify_thread_pipe(int wpipe)
  *
  * Return -1 on error or 0 if all pipes are created.
  */
-int relayd_init_thread_quit_pipe(void)
+int relayd_init_thread_quit_pipe()
 {
        return fd_tracker_util_pipe_open_cloexec(
                the_fd_tracker, "Thread quit pipe", thread_quit_pipe);
@@ -50,7 +50,7 @@ int relayd_init_thread_quit_pipe(void)
  *
  * Return 0 on success or -1 on error.
  */
-int relayd_notify_thread_quit_pipe(void)
+int relayd_notify_thread_quit_pipe()
 {
        return notify_thread_pipe(thread_quit_pipe[1]);
 }
@@ -58,7 +58,7 @@ int relayd_notify_thread_quit_pipe(void)
 /*
  * Close the thread quit pipe.
  */
-void relayd_close_thread_quit_pipe(void)
+void relayd_close_thread_quit_pipe()
 {
        if (thread_quit_pipe[0] != -1) {
                (void) fd_tracker_util_pipe_close(the_fd_tracker, thread_quit_pipe);
@@ -78,7 +78,7 @@ bool relayd_is_thread_quit_pipe(const int fd)
  */
 int create_named_thread_poll_set(struct lttng_poll_event *events, int size, const char *name)
 {
-       if (events == NULL || size == 0) {
+       if (events == nullptr || size == 0) {
                return -1;
        }
 
index 07d5ee17f2f2c7a3f97eba57b4bfa76171569e45..b59e2aea17c8e493827cdf40cb1ffa9ffb28e09c 100644 (file)
@@ -14,7 +14,7 @@
 
 struct tracefile_array *tracefile_array_create(size_t count)
 {
-       struct tracefile_array *tfa = NULL;
+       struct tracefile_array *tfa = nullptr;
        int i;
 
        tfa = zmalloc<tracefile_array>();
@@ -39,7 +39,7 @@ error:
                free(tfa->tf);
        }
        free(tfa);
-       return NULL;
+       return nullptr;
 }
 
 void tracefile_array_destroy(struct tracefile_array *tfa)
index 6ea98ec7cea8ea15c59b05a283764a3ce4d44982..3d02f6044b20cd66b5a9920fc18ebdcedcf04a05 100644 (file)
 static char *create_output_path_auto(const char *path_name)
 {
        int ret;
-       char *traces_path = NULL;
+       char *traces_path = nullptr;
        const char *default_path;
 
        default_path = utils_get_home_dir();
-       if (default_path == NULL) {
+       if (default_path == nullptr) {
                ERR("Home path not found.\n \
                                Please specify an output path using -o, --output PATH");
                goto exit;
@@ -43,7 +43,7 @@ exit:
 static char *create_output_path_noauto(const char *path_name)
 {
        int ret;
-       char *traces_path = NULL;
+       char *traces_path = nullptr;
        char *full_path;
 
        full_path = utils_expand_path(opt_output_path);
@@ -70,7 +70,7 @@ char *create_output_path(const char *path_name)
 {
        LTTNG_ASSERT(path_name);
 
-       if (opt_output_path == NULL) {
+       if (opt_output_path == nullptr) {
                return create_output_path_auto(path_name);
        } else {
                return create_output_path_noauto(path_name);
index 9d067577a04caedcaf6a90af8825365ec1bd9dc3..1181936b24f1bea293102efc8444640cd7d096cb 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <urcu/rculist.h>
 
-struct relay_viewer_session *viewer_session_create(void)
+struct relay_viewer_session *viewer_session_create()
 {
        struct relay_viewer_session *vsession;
 
@@ -39,7 +39,7 @@ int viewer_session_set_trace_chunk_copy(struct relay_viewer_session *vsession,
        struct lttng_trace_chunk *viewer_chunk;
 
        lttng_trace_chunk_put(vsession->current_trace_chunk);
-       vsession->current_trace_chunk = NULL;
+       vsession->current_trace_chunk = nullptr;
 
        DBG("Copying relay session's current trace chunk to the viewer session");
        if (!relay_session_trace_chunk) {
@@ -167,7 +167,7 @@ void viewer_session_close_one_session(struct relay_viewer_session *vsession,
                viewer_stream_put(vstream);
        }
        lttng_trace_chunk_put(vsession->current_trace_chunk);
-       vsession->current_trace_chunk = NULL;
+       vsession->current_trace_chunk = nullptr;
        viewer_session_detach(vsession, session);
 }
 
index 92be53e4f8b102de4f7c6b44ebe038eb90cf99e0..8bf0475045c4bb3a48a3b2040b24363994024d5c 100644 (file)
@@ -25,18 +25,18 @@ static void viewer_stream_release_composite_objects(struct relay_viewer_stream *
 {
        if (vstream->stream_file.handle) {
                fs_handle_close(vstream->stream_file.handle);
-               vstream->stream_file.handle = NULL;
+               vstream->stream_file.handle = nullptr;
        }
        if (vstream->index_file) {
                lttng_index_file_put(vstream->index_file);
-               vstream->index_file = NULL;
+               vstream->index_file = nullptr;
        }
        if (vstream->stream) {
                stream_put(vstream->stream);
-               vstream->stream = NULL;
+               vstream->stream = nullptr;
        }
        lttng_trace_chunk_put(vstream->stream_file.trace_chunk);
-       vstream->stream_file.trace_chunk = NULL;
+       vstream->stream_file.trace_chunk = nullptr;
 }
 
 static void viewer_stream_destroy(struct relay_viewer_stream *vstream)
@@ -59,7 +59,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                                                 struct lttng_trace_chunk *trace_chunk,
                                                 enum lttng_viewer_seek seek_t)
 {
-       struct relay_viewer_stream *vstream = NULL;
+       struct relay_viewer_stream *vstream = nullptr;
 
        ASSERT_LOCKED(stream->lock);
 
@@ -77,12 +77,12 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
 
        vstream->stream_file.trace_chunk = trace_chunk;
        vstream->path_name = lttng_strndup(stream->path_name, LTTNG_VIEWER_PATH_MAX);
-       if (vstream->path_name == NULL) {
+       if (vstream->path_name == nullptr) {
                PERROR("relay viewer path_name alloc");
                goto error;
        }
        vstream->channel_name = lttng_strndup(stream->channel_name, LTTNG_VIEWER_NAME_MAX);
-       if (vstream->channel_name == NULL) {
+       if (vstream->channel_name == nullptr) {
                PERROR("relay viewer channel_name alloc");
                goto error;
        }
@@ -135,8 +135,8 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
         * If we never received an index for the current stream, delay
         * the opening of the index, otherwise open it right now.
         */
-       if (stream->index_file == NULL) {
-               vstream->index_file = NULL;
+       if (stream->index_file == nullptr) {
+               vstream->index_file = nullptr;
        } else if (vstream->stream_file.trace_chunk) {
                const uint32_t connection_major = stream->trace->session->major;
                const uint32_t connection_minor = stream->trace->session->minor;
@@ -154,7 +154,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                        &vstream->index_file);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_NO_FILE) {
-                               vstream->index_file = NULL;
+                               vstream->index_file = nullptr;
                        } else {
                                goto error;
                        }
@@ -174,7 +174,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                                             stream->channel_name,
                                             stream->tracefile_size,
                                             vstream->current_tracefile_id,
-                                            NULL,
+                                            nullptr,
                                             file_path,
                                             sizeof(file_path));
                if (ret < 0) {
@@ -219,7 +219,7 @@ error:
                viewer_stream_release_composite_objects(vstream);
                viewer_stream_destroy(vstream);
        }
-       return NULL;
+       return nullptr;
 }
 
 static void viewer_stream_unpublish(struct relay_viewer_stream *vstream)
@@ -260,7 +260,7 @@ struct relay_viewer_stream *viewer_stream_get_by_id(uint64_t id)
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
-       struct relay_viewer_stream *vstream = NULL;
+       struct relay_viewer_stream *vstream = nullptr;
 
        rcu_read_lock();
        lttng_ht_lookup(viewer_streams_ht, &id, &iter);
@@ -271,7 +271,7 @@ struct relay_viewer_stream *viewer_stream_get_by_id(uint64_t id)
        }
        vstream = lttng::utils::container_of(node, &relay_viewer_stream::stream_n);
        if (!viewer_stream_get(vstream)) {
-               vstream = NULL;
+               vstream = nullptr;
        }
 end:
        rcu_read_unlock();
@@ -289,11 +289,11 @@ void viewer_stream_close_files(struct relay_viewer_stream *vstream)
 {
        if (vstream->index_file) {
                lttng_index_file_put(vstream->index_file);
-               vstream->index_file = NULL;
+               vstream->index_file = nullptr;
        }
        if (vstream->stream_file.handle) {
                fs_handle_close(vstream->stream_file.handle);
-               vstream->stream_file.handle = NULL;
+               vstream->stream_file.handle = nullptr;
        }
 }
 
@@ -369,7 +369,7 @@ end:
        return ret;
 }
 
-void print_viewer_streams(void)
+void print_viewer_streams()
 {
        struct lttng_ht_iter iter;
        struct relay_viewer_stream *vstream;
index 87e94bd82b7ad26e9db0fd99338d47576da07740..4c1e748df4d1c2078b626bb704707fba583bc697 100644 (file)
@@ -273,7 +273,7 @@ static int action_executor_notify_handler(struct action_executor *executor,
                work_item->client_list,
                work_item->trigger,
                work_item->evaluation,
-               work_item->object_creds.is_set ? &(work_item->object_creds.value) : NULL,
+               work_item->object_creds.is_set ? &(work_item->object_creds.value) : nullptr,
                client_handle_transmission_status,
                executor);
 }
@@ -518,7 +518,7 @@ static int action_executor_rotate_session_handler(struct action_executor *execut
        }
 
        cmd_ret = (lttng_error_code) cmd_rotate_session(
-               session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+               session, nullptr, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
        switch (cmd_ret) {
        case LTTNG_OK:
                DBG("Successfully started rotation of session `%s` on behalf of trigger `%s`",
@@ -769,7 +769,7 @@ static void *action_executor_thread(void *_data)
                /* Execute item only if a trigger is registered. */
                lttng_trigger_lock(work_item->trigger);
                if (!lttng_trigger_is_registered(work_item->trigger)) {
-                       const char *trigger_name = NULL;
+                       const char *trigger_name = nullptr;
                        uid_t trigger_owner_uid;
                        enum lttng_trigger_status trigger_status;
 
@@ -813,7 +813,7 @@ static void *action_executor_thread(void *_data)
        rcu_unregister_thread();
        health_unregister(the_health_sessiond);
 
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_action_executor_thread(void *_data)
@@ -847,8 +847,8 @@ struct action_executor *action_executor_create(struct notification_thread_handle
        }
 
        CDS_INIT_LIST_HEAD(&executor->work.list);
-       pthread_cond_init(&executor->work.cond, NULL);
-       pthread_mutex_init(&executor->work.lock, NULL);
+       pthread_cond_init(&executor->work.cond, nullptr);
+       pthread_mutex_init(&executor->work.lock, nullptr);
        executor->notification_thread_handle = handle;
 
        executor->thread = lttng_thread_create(THREAD_NAME,
@@ -933,7 +933,7 @@ action_executor_enqueue_trigger(struct action_executor *executor,
 
        /* Ownership transferred to the work item. */
        work_item->evaluation = evaluation;
-       evaluation = NULL;
+       evaluation = nullptr;
 
        work_item->client_list = client_list;
        work_item->object_creds.is_set = !!object_creds;
@@ -978,10 +978,10 @@ static int add_action_to_subitem_array(struct lttng_action *action,
 {
        int ret = 0;
        enum lttng_action_type type = lttng_action_get_type(action);
-       const char *session_name = NULL;
+       const char *session_name = nullptr;
        enum lttng_action_status status;
        struct action_work_subitem subitem = {
-               .action = NULL,
+               .action = nullptr,
                .context = {
                        .session_id = LTTNG_OPTIONAL_INIT_UNSET,
                },
@@ -997,7 +997,7 @@ static int add_action_to_subitem_array(struct lttng_action *action,
                LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
 
                for (i = 0; i < count; i++) {
-                       struct lttng_action *inner_action = NULL;
+                       struct lttng_action *inner_action = nullptr;
 
                        inner_action = lttng_action_list_borrow_mutable_at_index(action, i);
                        LTTNG_ASSERT(inner_action);
@@ -1049,7 +1049,7 @@ static int add_action_to_subitem_array(struct lttng_action *action,
         * now we leave the decision to skip to the action executor for sake of
         * simplicity and consistency.
         */
-       if (session_name != NULL) {
+       if (session_name != nullptr) {
                uint64_t session_id;
 
                /*
index c3d76896cdbf54b0fdf2e55acb44519e6a30af17..6abcb8fb34669587d8e091d47fb24b8f05bc5267 100644 (file)
@@ -99,11 +99,11 @@ static void update_agent_app(const struct agent_app *app)
 /*
  * Create and init socket from uri.
  */
-static struct lttcomm_sock *init_tcp_socket(void)
+static struct lttcomm_sock *init_tcp_socket()
 {
        int ret;
-       struct lttng_uri *uri = NULL;
-       struct lttcomm_sock *sock = NULL;
+       struct lttng_uri *uri = nullptr;
+       struct lttcomm_sock *sock = nullptr;
        unsigned int port;
        bool bind_succeeded = false;
 
@@ -118,7 +118,7 @@ static struct lttcomm_sock *init_tcp_socket(void)
 
        sock = lttcomm_alloc_sock_from_uri(uri);
        uri_free(uri);
-       if (sock == NULL) {
+       if (sock == nullptr) {
                ERR("agent allocating TCP socket");
                goto error;
        }
@@ -178,7 +178,7 @@ error:
        if (sock) {
                lttcomm_destroy_sock(sock);
        }
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -302,7 +302,7 @@ static int accept_agent_connection(struct lttcomm_sock *reg_sock,
             new_sock->fd);
 
        *agent_app_socket = new_sock;
-       new_sock = NULL;
+       new_sock = nullptr;
        ret = 0;
        goto end;
 
@@ -313,7 +313,7 @@ end:
        return ret;
 }
 
-bool agent_tracing_is_enabled(void)
+bool agent_tracing_is_enabled()
 {
        int enabled;
 
@@ -407,7 +407,7 @@ static void *thread_agent_management(void *data)
                goto error;
        }
 
-       while (1) {
+       while (true) {
                DBG3("Manage agent polling");
 
                /* Inifinite blocking call, waiting for transmission */
@@ -440,7 +440,7 @@ static void *thread_agent_management(void *data)
                        /* Activity on the registration socket. */
                        if (revents & LPOLLIN) {
                                struct agent_app_id new_app_id;
-                               struct agent_app *new_app = NULL;
+                               struct agent_app *new_app = nullptr;
                                struct lttcomm_sock *new_app_socket;
                                int new_app_socket_fd;
 
@@ -464,7 +464,7 @@ static void *thread_agent_management(void *data)
                                        continue;
                                }
                                new_app_socket_fd = new_app_socket->fd;
-                               new_app_socket = NULL;
+                               new_app_socket = nullptr;
 
                                /*
                                 * Since this is a command socket (write then
@@ -532,7 +532,7 @@ error_poll_create:
        DBG("Cleaning up and stopping.");
        rcu_thread_offline();
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_agent_management_thread(void *data)
@@ -552,7 +552,7 @@ static void cleanup_agent_management_thread(void *data)
        free(notifiers);
 }
 
-bool launch_agent_management_thread(void)
+bool launch_agent_management_thread()
 {
        struct thread_notifiers *notifiers;
        struct lttng_thread *thread;
index 323c673735ee8e6005fddf27d0c3a42acc7243f6..13bb268bc0fd0109a95785b0f5844539b7ccc569 100644 (file)
@@ -311,8 +311,8 @@ static ssize_t list_events(struct agent_app *app, struct lttng_event **events)
        uint32_t nb_event;
        size_t data_size;
        uint32_t reply_ret_code;
-       struct lttng_event *tmp_events = NULL;
-       struct lttcomm_agent_list_reply *reply = NULL;
+       struct lttng_event *tmp_events = nullptr;
+       struct lttcomm_agent_list_reply *reply = nullptr;
        struct lttcomm_agent_list_reply_hdr reply_hdr;
 
        LTTNG_ASSERT(app);
@@ -713,7 +713,7 @@ static void destroy_app_ctx(struct agent_app_ctx *ctx)
 
 static struct agent_app_ctx *create_app_ctx(const struct lttng_event_context *ctx)
 {
-       struct agent_app_ctx *agent_ctx = NULL;
+       struct agent_app_ctx *agent_ctx = nullptr;
 
        if (!ctx) {
                goto end;
@@ -729,7 +729,7 @@ static struct agent_app_ctx *create_app_ctx(const struct lttng_event_context *ct
        agent_ctx->ctx_name = strdup(ctx->u.app_ctx.ctx_name);
        if (!agent_ctx->provider_name || !agent_ctx->ctx_name) {
                destroy_app_ctx(agent_ctx);
-               agent_ctx = NULL;
+               agent_ctx = nullptr;
        }
 end:
        return agent_ctx;
@@ -876,7 +876,7 @@ int agent_list_events(struct lttng_event **events, enum lttng_domain_type domain
        int ret;
        size_t nbmem, count = 0;
        struct agent_app *app;
-       struct lttng_event *tmp_events = NULL;
+       struct lttng_event *tmp_events = nullptr;
        struct lttng_ht_iter iter;
 
        LTTNG_ASSERT(events);
@@ -993,7 +993,7 @@ struct agent_app *agent_find_app_by_sock(int sock)
 
        lttng_ht_lookup(the_agent_apps_ht_by_sock, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                goto error;
        }
        app = lttng::utils::container_of(node, &agent_app::node);
@@ -1003,7 +1003,7 @@ struct agent_app *agent_find_app_by_sock(int sock)
 
 error:
        DBG3("Agent app NOT found by sock %d.", sock);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1111,7 +1111,7 @@ struct agent *agent_create(enum lttng_domain_type domain)
        ret = agent_init(agt);
        if (ret < 0) {
                free(agt);
-               agt = NULL;
+               agt = nullptr;
                goto error;
        }
 
@@ -1131,7 +1131,7 @@ struct agent_event *agent_create_event(const char *name,
                                       struct lttng_bytecode *filter,
                                       char *filter_expression)
 {
-       struct agent_event *event = NULL;
+       struct agent_event *event = nullptr;
 
        DBG3("Agent create new event with name %s, loglevel type %d, \
                        loglevel value %d and filter %s",
@@ -1182,7 +1182,7 @@ void agent_add_event(struct agent_event *event, struct agent *agt)
 int agent_add_context(const struct lttng_event_context *ctx, struct agent *agt)
 {
        int ret = LTTNG_OK;
-       struct agent_app_ctx *agent_ctx = NULL;
+       struct agent_app_ctx *agent_ctx = nullptr;
 
        LTTNG_ASSERT(ctx);
        LTTNG_ASSERT(agt);
@@ -1364,7 +1364,7 @@ struct agent_event *agent_find_event(const char *name,
                        &key,
                        &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                goto error;
        }
 
@@ -1373,7 +1373,7 @@ struct agent_event *agent_find_event(const char *name,
 
 error:
        DBG3("Agent event NOT found %s.", name);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1444,7 +1444,7 @@ void agent_destroy(struct agent *agt)
 /*
  * Allocate agent_apps_ht_by_sock.
  */
-int agent_app_ht_alloc(void)
+int agent_app_ht_alloc()
 {
        the_agent_apps_ht_by_sock = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
        return the_agent_apps_ht_by_sock ? 0 : -1;
@@ -1479,7 +1479,7 @@ void agent_destroy_app_by_sock(int sock)
 /*
  * Clean-up the agent app hash table and destroy it.
  */
-void agent_app_ht_clean(void)
+void agent_app_ht_clean()
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
@@ -1560,7 +1560,7 @@ void agent_update(const struct agent *agt, const struct agent_app *app)
  * Allocate the per-event notifier domain agent hash table. It is lazily
  * populated as domains are used.
  */
-int agent_by_event_notifier_domain_ht_create(void)
+int agent_by_event_notifier_domain_ht_create()
 {
        the_trigger_agents_ht_by_domain = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        return the_trigger_agents_ht_by_domain ? 0 : -1;
@@ -1569,7 +1569,7 @@ int agent_by_event_notifier_domain_ht_create(void)
 /*
  * Clean-up the per-event notifier domain agent hash table and destroy it.
  */
-void agent_by_event_notifier_domain_ht_destroy(void)
+void agent_by_event_notifier_domain_ht_destroy()
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
@@ -1593,7 +1593,7 @@ void agent_by_event_notifier_domain_ht_destroy(void)
 
 struct agent *agent_find_by_event_notifier_domain(enum lttng_domain_type domain_type)
 {
-       struct agent *agt = NULL;
+       struct agent *agt = nullptr;
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
        const uint64_t key = (uint64_t) domain_type;
index 7d00b435d7e05b10b453783fc61b5c2242ca6ed7..39ca20279059c3b71522dec1b40c34423d52f54d 100644 (file)
@@ -77,7 +77,7 @@ static unsigned long ht_hash_reg_uid(const void *_key, unsigned long seed)
 /*
  * Initialize global buffer per UID registry. Should only be called ONCE!.
  */
-void buffer_reg_init_uid_registry(void)
+void buffer_reg_init_uid_registry()
 {
        /* Should be called once. */
        LTTNG_ASSERT(!buffer_registry_uid);
@@ -103,7 +103,7 @@ int buffer_reg_uid_create(uint64_t session_id,
                          const char *shm_path)
 {
        int ret = 0;
-       struct buffer_reg_uid *reg = NULL;
+       struct buffer_reg_uid *reg = nullptr;
 
        LTTNG_ASSERT(regp);
 
@@ -188,7 +188,7 @@ struct buffer_reg_uid *buffer_reg_uid_find(uint64_t session_id, uint32_t bits_pe
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
-       struct buffer_reg_uid *reg = NULL, key;
+       struct buffer_reg_uid *reg = nullptr, key;
        struct lttng_ht *ht = buffer_registry_uid;
 
        ASSERT_RCU_READ_LOCKED();
@@ -218,7 +218,7 @@ end:
 /*
  * Initialize global buffer per PID registry. Should only be called ONCE!.
  */
-void buffer_reg_init_pid_registry(void)
+void buffer_reg_init_pid_registry()
 {
        /* Should be called once. */
        LTTNG_ASSERT(!buffer_registry_pid);
@@ -239,7 +239,7 @@ int buffer_reg_pid_create(uint64_t session_id,
                          const char *shm_path)
 {
        int ret = 0;
-       struct buffer_reg_pid *reg = NULL;
+       struct buffer_reg_pid *reg = nullptr;
 
        LTTNG_ASSERT(regp);
 
@@ -313,7 +313,7 @@ struct buffer_reg_pid *buffer_reg_pid_find(uint64_t session_id)
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
-       struct buffer_reg_pid *reg = NULL;
+       struct buffer_reg_pid *reg = nullptr;
        struct lttng_ht *ht = buffer_registry_pid;
 
        DBG3("Buffer registry per PID find id: %" PRIu64, session_id);
@@ -339,8 +339,8 @@ int buffer_reg_uid_consumer_channel_key(struct cds_list_head *buffer_reg_uid_lis
                                        uint64_t *consumer_chan_key)
 {
        struct lttng_ht_iter iter;
-       struct buffer_reg_uid *uid_reg = NULL;
-       struct buffer_reg_session *session_reg = NULL;
+       struct buffer_reg_uid *uid_reg = nullptr;
+       struct buffer_reg_session *session_reg = nullptr;
        struct buffer_reg_channel *reg_chan;
        int ret = -1;
 
@@ -388,7 +388,7 @@ int buffer_reg_channel_create(uint64_t key, struct buffer_reg_channel **regp)
 
        reg->key = key;
        CDS_INIT_LIST_HEAD(&reg->streams);
-       pthread_mutex_init(&reg->stream_list_lock, NULL);
+       pthread_mutex_init(&reg->stream_list_lock, nullptr);
 
        lttng_ht_node_init_u64(&reg->node, key);
        *regp = reg;
@@ -459,7 +459,7 @@ struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key, struct buffer_r
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
-       struct buffer_reg_channel *chan = NULL;
+       struct buffer_reg_channel *chan = nullptr;
        struct lttng_ht *ht;
 
        LTTNG_ASSERT(reg);
@@ -500,7 +500,7 @@ void buffer_reg_stream_destroy(struct buffer_reg_stream *regp, enum lttng_domain
        {
                int ret;
 
-               ret = ust_app_release_object(NULL, regp->obj.ust);
+               ret = ust_app_release_object(nullptr, regp->obj.ust);
                if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
                        ERR("Buffer reg stream release obj handle %d failed with ret %d",
                            regp->obj.ust->handle,
@@ -559,7 +559,7 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, enum lttng_doma
                }
 
                if (regp->obj.ust) {
-                       ret = ust_app_release_object(NULL, regp->obj.ust);
+                       ret = ust_app_release_object(nullptr, regp->obj.ust);
                        if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
                                ERR("Buffer reg channel release obj handle %d failed with ret %d",
                                    regp->obj.ust->handle,
@@ -733,7 +733,7 @@ void buffer_reg_pid_destroy(struct buffer_reg_pid *regp)
 /*
  * Destroy per PID and UID registry hash table.
  */
-void buffer_reg_destroy_registries(void)
+void buffer_reg_destroy_registries()
 {
        DBG3("Buffer registry destroy all registry");
        lttng_ht_destroy(buffer_registry_uid);
index 44c3fd0cf6beda8a394edc117f48c880133a0b44..96eed11c00c089a69ffd9b79c774b0dcfdba6d98 100644 (file)
@@ -31,10 +31,10 @@ struct lttng_channel *channel_new_default_attr(int dom, enum lttng_buffer_type t
 {
        struct lttng_channel *chan;
        const char *channel_name = DEFAULT_CHANNEL_NAME;
-       struct lttng_channel_extended *extended_attr = NULL;
+       struct lttng_channel_extended *extended_attr = nullptr;
 
        chan = zmalloc<lttng_channel>();
-       if (chan == NULL) {
+       if (chan == nullptr) {
                PERROR("zmalloc channel init");
                goto error_alloc;
        }
@@ -115,7 +115,7 @@ error:
        free(extended_attr);
        free(chan);
 error_alloc:
-       return NULL;
+       return nullptr;
 }
 
 void channel_attr_destroy(struct lttng_channel *channel)
@@ -139,7 +139,7 @@ int channel_kernel_disable(struct ltt_kernel_session *ksession, char *channel_na
        LTTNG_ASSERT(channel_name);
 
        kchan = trace_kernel_get_channel_by_name(channel_name, ksession);
-       if (kchan == NULL) {
+       if (kchan == nullptr) {
                ret = LTTNG_ERR_KERN_CHAN_NOT_FOUND;
                goto error;
        }
@@ -216,14 +216,14 @@ enum lttng_error_code channel_kernel_create(struct ltt_kernel_session *ksession,
                                            int kernel_pipe)
 {
        enum lttng_error_code ret_code;
-       struct lttng_channel *defattr = NULL;
+       struct lttng_channel *defattr = nullptr;
 
        LTTNG_ASSERT(ksession);
 
        /* Creating channel attributes if needed */
-       if (attr == NULL) {
+       if (attr == nullptr) {
                defattr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL, LTTNG_BUFFER_GLOBAL);
-               if (defattr == NULL) {
+               if (defattr == nullptr) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto error;
                }
@@ -321,17 +321,17 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
                                         enum lttng_buffer_type type)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
-       struct ltt_ust_channel *uchan = NULL;
-       struct lttng_channel *defattr = NULL;
+       struct ltt_ust_channel *uchan = nullptr;
+       struct lttng_channel *defattr = nullptr;
        enum lttng_domain_type domain = LTTNG_DOMAIN_UST;
        bool chan_published = false;
 
        LTTNG_ASSERT(usess);
 
        /* Creating channel attributes if needed */
-       if (attr == NULL) {
+       if (attr == nullptr) {
                defattr = channel_new_default_attr(LTTNG_DOMAIN_UST, type);
-               if (defattr == NULL) {
+               if (defattr == nullptr) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto error;
                }
@@ -420,7 +420,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
 
        /* Create UST channel */
        uchan = trace_ust_create_channel(attr, domain);
-       if (uchan == NULL) {
+       if (uchan == nullptr) {
                ret_code = LTTNG_ERR_FATAL;
                goto error;
        }
@@ -535,7 +535,7 @@ error:
 
 struct lttng_channel *trace_ust_channel_to_lttng_channel(const struct ltt_ust_channel *uchan)
 {
-       struct lttng_channel *channel = NULL, *ret = NULL;
+       struct lttng_channel *channel = nullptr, *ret = nullptr;
 
        channel = lttng_channel_create_internal();
        if (!channel) {
@@ -577,7 +577,7 @@ struct lttng_channel *trace_ust_channel_to_lttng_channel(const struct ltt_ust_ch
        lttng_channel_set_monitor_timer_interval(channel, uchan->monitor_timer_interval);
 
        ret = channel;
-       channel = NULL;
+       channel = nullptr;
 
 end:
        lttng_channel_destroy(channel);
index 03be82d65f1ae370a2fe55c69053de5038e84fd6..ced9925943b83d543676ce45d191806f6d8472f2 100644 (file)
@@ -56,7 +56,7 @@ static void cmd_clear_session_reply(const struct ltt_session *session, void *_re
 int cmd_clear_session(struct ltt_session *session, int *sock_fd)
 {
        int ret = LTTNG_OK;
-       struct cmd_clear_session_reply_context *reply_context = NULL;
+       struct cmd_clear_session_reply_context *reply_context = nullptr;
        bool session_was_active = false;
        struct ltt_kernel_session *ksession;
        struct ltt_ust_session *usess;
@@ -158,11 +158,11 @@ int cmd_clear_session(struct ltt_session *session, int *sock_fd)
                         * On success, ownership of reply_context has been
                         * passed to session_add_clear_notifier().
                         */
-                       reply_context = NULL;
+                       reply_context = nullptr;
                        *sock_fd = -1;
                }
                ret = cmd_rotate_session(
-                       session, NULL, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE);
+                       session, nullptr, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE);
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -172,7 +172,7 @@ int cmd_clear_session(struct ltt_session *session, int *sock_fd)
        }
        if (session_was_active) {
                /* Kernel tracing */
-               if (ksession != NULL) {
+               if (ksession != nullptr) {
                        DBG("Start kernel tracing session \"%s\"", session->name);
                        ret = start_kernel_session(ksession);
                        if (ret != LTTNG_OK) {
index 43201c71d5e0cb28ed5a5544886c755e3d694623..123d07f857c39b905e8d6bee338cb9f942d4dc74 100644 (file)
@@ -64,7 +64,7 @@ static void set_thread_status(bool running)
        sem_post(&thread_state.ready);
 }
 
-static bool wait_thread_status(void)
+static bool wait_thread_status()
 {
        DBG("Waiting for client thread to be ready");
        sem_wait(&thread_state.ready);
@@ -491,7 +491,7 @@ error:
 static int create_ust_session(struct ltt_session *session, const struct lttng_domain *domain)
 {
        int ret;
-       struct ltt_ust_session *lus = NULL;
+       struct ltt_ust_session *lus = nullptr;
 
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(domain);
@@ -512,7 +512,7 @@ static int create_ust_session(struct ltt_session *session, const struct lttng_do
        DBG("Creating UST session");
 
        lus = trace_ust_create_session(session->id);
-       if (lus == NULL) {
+       if (lus == nullptr) {
                ret = LTTNG_ERR_UST_SESS_FAIL;
                goto error;
        }
@@ -540,7 +540,7 @@ static int create_ust_session(struct ltt_session *session, const struct lttng_do
 
 error:
        free(lus);
-       session->ust_session = NULL;
+       session->ust_session = nullptr;
        return ret;
 }
 
@@ -578,7 +578,7 @@ static int create_kernel_session(struct ltt_session *session)
 
 error:
        trace_kernel_destroy_session(session->kernel_session);
-       session->kernel_session = NULL;
+       session->kernel_session = nullptr;
 error_create:
        return ret;
 }
@@ -618,7 +618,7 @@ static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx,
        ssize_t sock_recv_len;
        enum lttng_error_code ret_code;
        struct lttng_payload trigger_payload;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_trigger *trigger = nullptr;
 
        lttng_payload_init(&trigger_payload);
        trigger_len = (size_t) cmd_ctx->lsm.u.trigger.length;
@@ -688,7 +688,7 @@ static enum lttng_error_code receive_lttng_error_query(struct command_ctx *cmd_c
        ssize_t sock_recv_len;
        enum lttng_error_code ret_code;
        struct lttng_payload query_payload;
-       struct lttng_error_query *query = NULL;
+       struct lttng_error_query *query = nullptr;
 
        lttng_payload_init(&query_payload);
        query_len = (size_t) cmd_ctx->lsm.u.error_query.length;
@@ -760,10 +760,10 @@ static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx,
        ssize_t sock_recv_len;
        enum lttng_error_code ret_code;
        struct lttng_payload event_payload;
-       struct lttng_event *local_event = NULL;
-       char *local_filter_expression = NULL;
-       struct lttng_bytecode *local_bytecode = NULL;
-       struct lttng_event_exclusion *local_exclusion = NULL;
+       struct lttng_event *local_event = nullptr;
+       char *local_filter_expression = nullptr;
+       struct lttng_bytecode *local_bytecode = nullptr;
+       struct lttng_event_exclusion *local_exclusion = nullptr;
 
        lttng_payload_init(&event_payload);
        if (cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT) {
@@ -841,10 +841,10 @@ static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx,
        *out_exclusion = local_exclusion;
        *out_filter_expression = local_filter_expression;
        *out_bytecode = local_bytecode;
-       local_event = NULL;
-       local_exclusion = NULL;
-       local_filter_expression = NULL;
-       local_bytecode = NULL;
+       local_event = nullptr;
+       local_exclusion = nullptr;
+       local_filter_expression = nullptr;
+       local_bytecode = nullptr;
 
        ret_code = LTTNG_OK;
 
@@ -868,7 +868,7 @@ receive_lttng_event_context(const struct command_ctx *cmd_ctx,
        ssize_t sock_recv_len;
        enum lttng_error_code ret_code;
        struct lttng_payload event_context_payload;
-       struct lttng_event_context *context = NULL;
+       struct lttng_event_context *context = nullptr;
 
        lttng_payload_init(&event_context_payload);
 
@@ -911,7 +911,7 @@ receive_lttng_event_context(const struct command_ctx *cmd_ctx,
        }
 
        *out_event_context = context;
-       context = NULL;
+       context = nullptr;
        ret_code = LTTNG_OK;
 
 end:
@@ -926,14 +926,14 @@ end:
 static int
 setup_lttng_msg_no_cmd_header(struct command_ctx *cmd_ctx, void *payload_buf, size_t payload_len)
 {
-       return setup_lttng_msg(cmd_ctx, payload_buf, payload_len, NULL, 0);
+       return setup_lttng_msg(cmd_ctx, payload_buf, payload_len, nullptr, 0);
 }
 
 /*
  * Check if the current kernel tracer supports the session rotation feature.
  * Return 1 if it does, 0 otherwise.
  */
-static int check_rotate_compatible(void)
+static int check_rotate_compatible()
 {
        int ret = 1;
 
@@ -1095,7 +1095,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, int *sock_
                break;
        default:
                /* Setup lttng message with no payload */
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, NULL, 0);
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, nullptr, 0);
                if (ret < 0) {
                        /* This label does not try to unlock the session */
                        goto init_setup_error;
@@ -1125,7 +1125,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, int *sock_
                 */
                session_lock_list();
                cmd_ctx->session = session_find_by_name(cmd_ctx->lsm.session.name);
-               if (cmd_ctx->session == NULL) {
+               if (cmd_ctx->session == nullptr) {
                        ret = LTTNG_ERR_SESS_NOT_FOUND;
                        goto error;
                } else {
@@ -1199,7 +1199,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, int *sock_
 
                /* Need a session for kernel command */
                if (need_tracing_session) {
-                       if (cmd_ctx->session->kernel_session == NULL) {
+                       if (cmd_ctx->session->kernel_session == nullptr) {
                                ret = create_kernel_session(cmd_ctx->session);
                                if (ret != LTTNG_OK) {
                                        ret = LTTNG_ERR_KERN_SESS_FAIL;
@@ -1257,7 +1257,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, int *sock_
 
                if (need_tracing_session) {
                        /* Create UST session if none exist. */
-                       if (cmd_ctx->session->ust_session == NULL) {
+                       if (cmd_ctx->session->ust_session == nullptr) {
                                lttng_domain domain = cmd_ctx->lsm.domain;
                                ret = create_ust_session(cmd_ctx->session, &domain);
                                if (ret != LTTNG_OK) {
@@ -1392,7 +1392,7 @@ skip_domain:
        switch (cmd_ctx->lsm.cmd_type) {
        case LTTCOMM_SESSIOND_COMMAND_ADD_CONTEXT:
        {
-               struct lttng_event_context *event_context = NULL;
+               struct lttng_event_context *event_context = nullptr;
                const enum lttng_error_code ret_code =
                        receive_lttng_event_context(cmd_ctx, *sock, sock_error, &event_context);
 
@@ -1736,7 +1736,7 @@ skip_domain:
                }
 
                uris = calloc<lttng_uri>(nb_uri);
-               if (uris == NULL) {
+               if (uris == nullptr) {
                        ret = LTTNG_ERR_FATAL;
                        goto error;
                }
@@ -1790,7 +1790,7 @@ skip_domain:
        case LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS:
        {
                ssize_t nb_dom;
-               struct lttng_domain *domains = NULL;
+               struct lttng_domain *domains = nullptr;
 
                nb_dom = cmd_list_domains(cmd_ctx->session, &domains);
                if (nb_dom < 0) {
@@ -1996,7 +1996,7 @@ skip_domain:
        case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_LIST_OUTPUT:
        {
                ssize_t nb_output;
-               struct lttng_snapshot_output *outputs = NULL;
+               struct lttng_snapshot_output *outputs = nullptr;
 
                nb_output = cmd_snapshot_list_outputs(cmd_ctx->session, &outputs);
                if (nb_output < 0) {
@@ -2027,7 +2027,7 @@ skip_domain:
        case LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT:
        {
                struct lttng_dynamic_buffer payload;
-               struct lttng_session_descriptor *return_descriptor = NULL;
+               struct lttng_session_descriptor *return_descriptor = nullptr;
 
                lttng_dynamic_buffer_init(&payload);
                ret = cmd_create_session(cmd_ctx, *sock, &return_descriptor);
@@ -2250,7 +2250,7 @@ skip_domain:
        }
        case LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS:
        {
-               struct lttng_triggers *return_triggers = NULL;
+               struct lttng_triggers *return_triggers = nullptr;
                size_t original_payload_size;
                size_t payload_size;
 
@@ -2290,7 +2290,7 @@ skip_domain:
                        .uid = LTTNG_OPTIONAL_INIT_VALUE(cmd_ctx->creds.uid),
                        .gid = LTTNG_OPTIONAL_INIT_VALUE(cmd_ctx->creds.gid),
                };
-               struct lttng_error_query_results *results = NULL;
+               struct lttng_error_query_results *results = nullptr;
                size_t original_payload_size;
                size_t payload_size;
 
@@ -2339,7 +2339,7 @@ skip_domain:
 error:
        if (cmd_ctx->reply_payload.buffer.size == 0) {
                DBG("Missing llm header, creating one.");
-               if (setup_lttng_msg_no_cmd_header(cmd_ctx, NULL, 0) < 0) {
+               if (setup_lttng_msg_no_cmd_header(cmd_ctx, nullptr, 0) < 0) {
                        goto setup_error;
                }
        }
@@ -2349,7 +2349,7 @@ setup_error:
        if (cmd_ctx->session) {
                session_unlock(cmd_ctx->session);
                session_put(cmd_ctx->session);
-               cmd_ctx->session = NULL;
+               cmd_ctx->session = nullptr;
        }
        if (need_tracing_session) {
                session_unlock_list();
@@ -2359,7 +2359,7 @@ init_setup_error:
        return ret;
 }
 
-static int create_client_sock(void)
+static int create_client_sock()
 {
        int ret, client_sock;
 
@@ -2428,7 +2428,7 @@ static void *thread_manage_clients(void *data)
 
        is_root = (getuid() == 0);
 
-       pthread_cleanup_push(thread_init_cleanup, NULL);
+       pthread_cleanup_push(thread_init_cleanup, nullptr);
 
        rcu_register_thread();
 
@@ -2477,13 +2477,13 @@ static void *thread_manage_clients(void *data)
 
        health_code_update();
 
-       while (1) {
+       while (true) {
                const struct cmd_completion_handler *cmd_completion_handler;
 
                cmd_ctx.creds.uid = UINT32_MAX;
                cmd_ctx.creds.gid = UINT32_MAX;
                cmd_ctx.creds.pid = 0;
-               cmd_ctx.session = NULL;
+               cmd_ctx.session = nullptr;
                lttng_payload_clear(&cmd_ctx.reply_payload);
                cmd_ctx.lttng_msg_size = 0;
 
@@ -2687,7 +2687,7 @@ error_create_poll:
        DBG("Client thread dying");
        lttng_payload_reset(&cmd_ctx.reply_payload);
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_client_thread(void *thread_data)
@@ -2698,11 +2698,11 @@ static bool shutdown_client_thread(void *thread_data)
        return notify_thread_pipe(write_fd) == 1;
 }
 
-struct lttng_thread *launch_client_thread(void)
+struct lttng_thread *launch_client_thread()
 {
        bool thread_running;
        struct lttng_pipe *client_quit_pipe;
-       struct lttng_thread *thread = NULL;
+       struct lttng_thread *thread = nullptr;
        int client_sock_fd = -1;
 
        sem_init(&thread_state.ready, 0, 0);
@@ -2727,7 +2727,7 @@ struct lttng_thread *launch_client_thread(void)
        }
        /* The client thread now owns the client sock fd and the quit pipe. */
        client_sock_fd = -1;
-       client_quit_pipe = NULL;
+       client_quit_pipe = nullptr;
 
        /*
         * This thread is part of the threads that need to be fully
@@ -2746,5 +2746,5 @@ error:
        }
        lttng_thread_put(thread);
        cleanup_client_thread(client_quit_pipe);
-       return NULL;
+       return nullptr;
 }
index 30e771e1cc21f14c61e60fa3e9c4bf0d4ccdb7c5..388e056e0c15dc7a8534c60ae59043bbf108a357 100644 (file)
@@ -135,7 +135,7 @@ static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *ses
 static int build_network_session_path(char *dst, size_t size, struct ltt_session *session)
 {
        int ret, kdata_port, udata_port;
-       struct lttng_uri *kuri = NULL, *uuri = NULL, *uri = NULL;
+       struct lttng_uri *kuri = nullptr, *uuri = nullptr, *uri = nullptr;
        char tmp_uurl[PATH_MAX], tmp_urls[PATH_MAX];
 
        LTTNG_ASSERT(session);
@@ -156,7 +156,7 @@ static int build_network_session_path(char *dst, size_t size, struct ltt_session
                udata_port = session->ust_session->consumer->dst.net.data.port;
        }
 
-       if (uuri == NULL && kuri == NULL) {
+       if (uuri == nullptr && kuri == nullptr) {
                uri = &session->consumer->dst.net.control;
                kdata_port = session->consumer->dst.net.data.port;
        } else if (kuri && uuri) {
@@ -172,9 +172,9 @@ static int build_network_session_path(char *dst, size_t size, struct ltt_session
                } else {
                        uri = kuri;
                }
-       } else if (kuri && uuri == NULL) {
+       } else if (kuri && uuri == nullptr) {
                uri = kuri;
-       } else if (uuri && kuri == NULL) {
+       } else if (uuri && kuri == nullptr) {
                uri = uuri;
        }
 
@@ -358,7 +358,7 @@ static enum lttng_error_code list_lttng_agent_events(struct agent *agt,
                tmp_event->loglevel_type = event->loglevel_type;
 
                ret = lttng_event_serialize(
-                       tmp_event, 0, NULL, event->filter_expression, 0, NULL, reply_payload);
+                       tmp_event, 0, nullptr, event->filter_expression, 0, nullptr, reply_payload);
                lttng_event_destroy(tmp_event);
                if (ret) {
                        ret_code = LTTNG_ERR_FATAL;
@@ -400,7 +400,7 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
 
        lttng_ht_lookup(ust_global->channels, (void *) channel_name, &iter);
        node = lttng_ht_iter_get_node_str(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                ret_code = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                goto error;
        }
@@ -424,7 +424,7 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
        DBG3("Listing UST global %d events", *nb_events);
 
        cds_lfht_for_each_entry (uchan->events->ht, &iter.iter, uevent, node.node) {
-               struct lttng_event *tmp_event = NULL;
+               struct lttng_event *tmp_event = nullptr;
 
                if (uevent->internal) {
                        /* This event should remain hidden from clients */
@@ -485,10 +485,10 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
                ret = lttng_event_serialize(tmp_event,
                                            uevent->exclusion ? uevent->exclusion->count : 0,
                                            uevent->exclusion ? (char **) uevent->exclusion->names :
-                                                               NULL,
+                                                               nullptr,
                                            uevent->filter_expression,
                                            0,
-                                           NULL,
+                                           nullptr,
                                            reply_payload);
                lttng_event_destroy(tmp_event);
                if (ret) {
@@ -522,7 +522,7 @@ static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
        assert(reply_payload);
 
        kchan = trace_kernel_get_channel_by_name(channel_name, kernel_session);
-       if (kchan == NULL) {
+       if (kchan == nullptr) {
                ret_code = LTTNG_ERR_KERN_CHAN_NOT_FOUND;
                goto end;
        }
@@ -614,7 +614,7 @@ static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
                }
 
                ret = lttng_event_serialize(
-                       tmp_event, 0, NULL, event->filter_expression, 0, NULL, reply_payload);
+                       tmp_event, 0, nullptr, event->filter_expression, 0, nullptr, reply_payload);
                lttng_event_destroy(tmp_event);
                if (ret) {
                        ret_code = LTTNG_ERR_FATAL;
@@ -641,7 +641,7 @@ static enum lttng_error_code add_uri_to_consumer(const struct ltt_session *sessi
 
        LTTNG_ASSERT(uri);
 
-       if (consumer == NULL) {
+       if (consumer == nullptr) {
                DBG("No consumer detected. Don't add URI. Stopping.");
                ret_code = LTTNG_ERR_NO_CONSUMER;
                goto error;
@@ -740,7 +740,7 @@ static int init_kernel_tracing(struct ltt_kernel_session *session)
 
        rcu_read_lock();
 
-       if (session->consumer_fds_sent == 0 && session->consumer != NULL) {
+       if (session->consumer_fds_sent == 0 && session->consumer != nullptr) {
                cds_lfht_for_each_entry (
                        session->consumer->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
@@ -862,7 +862,7 @@ static enum lttng_error_code send_consumer_relayd_socket(unsigned int session_id
                                                         bool session_name_contains_creation_time)
 {
        int ret;
-       struct lttcomm_relayd_sock *rsock = NULL;
+       struct lttcomm_relayd_sock *rsock = nullptr;
        enum lttng_error_code status;
 
        /* Connect to relayd and make version check if uri is the control. */
@@ -1044,7 +1044,7 @@ int cmd_setup_relayd(struct ltt_session *session)
                                session->hostname,
                                session->base_path,
                                session->live_timer,
-                               current_chunk_id.is_set ? &current_chunk_id.value : NULL,
+                               current_chunk_id.is_set ? &current_chunk_id.value : nullptr,
                                session->creation_time,
                                session->name_contains_creation_time);
                        pthread_mutex_unlock(socket->lock);
@@ -1072,7 +1072,7 @@ int cmd_setup_relayd(struct ltt_session *session)
                                session->hostname,
                                session->base_path,
                                session->live_timer,
-                               current_chunk_id.is_set ? &current_chunk_id.value : NULL,
+                               current_chunk_id.is_set ? &current_chunk_id.value : nullptr,
                                session->creation_time,
                                session->name_contains_creation_time);
                        pthread_mutex_unlock(socket->lock);
@@ -1101,7 +1101,7 @@ int start_kernel_session(struct ltt_kernel_session *ksess)
        struct ltt_kernel_channel *kchan;
 
        /* Open kernel metadata */
-       if (ksess->metadata == NULL && ksess->output_traces) {
+       if (ksess->metadata == nullptr && ksess->output_traces) {
                ret = kernel_open_metadata(ksess);
                if (ret < 0) {
                        ret = LTTNG_ERR_KERN_META_FAIL;
@@ -1237,7 +1237,7 @@ int cmd_disable_channel(struct ltt_session *session,
                chan_ht = usess->domain_global.channels;
 
                uchan = trace_ust_find_channel_by_name(chan_ht, channel_name);
-               if (uchan == NULL) {
+               if (uchan == nullptr) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error;
                }
@@ -1270,7 +1270,7 @@ int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe)
        int ret;
        size_t channel_len;
        ssize_t sock_recv_len;
-       struct lttng_channel *channel = NULL;
+       struct lttng_channel *channel = nullptr;
        struct lttng_buffer_view view;
        struct lttng_dynamic_buffer channel_buffer;
        const struct lttng_domain command_domain = cmd_ctx->lsm.domain;
@@ -1319,7 +1319,7 @@ static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *ses
        struct ltt_ust_session *usess = session->ust_session;
        struct lttng_ht *chan_ht;
        size_t len;
-       struct lttng_channel *attr = NULL;
+       struct lttng_channel *attr = nullptr;
 
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(_attr);
@@ -1334,7 +1334,7 @@ static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *ses
        len = lttng_strnlen(attr->name, sizeof(attr->name));
 
        /* Validate channel name */
-       if (attr->name[0] == '.' || memchr(attr->name, '/', len) != NULL) {
+       if (attr->name[0] == '.' || memchr(attr->name, '/', len) != nullptr) {
                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                goto end;
        }
@@ -1390,7 +1390,7 @@ static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *ses
                struct ltt_kernel_channel *kchan;
 
                kchan = trace_kernel_get_channel_by_name(attr->name, session->kernel_session);
-               if (kchan == NULL) {
+               if (kchan == nullptr) {
                        /*
                         * Don't try to create a channel if the session has been started at
                         * some point in time before. The tracer does not allow it.
@@ -1456,7 +1456,7 @@ static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *ses
                chan_ht = usess->domain_global.channels;
 
                uchan = trace_ust_find_channel_by_name(chan_ht, attr->name);
-               if (uchan == NULL) {
+               if (uchan == nullptr) {
                        /*
                         * Don't try to create a channel if the session has been started at
                         * some point in time before. The tracer does not allow it.
@@ -1751,7 +1751,7 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
                }
 
                kchan = trace_kernel_get_channel_by_name(channel_name, ksess);
-               if (kchan == NULL) {
+               if (kchan == nullptr) {
                        ret = LTTNG_ERR_KERN_CHAN_NOT_FOUND;
                        goto error_unlock;
                }
@@ -1764,7 +1764,7 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
                case LTTNG_EVENT_FUNCTION:
                case LTTNG_EVENT_FUNCTION_ENTRY: /* fall-through */
                        if (event_name[0] == '\0') {
-                               ret = event_kernel_disable_event(kchan, NULL, event->type);
+                               ret = event_kernel_disable_event(kchan, nullptr, event->type);
                        } else {
                                ret = event_kernel_disable_event(kchan, event_name, event->type);
                        }
@@ -1803,7 +1803,7 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
                }
 
                uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, channel_name);
-               if (uchan == NULL) {
+               if (uchan == nullptr) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error_unlock;
                }
@@ -1912,7 +1912,7 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
 
                if (session->kernel_session->channel_count == 0) {
                        /* Create default channel */
-                       ret = channel_kernel_create(session->kernel_session, NULL, kwpipe);
+                       ret = channel_kernel_create(session->kernel_session, nullptr, kwpipe);
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -1957,7 +1957,7 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
                        struct lttng_channel *attr;
                        /* Create default channel */
                        attr = channel_new_default_attr(domain, usess->buffer_type);
-                       if (attr == NULL) {
+                       if (attr == nullptr) {
                                ret = LTTNG_ERR_FATAL;
                                goto error;
                        }
@@ -2055,7 +2055,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                             bool internal_event)
 {
        int ret = 0, channel_created = 0;
-       struct lttng_channel *attr = NULL;
+       struct lttng_channel *attr = nullptr;
 
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(event);
@@ -2098,9 +2098,9 @@ static int _cmd_enable_event(struct ltt_session *session,
                }
 
                kchan = trace_kernel_get_channel_by_name(channel_name, session->kernel_session);
-               if (kchan == NULL) {
+               if (kchan == nullptr) {
                        attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL, LTTNG_BUFFER_GLOBAL);
-                       if (attr == NULL) {
+                       if (attr == nullptr) {
                                ret = LTTNG_ERR_FATAL;
                                goto error;
                        }
@@ -2118,7 +2118,7 @@ static int _cmd_enable_event(struct ltt_session *session,
 
                /* Get the newly created kernel channel pointer */
                kchan = trace_kernel_get_channel_by_name(channel_name, session->kernel_session);
-               if (kchan == NULL) {
+               if (kchan == nullptr) {
                        /* This sould not happen... */
                        ret = LTTNG_ERR_FATAL;
                        goto error;
@@ -2127,8 +2127,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                switch (event->type) {
                case LTTNG_EVENT_ALL:
                {
-                       char *filter_expression_a = NULL;
-                       struct lttng_bytecode *filter_a = NULL;
+                       char *filter_expression_a = nullptr;
+                       struct lttng_bytecode *filter_a = nullptr;
 
                        /*
                         * We need to duplicate filter_expression and filter,
@@ -2154,8 +2154,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                        event->type = LTTNG_EVENT_TRACEPOINT; /* Hack */
                        ret = event_kernel_enable_event(kchan, event, filter_expression, filter);
                        /* We have passed ownership */
-                       filter_expression = NULL;
-                       filter = NULL;
+                       filter_expression = nullptr;
+                       filter = nullptr;
                        if (ret != LTTNG_OK) {
                                if (channel_created) {
                                        /* Let's not leak a useless channel. */
@@ -2169,8 +2169,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                        ret = event_kernel_enable_event(
                                kchan, event, filter_expression_a, filter_a);
                        /* We have passed ownership */
-                       filter_expression_a = NULL;
-                       filter_a = NULL;
+                       filter_expression_a = nullptr;
+                       filter_a = nullptr;
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -2183,8 +2183,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                case LTTNG_EVENT_TRACEPOINT:
                        ret = event_kernel_enable_event(kchan, event, filter_expression, filter);
                        /* We have passed ownership */
-                       filter_expression = NULL;
-                       filter = NULL;
+                       filter_expression = nullptr;
+                       filter = nullptr;
                        if (ret != LTTNG_OK) {
                                if (channel_created) {
                                        /* Let's not leak a useless channel. */
@@ -2196,8 +2196,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                case LTTNG_EVENT_SYSCALL:
                        ret = event_kernel_enable_event(kchan, event, filter_expression, filter);
                        /* We have passed ownership */
-                       filter_expression = NULL;
-                       filter = NULL;
+                       filter_expression = nullptr;
+                       filter = nullptr;
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -2229,10 +2229,10 @@ static int _cmd_enable_event(struct ltt_session *session,
 
                /* Get channel from global UST domain */
                uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, channel_name);
-               if (uchan == NULL) {
+               if (uchan == nullptr) {
                        /* Create default channel */
                        attr = channel_new_default_attr(LTTNG_DOMAIN_UST, usess->buffer_type);
-                       if (attr == NULL) {
+                       if (attr == nullptr) {
                                ret = LTTNG_ERR_FATAL;
                                goto error;
                        }
@@ -2279,9 +2279,9 @@ static int _cmd_enable_event(struct ltt_session *session,
                ret = event_ust_enable_tracepoint(
                        usess, uchan, event, filter_expression, filter, exclusion, internal_event);
                /* We have passed ownership */
-               filter_expression = NULL;
-               filter = NULL;
-               exclusion = NULL;
+               filter_expression = nullptr;
+               filter = nullptr;
+               exclusion = nullptr;
                if (ret == LTTNG_ERR_UST_EVENT_ENABLED) {
                        goto already_enabled;
                } else if (ret != LTTNG_OK) {
@@ -2353,8 +2353,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                }
 
                {
-                       char *filter_expression_copy = NULL;
-                       struct lttng_bytecode *filter_copy = NULL;
+                       char *filter_expression_copy = nullptr;
+                       struct lttng_bytecode *filter_copy = nullptr;
 
                        if (filter) {
                                const size_t filter_size =
@@ -2385,7 +2385,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                                                        &uevent,
                                                        filter_expression_copy,
                                                        filter_copy,
-                                                       NULL,
+                                                       nullptr,
                                                        wpipe);
                }
 
@@ -2401,8 +2401,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                } else {
                        ret = event_agent_enable(usess, agt, event, filter, filter_expression);
                }
-               filter = NULL;
-               filter_expression = NULL;
+               filter = nullptr;
+               filter_expression = nullptr;
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -2460,9 +2460,9 @@ int cmd_enable_event(struct command_ctx *cmd_ctx,
                                exclusion,
                                wpipe,
                                false);
-       filter_expression = NULL;
-       bytecode = NULL;
-       exclusion = NULL;
+       filter_expression = nullptr;
+       bytecode = nullptr;
+       exclusion = nullptr;
        return ret;
 }
 
@@ -2500,7 +2500,7 @@ enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
        enum lttng_error_code ret_code;
        int ret;
        ssize_t i, nb_events = 0;
-       struct lttng_event *events = NULL;
+       struct lttng_event *events = nullptr;
        struct lttcomm_list_command_header reply_command_header = {};
        size_t reply_command_header_offset;
 
@@ -2546,7 +2546,8 @@ enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
        }
 
        for (i = 0; i < nb_events; i++) {
-               ret = lttng_event_serialize(&events[i], 0, NULL, NULL, 0, NULL, reply_payload);
+               ret = lttng_event_serialize(
+                       &events[i], 0, nullptr, nullptr, 0, nullptr, reply_payload);
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto error;
@@ -2580,7 +2581,7 @@ enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
        enum lttng_error_code ret_code;
        int ret;
        unsigned int i, nb_fields;
-       struct lttng_event_field *fields = NULL;
+       struct lttng_event_field *fields = nullptr;
        struct lttcomm_list_command_header reply_command_header = {};
        size_t reply_command_header_offset;
 
@@ -2646,7 +2647,7 @@ enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload)
        enum lttng_error_code ret_code;
        ssize_t nb_events, i;
        int ret;
-       struct lttng_event *events = NULL;
+       struct lttng_event *events = nullptr;
        struct lttcomm_list_command_header reply_command_header = {};
        size_t reply_command_header_offset;
 
@@ -2669,7 +2670,8 @@ enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload)
        }
 
        for (i = 0; i < nb_events; i++) {
-               ret = lttng_event_serialize(&events[i], 0, NULL, NULL, 0, NULL, reply_payload);
+               ret = lttng_event_serialize(
+                       &events[i], 0, nullptr, nullptr, 0, nullptr, reply_payload);
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -2760,14 +2762,15 @@ int cmd_start_trace(struct ltt_session *session)
                        struct lttng_trace_chunk *trace_chunk;
 
                        DBG("Creating initial trace chunk of session \"%s\"", session->name);
-                       trace_chunk = session_create_new_trace_chunk(session, NULL, NULL, NULL);
+                       trace_chunk =
+                               session_create_new_trace_chunk(session, nullptr, nullptr, nullptr);
                        if (!trace_chunk) {
                                ret = LTTNG_ERR_CREATE_DIR_FAIL;
                                goto error;
                        }
                        LTTNG_ASSERT(!session->current_trace_chunk);
                        ret = (lttng_error_code) session_set_trace_chunk(
-                               session, trace_chunk, NULL);
+                               session, trace_chunk, nullptr);
                        lttng_trace_chunk_put(trace_chunk);
                        if (ret) {
                                ret = LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER;
@@ -2787,7 +2790,7 @@ int cmd_start_trace(struct ltt_session *session)
                         * rotation should happen on reception of the command.
                         */
                        ret = (lttng_error_code) cmd_rotate_session(
-                               session, NULL, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
+                               session, nullptr, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -2795,7 +2798,7 @@ int cmd_start_trace(struct ltt_session *session)
        }
 
        /* Kernel tracing */
-       if (ksession != NULL) {
+       if (ksession != nullptr) {
                DBG("Start kernel tracing session %s", session->name);
                ret = (lttng_error_code) start_kernel_session(ksession);
                if (ret != LTTNG_OK) {
@@ -2916,9 +2919,9 @@ set_session_base_path_from_uris(struct ltt_session *session, size_t nb_uri, stru
                        continue;
                }
 
-               if (session->base_path != NULL) {
+               if (session->base_path != nullptr) {
                        free(session->base_path);
-                       session->base_path = NULL;
+                       session->base_path = nullptr;
                }
 
                /* Set session base_path */
@@ -3054,7 +3057,7 @@ set_session_output_from_descriptor(struct ltt_session *session,
        switch (session_type) {
        case LTTNG_SESSION_DESCRIPTOR_TYPE_SNAPSHOT:
        {
-               struct snapshot_output *new_output = NULL;
+               struct snapshot_output *new_output = nullptr;
 
                new_output = snapshot_output_alloc();
                if (!new_output) {
@@ -3064,7 +3067,7 @@ set_session_output_from_descriptor(struct ltt_session *session,
 
                ret = snapshot_output_init_with_uri(session,
                                                    DEFAULT_SNAPSHOT_MAX_SIZE,
-                                                   NULL,
+                                                   nullptr,
                                                    uris,
                                                    uri_count,
                                                    session->consumer,
@@ -3100,7 +3103,7 @@ cmd_create_session_from_descriptor(struct lttng_session_descriptor *descriptor,
        int ret;
        enum lttng_error_code ret_code;
        const char *session_name;
-       struct ltt_session *new_session = NULL;
+       struct ltt_session *new_session = nullptr;
        enum lttng_session_descriptor_status descriptor_status;
 
        session_lock_list();
@@ -3117,7 +3120,7 @@ cmd_create_session_from_descriptor(struct lttng_session_descriptor *descriptor,
        case LTTNG_SESSION_DESCRIPTOR_STATUS_OK:
                break;
        case LTTNG_SESSION_DESCRIPTOR_STATUS_UNSET:
-               session_name = NULL;
+               session_name = nullptr;
                break;
        default:
                ret_code = LTTNG_ERR_INVALID;
@@ -3145,7 +3148,7 @@ cmd_create_session_from_descriptor(struct lttng_session_descriptor *descriptor,
                        (void) notification_thread_command_remove_session(
                                the_notification_thread_handle, session->id);
                },
-               NULL);
+               nullptr);
        if (ret) {
                PERROR("Failed to add notification thread command to session's destroy notifiers: session name = %s",
                       new_session->name);
@@ -3168,7 +3171,9 @@ cmd_create_session_from_descriptor(struct lttng_session_descriptor *descriptor,
                 * not auto-generated.
                 */
                ret_code = lttng_session_descriptor_set_default_output(
-                       descriptor, session_name ? &new_session->creation_time : NULL, home_path);
+                       descriptor,
+                       session_name ? &new_session->creation_time : nullptr,
+                       home_path);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
@@ -3215,7 +3220,7 @@ enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
        struct lttng_dynamic_buffer payload;
        struct lttng_buffer_view home_dir_view;
        struct lttng_buffer_view session_descriptor_view;
-       struct lttng_session_descriptor *session_descriptor = NULL;
+       struct lttng_session_descriptor *session_descriptor = nullptr;
        enum lttng_error_code ret_code;
 
        lttng_dynamic_buffer_init(&payload);
@@ -3275,17 +3280,17 @@ enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
         * Sets the descriptor's auto-generated properties (name, output) if
         * needed.
         */
-       ret_code =
-               cmd_create_session_from_descriptor(session_descriptor,
-                                                  &cmd_ctx->creds,
-                                                  home_dir_view.size ? home_dir_view.data : NULL);
+       ret_code = cmd_create_session_from_descriptor(session_descriptor,
+                                                     &cmd_ctx->creds,
+                                                     home_dir_view.size ? home_dir_view.data :
+                                                                          nullptr);
        if (ret_code != LTTNG_OK) {
                goto error;
        }
 
        ret_code = LTTNG_OK;
        *return_descriptor = session_descriptor;
-       session_descriptor = NULL;
+       session_descriptor = nullptr;
 error:
        lttng_dynamic_buffer_reset(&payload);
        lttng_session_descriptor_destroy(session_descriptor);
@@ -3300,7 +3305,7 @@ static void cmd_destroy_session_reply(const struct ltt_session *session, void *_
                (cmd_destroy_session_reply_context *) _reply_context;
        struct lttng_dynamic_buffer payload;
        struct lttcomm_session_destroy_command_header cmd_header;
-       struct lttng_trace_archive_location *location = NULL;
+       struct lttng_trace_archive_location *location = nullptr;
        struct lttcomm_lttng_msg llm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION,
                .ret_code = reply_context->destruction_status,
@@ -3383,7 +3388,7 @@ int cmd_destroy_session(struct ltt_session *session,
 {
        int ret;
        enum lttng_error_code destruction_last_error = LTTNG_OK;
-       struct cmd_destroy_session_reply_context *reply_context = NULL;
+       struct cmd_destroy_session_reply_context *reply_context = nullptr;
 
        if (sock_fd) {
                reply_context = zmalloc<cmd_destroy_session_reply_context>();
@@ -3431,7 +3436,7 @@ int cmd_destroy_session(struct ltt_session *session,
                 * occurred during the session's lifetime.
                 */
                ret = cmd_rotate_session(
-                       session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+                       session, nullptr, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
                if (ret != LTTNG_OK) {
                        ERR("Failed to perform an implicit rotation as part of the destruction of session \"%s\": %s",
                            session->name,
@@ -3452,7 +3457,7 @@ int cmd_destroy_session(struct ltt_session *session,
                 * place.
                 */
                ret = cmd_rotate_session(
-                       session, NULL, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
+                       session, nullptr, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
                /*
                 * Rotation operations may not be supported by the kernel
                 * tracer. Hence, do not consider this implicit rotation as
@@ -3553,7 +3558,7 @@ int cmd_register_consumer(struct ltt_session *session,
                          struct consumer_data *cdata)
 {
        int ret, sock;
-       struct consumer_socket *socket = NULL;
+       struct consumer_socket *socket = nullptr;
 
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(cdata);
@@ -3580,7 +3585,7 @@ int cmd_register_consumer(struct ltt_session *session,
                cdata->cmd_sock = sock;
 
                socket = consumer_allocate_socket(&cdata->cmd_sock);
-               if (socket == NULL) {
+               if (socket == nullptr) {
                        ret = close(sock);
                        if (ret < 0) {
                                PERROR("close register consumer");
@@ -3591,13 +3596,13 @@ int cmd_register_consumer(struct ltt_session *session,
                }
 
                socket->lock = zmalloc<pthread_mutex_t>();
-               if (socket->lock == NULL) {
+               if (socket->lock == nullptr) {
                        PERROR("zmalloc pthread mutex");
                        ret = LTTNG_ERR_FATAL;
                        goto error;
                }
 
-               pthread_mutex_init(socket->lock, NULL);
+               pthread_mutex_init(socket->lock, nullptr);
                socket->registered = 1;
 
                rcu_read_lock();
@@ -3635,12 +3640,12 @@ ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **doma
        struct agent *agt;
        struct lttng_ht_iter iter;
 
-       if (session->kernel_session != NULL) {
+       if (session->kernel_session != nullptr) {
                DBG3("Listing domains found kernel domain");
                nb_dom++;
        }
 
-       if (session->ust_session != NULL) {
+       if (session->ust_session != nullptr) {
                DBG3("Listing domains found UST global domain");
                nb_dom++;
 
@@ -3659,12 +3664,12 @@ ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **doma
        }
 
        *domains = calloc<lttng_domain>(nb_dom);
-       if (*domains == NULL) {
+       if (*domains == nullptr) {
                ret = LTTNG_ERR_FATAL;
                goto error;
        }
 
-       if (session->kernel_session != NULL) {
+       if (session->kernel_session != nullptr) {
                (*domains)[index].type = LTTNG_DOMAIN_KERNEL;
 
                /* Kernel session buffer type is always GLOBAL */
@@ -3673,7 +3678,7 @@ ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **doma
                index++;
        }
 
-       if (session->ust_session != NULL) {
+       if (session->ust_session != nullptr) {
                (*domains)[index].type = LTTNG_DOMAIN_UST;
                (*domains)[index].buf_type = session->ust_session->buffer_type;
                index++;
@@ -3730,7 +3735,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
        {
                /* Kernel channels */
                struct ltt_kernel_channel *kchan;
-               if (session->kernel_session != NULL) {
+               if (session->kernel_session != nullptr) {
                        cds_list_for_each_entry (
                                kchan, &session->kernel_session->channel_list.head, list) {
                                uint64_t discarded_events, lost_packets;
@@ -3777,7 +3782,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                                         uchan,
                                         node.node) {
                        uint64_t discarded_events = 0, lost_packets = 0;
-                       struct lttng_channel *channel = NULL;
+                       struct lttng_channel *channel = nullptr;
                        struct lttng_channel_extended *extended;
 
                        channel = trace_ust_channel_to_lttng_channel(uchan);
@@ -3861,7 +3866,7 @@ enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
 
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
-               if (session->kernel_session != NULL) {
+               if (session->kernel_session != nullptr) {
                        ret_code = list_lttng_kernel_events(
                                channel_name, session->kernel_session, reply_payload, &nb_events);
                }
@@ -3869,7 +3874,7 @@ enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
                break;
        case LTTNG_DOMAIN_UST:
        {
-               if (session->ust_session != NULL) {
+               if (session->ust_session != nullptr) {
                        ret_code =
                                list_lttng_ust_global_events(channel_name,
                                                             &session->ust_session->domain_global,
@@ -4133,7 +4138,7 @@ error:
 int cmd_snapshot_del_output(struct ltt_session *session, const struct lttng_snapshot_output *output)
 {
        int ret;
-       struct snapshot_output *sout = NULL;
+       struct snapshot_output *sout = nullptr;
 
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(output);
@@ -4183,7 +4188,7 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
                                  struct lttng_snapshot_output **outputs)
 {
        int ret, idx = 0;
-       struct lttng_snapshot_output *list = NULL;
+       struct lttng_snapshot_output *list = nullptr;
        struct lttng_ht_iter iter;
        struct snapshot_output *output;
 
@@ -4252,7 +4257,7 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
        }
 
        *outputs = list;
-       list = NULL;
+       list = nullptr;
        ret = session->snapshot.nb_output;
 error:
        rcu_read_unlock();
@@ -4580,7 +4585,7 @@ enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_c
                lttng_trigger_get(trigger);
                *return_trigger = trigger;
                /* Ownership of trigger was transferred to caller. */
-               trigger = NULL;
+               trigger = nullptr;
        }
 end:
        return ret_code;
@@ -4649,7 +4654,7 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd
        const char *trigger_name;
        uid_t trigger_owner;
        enum lttng_trigger_status trigger_status;
-       struct lttng_trigger *sessiond_trigger = NULL;
+       struct lttng_trigger *sessiond_trigger = nullptr;
 
        trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
        trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
@@ -4735,7 +4740,7 @@ enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
 {
        int ret;
        enum lttng_error_code ret_code;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
 
        /* Get the set of triggers from the notification thread. */
        ret_code = notification_thread_command_list_triggers(
@@ -4751,7 +4756,7 @@ enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
        }
 
        *return_triggers = triggers;
-       triggers = NULL;
+       triggers = nullptr;
        ret_code = LTTNG_OK;
 end:
        lttng_triggers_destroy(triggers);
@@ -4766,12 +4771,12 @@ cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
 {
        enum lttng_error_code ret_code;
        const struct lttng_trigger *query_target_trigger;
-       const struct lttng_action *query_target_action = NULL;
-       struct lttng_trigger *matching_trigger = NULL;
+       const struct lttng_action *query_target_action = nullptr;
+       struct lttng_trigger *matching_trigger = nullptr;
        const char *trigger_name;
        uid_t trigger_owner;
        enum lttng_trigger_status trigger_status;
-       struct lttng_error_query_results *results = NULL;
+       struct lttng_error_query_results *results = nullptr;
 
        switch (lttng_error_query_get_target_type(query)) {
        case LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER:
@@ -4796,7 +4801,7 @@ cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
        }
 
        /* No longer needed. */
-       query_target_trigger = NULL;
+       query_target_trigger = nullptr;
 
        if (lttng_error_query_get_target_type(query) == LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION) {
                /* Get the sessiond-side version of the target action. */
@@ -4886,7 +4891,7 @@ cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
        }
 
        *_results = results;
-       results = NULL;
+       results = nullptr;
        ret_code = LTTNG_OK;
 end:
        lttng_trigger_put(matching_trigger);
@@ -4957,7 +4962,7 @@ static enum lttng_error_code set_relayd_for_snapshot(struct consumer_output *out
                        session->hostname,
                        base_path,
                        session->live_timer,
-                       current_chunk_id.is_set ? &current_chunk_id.value : NULL,
+                       current_chunk_id.is_set ? &current_chunk_id.value : nullptr,
                        session->creation_time,
                        session->name_contains_creation_time);
                pthread_mutex_unlock(socket->lock);
@@ -5103,10 +5108,10 @@ static enum lttng_error_code snapshot_record(struct ltt_session *session,
        int ret;
        enum lttng_error_code ret_code = LTTNG_OK;
        struct lttng_trace_chunk *snapshot_trace_chunk;
-       struct consumer_output *original_ust_consumer_output = NULL;
-       struct consumer_output *original_kernel_consumer_output = NULL;
-       struct consumer_output *snapshot_ust_consumer_output = NULL;
-       struct consumer_output *snapshot_kernel_consumer_output = NULL;
+       struct consumer_output *original_ust_consumer_output = nullptr;
+       struct consumer_output *original_kernel_consumer_output = nullptr;
+       struct consumer_output *snapshot_ust_consumer_output = nullptr;
+       struct consumer_output *snapshot_kernel_consumer_output = nullptr;
 
        ret = snprintf(snapshot_chunk_name,
                       sizeof(snapshot_chunk_name),
@@ -5188,9 +5193,9 @@ static enum lttng_error_code snapshot_record(struct ltt_session *session,
                goto error;
        }
        LTTNG_ASSERT(!session->current_trace_chunk);
-       ret = session_set_trace_chunk(session, snapshot_trace_chunk, NULL);
+       ret = session_set_trace_chunk(session, snapshot_trace_chunk, nullptr);
        lttng_trace_chunk_put(snapshot_trace_chunk);
-       snapshot_trace_chunk = NULL;
+       snapshot_trace_chunk = nullptr;
        if (ret) {
                ERR("Failed to set temporary trace chunk to record a snapshot of session \"%s\"",
                    session->name);
@@ -5226,7 +5231,7 @@ static enum lttng_error_code snapshot_record(struct ltt_session *session,
        }
 
 error_close_trace_chunk:
-       if (session_set_trace_chunk(session, NULL, &snapshot_trace_chunk)) {
+       if (session_set_trace_chunk(session, nullptr, &snapshot_trace_chunk)) {
                ERR("Failed to release the current trace chunk of session \"%s\"", session->name);
                ret_code = LTTNG_ERR_UNK;
        }
@@ -5234,7 +5239,7 @@ error_close_trace_chunk:
        if (session_close_trace_chunk(session,
                                      snapshot_trace_chunk,
                                      LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION,
-                                     NULL)) {
+                                     nullptr)) {
                /*
                 * Don't goto end; make sure the chunk is closed for the session
                 * to allow future snapshots.
@@ -5244,7 +5249,7 @@ error_close_trace_chunk:
        }
 
        lttng_trace_chunk_put(snapshot_trace_chunk);
-       snapshot_trace_chunk = NULL;
+       snapshot_trace_chunk = nullptr;
 error:
        if (original_ust_consumer_output) {
                session->ust_session->consumer = original_ust_consumer_output;
@@ -5273,7 +5278,7 @@ int cmd_snapshot_record(struct ltt_session *session,
        int ret;
        unsigned int snapshot_success = 0;
        char datetime[16];
-       struct snapshot_output *tmp_output = NULL;
+       struct snapshot_output *tmp_output = nullptr;
 
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(output);
@@ -5317,7 +5322,7 @@ int cmd_snapshot_record(struct ltt_session *session,
                                           output->data_url,
                                           session->consumer,
                                           tmp_output,
-                                          NULL);
+                                          nullptr);
                if (ret < 0) {
                        if (ret == -ENOMEM) {
                                cmd_ret = LTTNG_ERR_NOMEM;
@@ -5430,8 +5435,8 @@ int cmd_rotate_session(struct ltt_session *session,
        int ret;
        uint64_t ongoing_rotation_chunk_id;
        enum lttng_error_code cmd_ret = LTTNG_OK;
-       struct lttng_trace_chunk *chunk_being_archived = NULL;
-       struct lttng_trace_chunk *new_trace_chunk = NULL;
+       struct lttng_trace_chunk *chunk_being_archived = nullptr;
+       struct lttng_trace_chunk *new_trace_chunk = nullptr;
        enum lttng_trace_chunk_status chunk_status;
        bool failed_to_rotate = false;
        enum lttng_error_code rotation_fail_code = LTTNG_OK;
@@ -5498,7 +5503,8 @@ int cmd_rotate_session(struct ltt_session *session,
        }
 
        if (session->active) {
-               new_trace_chunk = session_create_new_trace_chunk(session, NULL, NULL, NULL);
+               new_trace_chunk =
+                       session_create_new_trace_chunk(session, nullptr, nullptr, nullptr);
                if (!new_trace_chunk) {
                        cmd_ret = LTTNG_ERR_CREATE_DIR_FAIL;
                        goto error;
@@ -5576,7 +5582,7 @@ int cmd_rotate_session(struct ltt_session *session,
        }
 
        session->chunk_being_archived = chunk_being_archived;
-       chunk_being_archived = NULL;
+       chunk_being_archived = nullptr;
        if (!quiet_rotation) {
                ret = notification_thread_command_session_rotation_ongoing(
                        the_notification_thread_handle, session->id, ongoing_rotation_chunk_id);
@@ -5931,18 +5937,18 @@ static enum lttng_error_code wait_on_path(void *path_data)
  * Returns a pointer to a handler to run on completion of a command.
  * Returns NULL if no handler has to be run for the last command executed.
  */
-const struct cmd_completion_handler *cmd_pop_completion_handler(void)
+const struct cmd_completion_handler *cmd_pop_completion_handler()
 {
        struct cmd_completion_handler *handler = current_completion_handler;
 
-       current_completion_handler = NULL;
+       current_completion_handler = nullptr;
        return handler;
 }
 
 /*
  * Init command subsystem.
  */
-void cmd_init(void)
+void cmd_init()
 {
        /*
         * Set network sequence index to 1 for streams to match a relayd
index daf2bd37168d883efaeca6af2d528202af50394b..ee7b4305ad813172d23238a547efd0dc2c033ed6 100644 (file)
@@ -125,7 +125,7 @@ struct lttng_condition *lttng_condition_copy(const struct lttng_condition *condi
 {
        int ret;
        struct lttng_payload copy_buffer;
-       struct lttng_condition *copy = NULL;
+       struct lttng_condition *copy = nullptr;
 
        lttng_payload_init(&copy_buffer);
 
@@ -140,7 +140,7 @@ struct lttng_condition *lttng_condition_copy(const struct lttng_condition *condi
 
                ret = lttng_condition_create_from_payload(&view, &copy);
                if (ret < 0) {
-                       copy = NULL;
+                       copy = nullptr;
                        goto end;
                }
        }
index 17d2248bec8f9f2c35a1bb6e90f92b694867335c..eba07eb919732fbc85c9a374d12b1cde145ee8c9 100644 (file)
@@ -83,7 +83,7 @@ char *setup_channel_trace_path(struct consumer_output *consumer,
        return pathname;
 error:
        free(pathname);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -319,7 +319,7 @@ int consumer_create_socket(struct consumer_data *data, struct consumer_output *o
 
        LTTNG_ASSERT(data);
 
-       if (output == NULL || data->cmd_sock < 0) {
+       if (output == nullptr || data->cmd_sock < 0) {
                /*
                 * Not an error. Possible there is simply not spawned consumer or it's
                 * disabled for the tracing session asking the socket.
@@ -330,9 +330,9 @@ int consumer_create_socket(struct consumer_data *data, struct consumer_output *o
        rcu_read_lock();
        socket = consumer_find_socket(data->cmd_sock, output);
        rcu_read_unlock();
-       if (socket == NULL) {
+       if (socket == nullptr) {
                socket = consumer_allocate_socket(&data->cmd_sock);
-               if (socket == NULL) {
+               if (socket == nullptr) {
                        ret = -1;
                        goto error;
                }
@@ -363,7 +363,7 @@ struct consumer_socket *consumer_find_socket_by_bitness(int bits,
                                                        const struct consumer_output *consumer)
 {
        int consumer_fd;
-       struct consumer_socket *socket = NULL;
+       struct consumer_socket *socket = nullptr;
 
        ASSERT_RCU_READ_LOCKED();
 
@@ -397,18 +397,18 @@ struct consumer_socket *consumer_find_socket(int key, const struct consumer_outp
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_ulong *node;
-       struct consumer_socket *socket = NULL;
+       struct consumer_socket *socket = nullptr;
 
        ASSERT_RCU_READ_LOCKED();
 
        /* Negative keys are lookup failures */
-       if (key < 0 || consumer == NULL) {
-               return NULL;
+       if (key < 0 || consumer == nullptr) {
+               return nullptr;
        }
 
        lttng_ht_lookup(consumer->socks, (void *) ((unsigned long) key), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node != NULL) {
+       if (node != nullptr) {
                socket = lttng::utils::container_of(node, &consumer_socket::node);
        }
 
@@ -420,12 +420,12 @@ struct consumer_socket *consumer_find_socket(int key, const struct consumer_outp
  */
 struct consumer_socket *consumer_allocate_socket(int *fd)
 {
-       struct consumer_socket *socket = NULL;
+       struct consumer_socket *socket = nullptr;
 
        LTTNG_ASSERT(fd);
 
        socket = zmalloc<consumer_socket>();
-       if (socket == NULL) {
+       if (socket == nullptr) {
                PERROR("zmalloc consumer socket");
                goto error;
        }
@@ -510,10 +510,10 @@ void consumer_destroy_socket(struct consumer_socket *sock)
  */
 struct consumer_output *consumer_create_output(enum consumer_dst_type type)
 {
-       struct consumer_output *output = NULL;
+       struct consumer_output *output = nullptr;
 
        output = zmalloc<consumer_output>();
-       if (output == NULL) {
+       if (output == nullptr) {
                PERROR("zmalloc consumer_output");
                goto error;
        }
@@ -599,7 +599,7 @@ struct consumer_output *consumer_copy_output(struct consumer_output *src)
        LTTNG_ASSERT(src);
 
        output = consumer_create_output(src->type);
-       if (output == NULL) {
+       if (output == nullptr) {
                goto end;
        }
        output->enabled = src->enabled;
@@ -619,7 +619,7 @@ end:
 
 error_put:
        consumer_output_put(output);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -646,7 +646,7 @@ int consumer_copy_sockets(struct consumer_output *dst, struct consumer_output *s
 
                /* Create new socket object. */
                copy_sock = consumer_allocate_socket(socket->fd_ptr);
-               if (copy_sock == NULL) {
+               if (copy_sock == nullptr) {
                        rcu_read_unlock();
                        ret = -ENOMEM;
                        goto error;
@@ -678,7 +678,7 @@ int consumer_set_network_uri(const struct ltt_session *session,
                             struct lttng_uri *uri)
 {
        int ret;
-       struct lttng_uri *dst_uri = NULL;
+       struct lttng_uri *dst_uri = nullptr;
 
        /* Code flow error safety net. */
        LTTNG_ASSERT(output);
@@ -1811,8 +1811,8 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
        int ret;
        enum lttng_trace_chunk_status chunk_status;
        struct lttng_credentials chunk_credentials;
-       const struct lttng_directory_handle *chunk_directory_handle = NULL;
-       struct lttng_directory_handle *domain_handle = NULL;
+       const struct lttng_directory_handle *chunk_directory_handle = nullptr;
+       struct lttng_directory_handle *domain_handle = nullptr;
        int domain_dirfd;
        const char *chunk_name;
        bool chunk_name_overridden;
index d76ec025f85d6773a31747b8092d562932897e6a..5d05c1cbf985327ae1dbd77336efe6683c14bf7d 100644 (file)
@@ -75,7 +75,7 @@ struct consumer_socket {
 };
 
 struct consumer_data {
-       consumer_data (lttng_consumer_type type_)
+       explicit consumer_data (lttng_consumer_type type_)
                : type(type_)
        {}
 
index cccf1c0d51b0bf80a3cad888ebae128cd4102c4c..b3b549187ecd57fcf5f7d989de230bc00ae6abbf 100644 (file)
@@ -17,8 +17,6 @@
 #include <common/sessiond-comm/sessiond-comm.hpp>
 
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
 #include <urcu/list.h>
 
@@ -51,7 +49,7 @@ static int add_kctx_all_channels(struct ltt_kernel_session *ksession,
 
                /* Ownership of kctx_copy is transferred to the callee. */
                ret = kernel_add_channel_context(kchan, kctx_copy);
-               kctx_copy = NULL;
+               kctx_copy = nullptr;
                if (ret != 0) {
                        goto error;
                }
@@ -80,7 +78,7 @@ static int add_kctx_to_channel(struct ltt_kernel_context *kctx, struct ltt_kerne
 
        /* Ownership of kctx is transferred to the callee. */
        ret = kernel_add_channel_context(kchan, kctx);
-       kctx = NULL;
+       kctx = nullptr;
        if (ret != 0) {
                goto error;
        }
@@ -100,7 +98,7 @@ static int add_uctx_to_channel(struct ltt_ust_session *usess,
                               const struct lttng_event_context *ctx)
 {
        int ret;
-       struct ltt_ust_context *uctx = NULL;
+       struct ltt_ust_context *uctx = nullptr;
 
        LTTNG_ASSERT(usess);
        LTTNG_ASSERT(uchan);
@@ -113,7 +111,7 @@ static int add_uctx_to_channel(struct ltt_ust_session *usess,
                        goto duplicate;
                }
        }
-       uctx = NULL;
+       uctx = nullptr;
 
        switch (domain) {
        case LTTNG_DOMAIN_JUL:
@@ -154,7 +152,7 @@ static int add_uctx_to_channel(struct ltt_ust_session *usess,
 
        /* Create ltt UST context */
        uctx = trace_ust_create_context(ctx);
-       if (uctx == NULL) {
+       if (uctx == nullptr) {
                ret = LTTNG_ERR_UST_CONTEXT_INVAL;
                goto error;
        }
@@ -197,7 +195,7 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
        LTTNG_ASSERT(ctx);
        LTTNG_ASSERT(channel_name);
 
-       kctx = trace_kernel_create_context(NULL);
+       kctx = trace_kernel_create_context(nullptr);
        if (!kctx) {
                ret = -LTTNG_ERR_NOMEM;
                goto error;
@@ -330,21 +328,21 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
        if (*channel_name == '\0') {
                ret = add_kctx_all_channels(ksession, kctx);
                /* Ownership of kctx is transferred to the callee. */
-               kctx = NULL;
+               kctx = nullptr;
                if (ret != LTTNG_OK) {
                        goto error;
                }
        } else {
                /* Get kernel channel */
                kchan = trace_kernel_get_channel_by_name(channel_name, ksession);
-               if (kchan == NULL) {
+               if (kchan == nullptr) {
                        ret = LTTNG_ERR_KERN_CHAN_NOT_FOUND;
                        goto error;
                }
 
                ret = add_kctx_to_channel(kctx, kchan);
                /* Ownership of kctx is transferred to the callee. */
-               kctx = NULL;
+               kctx = nullptr;
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -370,7 +368,7 @@ int context_ust_add(struct ltt_ust_session *usess,
        int ret = LTTNG_OK;
        struct lttng_ht_iter iter;
        struct lttng_ht *chan_ht;
-       struct ltt_ust_channel *uchan = NULL;
+       struct ltt_ust_channel *uchan = nullptr;
 
        LTTNG_ASSERT(usess);
        LTTNG_ASSERT(ctx);
@@ -383,7 +381,7 @@ int context_ust_add(struct ltt_ust_session *usess,
        /* Get UST channel if defined */
        if (channel_name[0] != '\0') {
                uchan = trace_ust_find_channel_by_name(chan_ht, channel_name);
-               if (uchan == NULL) {
+               if (uchan == nullptr) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error;
                }
index 2f583cdf89525d382a5d5a9d9b13efc33af4b0b8..6b6c6265b5c8e661b84fe8cc0e4ad961e113c42e 100644 (file)
@@ -15,6 +15,7 @@
 #include <vendor/nlohmann/json.hpp>
 
 #include <algorithm>
+#include <utility>
 
 namespace lsc = lttng::sessiond::ctf2;
 namespace lst = lttng::sessiond::trace;
@@ -102,16 +103,14 @@ const char *get_role_name(lst::static_length_blob_type::role role)
 namespace ctf2 {
 class trace_environment_visitor : public lst::trace_class_environment_visitor {
 public:
-       trace_environment_visitor()
-       {
-       }
+       trace_environment_visitor() = default;
 
-       virtual void visit(const lst::environment_field<int64_t>& field) override
+       void visit(const lst::environment_field<int64_t>& field) override
        {
                _visit(field);
        }
 
-       virtual void visit(const lst::environment_field<const char *>& field) override
+       void visit(const lst::environment_field<const char *>& field) override
        {
                _visit(field);
        }
@@ -135,9 +134,7 @@ private:
 class field_visitor : public lttng::sessiond::trace::field_visitor,
                      public lttng::sessiond::trace::type_visitor {
 public:
-       field_visitor()
-       {
-       }
+       field_visitor() = default;
 
        /* Only call once. */
        json::json move_fragment()
@@ -146,7 +143,7 @@ public:
        }
 
 private:
-       virtual void visit(const lst::field& field) override final
+       void visit(const lst::field& field) final
        {
                field_visitor field_type_visitor;
                field.get_type().accept(field_type_visitor);
@@ -155,7 +152,7 @@ private:
                _fragment["field-class"] = field_type_visitor.move_fragment();
        }
 
-       virtual void visit(const lst::integer_type& type) override final
+       void visit(const lst::integer_type& type) final
        {
                _fragment["type"] = type.signedness_ == lst::integer_type::signedness::SIGNED ?
                        "fixed-length-signed-integer" :
@@ -178,7 +175,7 @@ private:
                }
        }
 
-       virtual void visit(const lst::floating_point_type& type) override final
+       void visit(const lst::floating_point_type& type) final
        {
                _fragment["type"] = "fixed-length-floating-point-number";
                _fragment["length"] = type.exponent_digits + type.mantissa_digits;
@@ -235,17 +232,17 @@ private:
                _fragment["mappings"] = std::move(mappings_value);
        }
 
-       virtual void visit(const lst::signed_enumeration_type& type) override final
+       void visit(const lst::signed_enumeration_type& type) final
        {
                visit_enumeration(type);
        }
 
-       virtual void visit(const lst::unsigned_enumeration_type& type) override final
+       void visit(const lst::unsigned_enumeration_type& type) final
        {
                visit_enumeration(type);
        }
 
-       virtual void visit(const lst::static_length_array_type& type) override final
+       void visit(const lst::static_length_array_type& type) final
        {
                _fragment["type"] = "static-length-array";
 
@@ -260,7 +257,7 @@ private:
                _fragment["length"] = type.length;
        }
 
-       virtual void visit(const lst::dynamic_length_array_type& type) override final
+       void visit(const lst::dynamic_length_array_type& type) final
        {
                _fragment["type"] = "dynamic-length-array";
 
@@ -275,7 +272,7 @@ private:
                _fragment["length-field-location"] = to_json(type.length_field_location);
        }
 
-       virtual void visit(const lst::static_length_blob_type& type) override final
+       void visit(const lst::static_length_blob_type& type) final
        {
                _fragment["type"] = "static-length-blob";
                _fragment["length"] = type.length_bytes;
@@ -291,19 +288,18 @@ private:
                }
        }
 
-       virtual void visit(const lst::dynamic_length_blob_type& type) override final
+       void visit(const lst::dynamic_length_blob_type& type) final
        {
                _fragment["type"] = "dynamic-length-blob";
                _fragment["length-field-location"] = to_json(type.length_field_location);
        }
 
-       virtual void visit(const lst::null_terminated_string_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::null_terminated_string_type& type __attribute__((unused))) final
        {
                _fragment["type"] = "null-terminated-string";
        }
 
-       virtual void visit(const lst::structure_type& type) override final
+       void visit(const lst::structure_type& type) final
        {
                _fragment["type"] = "structure";
 
@@ -345,23 +341,23 @@ private:
                _fragment["options"] = std::move(options_value);
        }
 
-       virtual void visit(const lst::variant_type<int64_t>& type) override final
+       void visit(const lst::variant_type<int64_t>& type) final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::variant_type<uint64_t>& type) override final
+       void visit(const lst::variant_type<uint64_t>& type) final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::static_length_string_type& type) override final
+       void visit(const lst::static_length_string_type& type) final
        {
                _fragment["type"] = "static-length-string";
                _fragment["length"] = type.length;
        }
 
-       virtual void visit(const lst::dynamic_length_string_type& type) override final
+       void visit(const lst::dynamic_length_string_type& type) final
        {
                _fragment["type"] = "dynamic-length-string";
                _fragment["length-field-location"] = to_json(type.length_field_location);
@@ -375,7 +371,7 @@ private:
 
 lsc::trace_class_visitor::trace_class_visitor(
        lsc::append_metadata_fragment_function append_metadata_fragment) :
-       _append_metadata_fragment(append_metadata_fragment)
+       _append_metadata_fragment(std::move(append_metadata_fragment))
 {
 }
 
index cc2c7eb0ddb51aa18d74384c827f8e97a8b59012..7fa9c8f16c5fee0a00ec2b6d222d1907188bd056 100644 (file)
@@ -50,7 +50,7 @@ static void update_ust_app(int app_sock)
        rcu_read_lock();
        LTTNG_ASSERT(app_sock >= 0);
        app = ust_app_find_by_sock(app_sock);
-       if (app == NULL) {
+       if (app == nullptr) {
                /*
                 * Application can be unregistered before so
                 * this is possible hence simply stopping the
@@ -93,7 +93,7 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
        int ret, nb_fd = 0, i;
        unsigned int fd_added = 0;
        struct lttng_poll_event events;
-       struct ust_reg_wait_node *wait_node = NULL, *tmp_wait_node;
+       struct ust_reg_wait_node *wait_node = nullptr, *tmp_wait_node;
 
        LTTNG_ASSERT(wait_queue);
 
@@ -149,7 +149,7 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
                                 * cds_list_for_each_entry_safe which uses
                                 * __typeof__(*wait_node).
                                 */
-                               wait_node = NULL;
+                               wait_node = nullptr;
                                break;
                        } else {
                                ERR("Unexpected poll events %u for sock %d", revents, pollfd);
@@ -224,8 +224,8 @@ static void *thread_dispatch_ust_registration(void *data)
 {
        int ret, err = -1;
        struct cds_wfcq_node *node;
-       struct ust_command *ust_cmd = NULL;
-       struct ust_reg_wait_node *wait_node = NULL, *tmp_wait_node;
+       struct ust_command *ust_cmd = nullptr;
+       struct ust_reg_wait_node *wait_node = nullptr, *tmp_wait_node;
        struct ust_reg_wait_queue wait_queue = {
                .count = 0,
                .head = {},
@@ -257,8 +257,8 @@ static void *thread_dispatch_ust_registration(void *data)
                }
 
                do {
-                       struct ust_app *app = NULL;
-                       ust_cmd = NULL;
+                       struct ust_app *app = nullptr;
+                       ust_cmd = nullptr;
 
                        /*
                         * Make sure we don't have node(s) that have hung up before receiving
@@ -271,7 +271,7 @@ static void *thread_dispatch_ust_registration(void *data)
                        /* Dequeue command for registration */
                        node = cds_wfcq_dequeue_blocking(&notifiers->ust_cmd_queue->head,
                                                         &notifiers->ust_cmd_queue->tail);
-                       if (node == NULL) {
+                       if (node == nullptr) {
                                DBG("Woken up but nothing in the UST command queue");
                                /* Continue thread execution */
                                break;
@@ -300,7 +300,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                        }
                                        lttng_fd_put(LTTNG_FD_APPS, 1);
                                        free(ust_cmd);
-                                       ust_cmd = NULL;
+                                       ust_cmd = nullptr;
                                        goto error;
                                }
                                CDS_INIT_LIST_HEAD(&wait_node->head);
@@ -314,9 +314,9 @@ static void *thread_dispatch_ust_registration(void *data)
                                        }
                                        lttng_fd_put(LTTNG_FD_APPS, 1);
                                        free(wait_node);
-                                       wait_node = NULL;
+                                       wait_node = nullptr;
                                        free(ust_cmd);
-                                       ust_cmd = NULL;
+                                       ust_cmd = nullptr;
                                        continue;
                                }
                                /*
@@ -327,7 +327,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                wait_queue.count++;
 
                                free(ust_cmd);
-                               ust_cmd = NULL;
+                               ust_cmd = nullptr;
                                /*
                                 * We have to continue here since we don't have the notify
                                 * socket and the application MUST be added to the hash table
@@ -348,7 +348,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                                wait_queue.count--;
                                                app = wait_node->app;
                                                free(wait_node);
-                                               wait_node = NULL;
+                                               wait_node = nullptr;
                                                DBG3("UST app notify socket %d is set",
                                                     ust_cmd->sock);
                                                break;
@@ -368,7 +368,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                        lttng_fd_put(LTTNG_FD_APPS, 1);
                                }
                                free(ust_cmd);
-                               ust_cmd = NULL;
+                               ust_cmd = nullptr;
                        }
 
                        if (app) {
@@ -443,7 +443,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                rcu_read_unlock();
                                session_unlock_list();
                        }
-               } while (node != NULL);
+               } while (node != nullptr);
 
                health_poll_entry();
                /* Futex wait on queue. Blocking call on futex() */
@@ -466,7 +466,7 @@ error:
                /* Dequeue command for registration */
                node = cds_wfcq_dequeue_blocking(&notifiers->ust_cmd_queue->head,
                                                 &notifiers->ust_cmd_queue->tail);
-               if (node == NULL) {
+               if (node == nullptr) {
                        break;
                }
                ust_cmd = lttng::utils::container_of(node, &ust_command::node);
@@ -486,7 +486,7 @@ error_testpoint:
        }
        health_unregister(the_health_sessiond);
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_ust_dispatch_thread(void *data)
index 93ecca853af7a4ecdf76f841f499d7a9072273a1..4ee5f2088409c7a22f52040b06d2fff919cab2e4 100644 (file)
@@ -172,7 +172,7 @@ static void ust_error_accounting_entry_put(struct ust_error_accounting_entry *en
 /*
  * Put one reference to every UID entries.
  */
-static void put_ref_all_ust_error_accounting_entry(void)
+static void put_ref_all_ust_error_accounting_entry()
 {
        struct lttng_ht_iter iter;
        struct ust_error_accounting_entry *uid_entry;
@@ -190,7 +190,7 @@ static void put_ref_all_ust_error_accounting_entry(void)
 /*
  * Get one reference to every UID entries.
  */
-static void get_ref_all_ust_error_accounting_entry(void)
+static void get_ref_all_ust_error_accounting_entry()
 {
        struct lttng_ht_iter iter;
        struct ust_error_accounting_entry *uid_entry;
@@ -235,7 +235,7 @@ init_error_accounting_state(struct error_accounting_state *state, uint64_t index
 
 error_indices_ht:
        lttng_index_allocator_destroy(state->index_allocator);
-       state->index_allocator = NULL;
+       state->index_allocator = nullptr;
 end:
        return status;
 }
@@ -331,8 +331,8 @@ static struct ust_error_accounting_entry *ust_error_accounting_entry_find(struct
 
        lttng_ht_lookup(uid_ht, &key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node == NULL) {
-               entry = NULL;
+       if (node == nullptr) {
+               entry = nullptr;
        } else {
                bool got_ref;
 
@@ -340,7 +340,7 @@ static struct ust_error_accounting_entry *ust_error_accounting_entry_find(struct
 
                got_ref = ust_error_accounting_entry_get(entry);
                if (!got_ref) {
-                       entry = NULL;
+                       entry = nullptr;
                }
        }
 
@@ -354,10 +354,10 @@ static struct ust_error_accounting_entry *ust_error_accounting_entry_find(struct
 static struct ust_error_accounting_entry *
 ust_error_accounting_entry_create(const struct ust_app *app)
 {
-       int i, ret, *cpu_counter_fds = NULL;
+       int i, ret, *cpu_counter_fds = nullptr;
        struct lttng_ust_ctl_daemon_counter *daemon_counter;
        struct lttng_ust_abi_object_data *counter, **cpu_counters;
-       struct ust_error_accounting_entry *entry = NULL;
+       struct ust_error_accounting_entry *entry = nullptr;
        lttng_ust_ctl_counter_dimension dimension = {};
 
        dimension.size = ust_state.number_indices;
@@ -508,7 +508,7 @@ error_counter_cpus_alloc:
 error_counter_cpu_fds_alloc:
        free(entry);
 error:
-       entry = NULL;
+       entry = nullptr;
 end:
        free(cpu_counter_fds);
        return entry;
@@ -603,7 +603,7 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
         */
        rcu_read_lock();
        entry = ust_error_accounting_entry_find(error_counter_uid_ht, app);
-       if (entry == NULL) {
+       if (entry == nullptr) {
                /*
                 * Take the event notifier counter lock before creating the new
                 * entry to ensure that no event notifier is registered between
@@ -668,7 +668,7 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
        }
 
        for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
-               struct lttng_ust_abi_object_data *new_counter_cpu = NULL;
+               struct lttng_ust_abi_object_data *new_counter_cpu = nullptr;
 
                ret = lttng_ust_ctl_duplicate_ust_object_data(&new_counter_cpu,
                                                              entry->cpu_counters[i]);
@@ -700,10 +700,10 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
        }
 
        app->event_notifier_group.counter = new_counter;
-       new_counter = NULL;
+       new_counter = nullptr;
        app->event_notifier_group.nr_counter_cpu = entry->nr_counter_cpu_fds;
        app->event_notifier_group.counter_cpu = cpu_counters;
-       cpu_counters = NULL;
+       cpu_counters = nullptr;
        goto end_unlock;
 
 error_send_cpu_counter_data:
@@ -731,7 +731,7 @@ error_send_counter_data:
 error_duplicate_counter:
        ust_error_accounting_entry_put(entry);
 error_creating_entry:
-       app->event_notifier_group.counter = NULL;
+       app->event_notifier_group.counter = nullptr;
 end_unlock:
        rcu_read_unlock();
 end:
@@ -754,7 +754,7 @@ event_notifier_error_accounting_unregister_app(struct ust_app *app)
        }
 
        entry = ust_error_accounting_entry_find(error_counter_uid_ht, app);
-       if (entry == NULL) {
+       if (entry == nullptr) {
                ERR("Failed to find event notitifier error accounting entry on application teardown: pid = %d, application name = '%s'",
                    app->pid,
                    app->name);
@@ -1042,7 +1042,7 @@ static enum event_notifier_error_accounting_status create_error_counter_index_fo
        }
 
        index_entry = zmalloc<index_ht_entry>();
-       if (index_entry == NULL) {
+       if (index_entry == nullptr) {
                PERROR("Failed to allocate event notifier error counter hash table entry");
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM;
                goto end;
@@ -1335,7 +1335,7 @@ end:
        rcu_read_unlock();
 }
 
-void event_notifier_error_accounting_fini(void)
+void event_notifier_error_accounting_fini()
 {
        if (kernel_error_accounting_entry.error_counter_fd) {
                const int ret = close(kernel_error_accounting_entry.error_counter_fd);
index 4e52dfa9d5145882f48635cb399cf4aafff8ca78..0dd1e387fd84f5ded847ecdd999a209a1b081f8a 100644 (file)
@@ -80,7 +80,7 @@ int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
        cds_list_for_each_entry (kevent, &kchan->events_list.head, list) {
                if (type != LTTNG_EVENT_ALL && kevent->type != type)
                        continue;
-               if (event_name != NULL && strcmp(event_name, kevent->event->name)) {
+               if (event_name != nullptr && strcmp(event_name, kevent->event->name)) {
                        continue;
                }
                found++;
@@ -95,7 +95,7 @@ int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
            event_name ? event_name : "NULL",
            type);
 
-       if (event_name != NULL && !found) {
+       if (event_name != nullptr && !found) {
                ret = LTTNG_ERR_NO_EVENT;
        } else {
                ret = error ? LTTNG_ERR_KERN_DISABLE_FAIL : LTTNG_OK;
@@ -120,11 +120,11 @@ int event_kernel_enable_event(struct ltt_kernel_channel *kchan,
        LTTNG_ASSERT(event);
 
        kevent = trace_kernel_find_event(event->name, kchan, event->type, filter);
-       if (kevent == NULL) {
+       if (kevent == nullptr) {
                ret = kernel_create_event(event, kchan, filter_expression, filter);
                /* We have passed ownership */
-               filter_expression = NULL;
-               filter = NULL;
+               filter_expression = nullptr;
+               filter = nullptr;
                if (ret) {
                        goto end;
                }
@@ -184,9 +184,9 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
                ret = trace_ust_create_event(
                        event, filter_expression, filter, exclusion, internal_event, &uevent);
                /* We have passed ownership */
-               filter_expression = NULL;
-               filter = NULL;
-               exclusion = NULL;
+               filter_expression = nullptr;
+               filter = nullptr;
+               exclusion = nullptr;
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -275,7 +275,7 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
                        event_name,
                        &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("Trace UST event NOT found by name %s", event_name);
                ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
                goto error;
@@ -321,8 +321,8 @@ int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, struct ltt_
 {
        int ret, i, size, error = 0;
        struct lttng_ht_iter iter;
-       struct ltt_ust_event *uevent = NULL;
-       struct lttng_event *events = NULL;
+       struct ltt_ust_event *uevent = nullptr;
+       struct lttng_event *events = nullptr;
 
        LTTNG_ASSERT(usess);
        LTTNG_ASSERT(uchan);
@@ -419,7 +419,7 @@ static int add_filter_app_ctx(struct lttng_bytecode *bytecode,
                              struct agent *agt)
 {
        int ret = LTTNG_OK;
-       char *provider_name = NULL, *ctx_name = NULL;
+       char *provider_name = nullptr, *ctx_name = nullptr;
        struct bytecode_symbol_iterator *it = bytecode_symbol_iterator_create(bytecode);
 
        if (!it) {
@@ -460,7 +460,7 @@ static int add_filter_app_ctx(struct lttng_bytecode *bytecode,
 
                free(provider_name);
                free(ctx_name);
-               provider_name = ctx_name = NULL;
+               provider_name = ctx_name = nullptr;
        } while (bytecode_symbol_iterator_next(it) == 0);
 end:
        free(provider_name);
@@ -493,8 +493,8 @@ static int agent_enable(struct agent *agt,
                        ret = LTTNG_ERR_NOMEM;
                        goto error;
                }
-               filter = NULL;
-               filter_expression = NULL;
+               filter = nullptr;
+               filter_expression = nullptr;
                created = 1;
                LTTNG_ASSERT(!AGENT_EVENT_IS_ENABLED(aevent));
        }
@@ -576,10 +576,10 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
        const struct lttng_condition *condition;
        const struct lttng_event_rule *rule;
        const char *filter_expression;
-       char *filter_expression_copy = NULL;
+       char *filter_expression_copy = nullptr;
        const struct lttng_bytecode *filter_bytecode;
-       struct lttng_bytecode *filter_bytecode_copy = NULL;
-       struct lttng_event *event = NULL;
+       struct lttng_bytecode *filter_bytecode_copy = nullptr;
+       struct lttng_event *event = nullptr;
        uid_t trigger_owner_uid = 0;
        const char *trigger_name;
 
@@ -648,8 +648,8 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
 
        ret = agent_enable(agt, event, filter_bytecode_copy, filter_expression_copy);
        /* Ownership was passed even in case of error. */
-       filter_expression_copy = NULL;
-       filter_bytecode_copy = NULL;
+       filter_expression_copy = nullptr;
+       filter_bytecode_copy = nullptr;
 
 end:
        free(filter_expression_copy);
@@ -664,7 +664,7 @@ end:
  */
 const char *event_get_default_agent_ust_name(enum lttng_domain_type domain)
 {
-       const char *default_event_name = NULL;
+       const char *default_event_name = nullptr;
 
        switch (domain) {
        case LTTNG_DOMAIN_LOG4J:
@@ -733,8 +733,8 @@ static int event_agent_disable_one(struct ltt_ust_session *usess,
                                   struct agent_event *aevent)
 {
        int ret;
-       struct ltt_ust_event *uevent = NULL;
-       struct ltt_ust_channel *uchan = NULL;
+       struct ltt_ust_event *uevent = nullptr;
+       struct ltt_ust_channel *uchan = nullptr;
        const char *ust_event_name, *ust_channel_name;
 
        LTTNG_ASSERT(agt);
@@ -791,7 +791,7 @@ static int event_agent_disable_one(struct ltt_ust_session *usess,
                                      aevent->filter,
                                      LTTNG_UST_ABI_LOGLEVEL_ALL,
                                      -1,
-                                     NULL);
+                                     nullptr);
        /* If the agent event exists, it must be available on the UST side. */
        LTTNG_ASSERT(uevent);
 
@@ -839,7 +839,7 @@ int trigger_agent_disable(const struct lttng_trigger *trigger, struct agent *agt
        rcu_read_lock();
        aevent = agent_find_event_by_trigger(trigger, agt);
 
-       if (aevent == NULL) {
+       if (aevent == nullptr) {
                DBG2("Event agent NOT found by trigger %" PRIu64,
                     lttng_trigger_get_tracer_token(trigger));
                ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
@@ -879,7 +879,7 @@ int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, const
        agent_find_events_by_name(event_name, agt, &iter);
        node = lttng_ht_iter_get_node_str(&iter);
 
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("Event agent NOT found by name %s", event_name);
                ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
                goto end;
index 361b5c6b58bdda0b856154c4ff2bb59dd8dc76e7..ae63ccc06ad7c5b6bff887da22c13b44fe0a3cc0 100644 (file)
@@ -49,7 +49,7 @@ void lttng_fd_put(enum lttng_fd_type type __attribute__((unused)), unsigned int
        uatomic_sub(&fd_count, (long) nr);
 }
 
-void lttng_fd_init(void)
+void lttng_fd_init()
 {
        struct rlimit rlim;
        int ret;
index 5a0c584f22813197ac9a7e3686aee29e6536fa75..6a5fa162b702837649246920bdc5e1ac2b75355b 100644 (file)
@@ -47,9 +47,7 @@ lst::type::type(unsigned int in_alignment) : alignment{ in_alignment }
 {
 }
 
-lst::type::~type()
-{
-}
+lst::type::~type() = default;
 
 bool lst::type::operator==(const lst::type& other) const noexcept
 {
index 2e3a67bf42f23f39a2b4242a1817096daff92778..da1514f90825a7c37b2fba4d133e43b10faaba28 100644 (file)
@@ -75,7 +75,7 @@ public:
        const unsigned int alignment;
 
 protected:
-       type(unsigned int alignment);
+       explicit type(unsigned int alignment);
 
 private:
        virtual bool _is_equal(const type& rhs) const noexcept = 0;
@@ -138,9 +138,9 @@ public:
                        base base,
                        roles roles = {});
 
-       virtual type::cuptr copy() const override;
+       type::cuptr copy() const override;
 
-       virtual void accept(type_visitor& visitor) const override;
+       void accept(type_visitor& visitor) const override;
 
        const enum byte_order byte_order;
        const unsigned int size;
@@ -154,7 +154,7 @@ public:
        const roles roles_;
 
 protected:
-       virtual bool _is_equal(const type& other) const noexcept override;
+       bool _is_equal(const type& other) const noexcept override;
 };
 
 class floating_point_type : public type {
@@ -164,16 +164,16 @@ public:
                        unsigned int exponent_digits,
                        unsigned int mantissa_digits);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const enum byte_order byte_order;
        const unsigned int exponent_digits;
        const unsigned int mantissa_digits;
 
 private:
-       virtual bool _is_equal(const type& other) const noexcept override final;
+       bool _is_equal(const type& other) const noexcept final;
 };
 
 class enumeration_type : public integer_type {
@@ -185,7 +185,7 @@ protected:
                        enum base base,
                        integer_type::roles roles = {});
 
-       virtual void accept(type_visitor& visitor) const = 0;
+       void accept(type_visitor& visitor) const override = 0;
 };
 
 namespace details {
@@ -215,8 +215,8 @@ public:
        using range_t = enumeration_mapping_range<MappingIntegerType>;
 
        enumeration_mapping(const enumeration_mapping<MappingIntegerType>& other) = default;
-       enumeration_mapping(const enumeration_mapping<MappingIntegerType>&& other) :
-               name{std::move(other.name)}, range{other.range}
+       enumeration_mapping(const enumeration_mapping<MappingIntegerType>&& other) noexcept :
+               name{ std::move(other.name) }, range{ other.range }
        {
        }
 
@@ -273,18 +273,18 @@ public:
        {
        }
 
-       virtual type::cuptr copy() const override
+       type::cuptr copy() const override
        {
                return lttng::make_unique<typed_enumeration_type<MappingIntegerType>>(
                                alignment, byte_order, size, base_, mappings_, roles_);
        }
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const std::shared_ptr<const mappings> mappings_;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final
+       bool _is_equal(const type& base_other) const noexcept final
        {
                const auto& other = static_cast<const typed_enumeration_type<MappingIntegerType>&>(
                                base_other);
@@ -304,7 +304,7 @@ public:
        const type::cuptr element_type;
 
 protected:
-       virtual bool _is_equal(const type& base_other) const noexcept override;
+       bool _is_equal(const type& base_other) const noexcept override;
 };
 
 class static_length_array_type : public array_type {
@@ -313,14 +313,14 @@ public:
                        type::cuptr element_type,
                        uint64_t in_length);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const uint64_t length;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final;
+       bool _is_equal(const type& base_other) const noexcept final;
 };
 
 class dynamic_length_array_type : public array_type {
@@ -329,14 +329,14 @@ public:
                        type::cuptr element_type,
                        field_location length_field_location);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const field_location length_field_location;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final;
+       bool _is_equal(const type& base_other) const noexcept final;
 };
 
 class static_length_blob_type : public type {
@@ -350,29 +350,29 @@ public:
 
        static_length_blob_type(unsigned int alignment, uint64_t in_length_bytes, roles roles = {});
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const uint64_t length_bytes;
        const roles roles_;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final;
+       bool _is_equal(const type& base_other) const noexcept final;
 };
 
 class dynamic_length_blob_type : public type {
 public:
        dynamic_length_blob_type(unsigned int alignment, field_location length_field_location);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const field_location length_field_location;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final;
+       bool _is_equal(const type& base_other) const noexcept final;
 };
 
 class string_type : public type {
@@ -392,7 +392,7 @@ public:
        const encoding encoding_;
 
 protected:
-       virtual bool _is_equal(const type& base_other) const noexcept override;
+       bool _is_equal(const type& base_other) const noexcept override;
 };
 
 class static_length_string_type : public string_type {
@@ -400,14 +400,14 @@ public:
        static_length_string_type(
                        unsigned int alignment, enum encoding in_encoding, uint64_t length);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const uint64_t length;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final;
+       bool _is_equal(const type& base_other) const noexcept final;
 };
 
 class dynamic_length_string_type : public string_type {
@@ -416,23 +416,23 @@ public:
                        enum encoding in_encoding,
                        field_location length_field_location);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const field_location length_field_location;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final;
+       bool _is_equal(const type& base_other) const noexcept final;
 };
 
 class null_terminated_string_type : public string_type {
 public:
        null_terminated_string_type(unsigned int alignment, enum encoding in_encoding);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 };
 
 class structure_type : public type {
@@ -441,14 +441,14 @@ public:
 
        structure_type(unsigned int alignment, fields in_fields);
 
-       virtual type::cuptr copy() const override final;
+       type::cuptr copy() const final;
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const fields fields_;
 
 private:
-       virtual bool _is_equal(const type& base_other) const noexcept override final;
+       bool _is_equal(const type& base_other) const noexcept final;
 };
 
 template <typename MappingIntegerType>
@@ -474,7 +474,7 @@ public:
        {
        }
 
-       virtual type::cuptr copy() const override final
+       type::cuptr copy() const final
        {
                choices copy_of_choices;
 
@@ -488,7 +488,7 @@ public:
                        alignment, selector_field_location, std::move(copy_of_choices));
        }
 
-       virtual void accept(type_visitor& visitor) const override final;
+       void accept(type_visitor& visitor) const final;
 
        const field_location selector_field_location;
        const choices choices_;
@@ -509,7 +509,7 @@ private:
                                });
        }
 
-       virtual bool _is_equal(const type& base_other) const noexcept override final
+       bool _is_equal(const type& base_other) const noexcept final
        {
                const auto& other = static_cast<decltype(*this)&>(base_other);
 
index 2df5b1df0c047f7e15e29727d408a437d04dc719..3add6c9eb492dfa3ca36ba9c3f4000cab7ee8b99 100644 (file)
@@ -22,8 +22,8 @@ struct health_app *the_health_sessiond;
 
 struct notification_thread_handle *the_notification_thread_handle;
 
-struct lttng_ht *the_agent_apps_ht_by_sock = NULL;
-struct lttng_ht *the_trigger_agents_ht_by_domain = NULL;
+struct lttng_ht *the_agent_apps_ht_by_sock = nullptr;
+struct lttng_ht *the_trigger_agents_ht_by_domain = nullptr;
 
 struct lttng_kernel_abi_tracer_version the_kernel_tracer_version;
 struct lttng_kernel_abi_tracer_abi_version the_kernel_tracer_abi_version;
@@ -42,7 +42,7 @@ consumer_data the_ustconsumer32_data(LTTNG_CONSUMER32_UST);
 enum consumerd_state the_ust_consumerd_state;
 enum consumerd_state the_kernel_consumerd_state;
 
-static void __attribute__((constructor)) init_sessiond_uuid(void)
+static void __attribute__((constructor)) init_sessiond_uuid()
 {
        if (lttng_uuid_generate(the_sessiond_uuid)) {
                ERR("Failed to generate a session daemon UUID");
index 52f38e2d89df47145b5155e82644261c607ab2a4..455cc05d5ee1eea2236a87623e8c5154db77aa1a 100644 (file)
@@ -30,6 +30,6 @@ enum health_type_sessiond {
 /* Application health monitoring */
 extern struct health_app *the_health_sessiond;
 
-bool launch_health_management_thread(void);
+bool launch_health_management_thread();
 
 #endif /* HEALTH_SESSIOND_H */
index bd9d46bb6dc0f06b8197e6fe0dc2c8740893c683..dd3d9426d3f1eb6fec96713aa3462f9d1a7f54eb 100644 (file)
@@ -134,7 +134,7 @@ static void *thread_manage_health(void *data)
        }
 
        mark_thread_as_ready(notifiers);
-       while (1) {
+       while (true) {
                DBG("Health check ready");
 
                /* Infinite blocking call, waiting for transmission */
@@ -241,7 +241,7 @@ error:
 
        lttng_poll_clean(&events);
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_health_management_thread(void *data)
@@ -252,7 +252,7 @@ static bool shutdown_health_management_thread(void *data)
        return notify_thread_pipe(write_fd) == 1;
 }
 
-bool launch_health_management_thread(void)
+bool launch_health_management_thread()
 {
        struct thread_notifiers *notifiers;
        struct lttng_thread *thread;
index 15558f207c219d9294d318c40261c86d882dc7ec..5efe2c2ae146bcfb7e701c300dd8ce555f1db8b2 100644 (file)
@@ -27,7 +27,7 @@ static char *create_channel_path(struct consumer_output *consumer, size_t *consu
 {
        int ret;
        char tmp_path[PATH_MAX];
-       char *pathname = NULL;
+       char *pathname = nullptr;
 
        LTTNG_ASSERT(consumer);
 
@@ -75,7 +75,7 @@ static char *create_channel_path(struct consumer_output *consumer, size_t *consu
 
 error:
        free(pathname);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -87,11 +87,11 @@ static int kernel_consumer_add_channel(struct consumer_socket *sock,
                                       unsigned int monitor)
 {
        int ret;
-       char *pathname = NULL;
+       char *pathname = nullptr;
        struct lttcomm_consumer_msg lkm;
        struct consumer_output *consumer;
        enum lttng_error_code status;
-       struct ltt_session *session = NULL;
+       struct ltt_session *session = nullptr;
        struct lttng_channel_extended *channel_attr_extended;
        bool is_local_trace;
        size_t consumer_path_offset = 0;
index b4b8dab278caa8235e373d0f7b69aacacd062504..ab34f4dd00c15602021ad1f454f104aff42ade96 100644 (file)
@@ -97,7 +97,7 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan, struct ltt_kerne
 end:
        cds_list_add_tail(&ctx->list, &chan->ctx_list);
        ctx->in_list = true;
-       ctx = NULL;
+       ctx = nullptr;
 error:
        if (ctx) {
                trace_kernel_destroy_context(ctx);
@@ -118,7 +118,7 @@ int kernel_create_session(struct ltt_session *session)
 
        /* Allocate data structure */
        lks = trace_kernel_create_session();
-       if (lks == NULL) {
+       if (lks == nullptr) {
                ret = -1;
                goto error;
        }
@@ -189,7 +189,7 @@ int kernel_create_channel(struct ltt_kernel_session *session, struct lttng_chann
 
        /* Allocate kernel channel */
        lkc = trace_kernel_create_channel(chan);
-       if (lkc == NULL) {
+       if (lkc == nullptr) {
                goto error;
        }
 
@@ -300,8 +300,8 @@ static int extract_userspace_probe_offset_function_elf(
 {
        int fd;
        int ret = 0;
-       const char *symbol = NULL;
-       const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
+       const char *symbol = nullptr;
+       const struct lttng_userspace_probe_location_lookup_method *lookup = nullptr;
        enum lttng_userspace_probe_location_lookup_method_type lookup_method_type;
 
        LTTNG_ASSERT(lttng_userspace_probe_location_get_type(probe_location) ==
@@ -360,8 +360,8 @@ static int extract_userspace_probe_offset_tracepoint_sdt(
        uint32_t *offsets_count)
 {
        enum lttng_userspace_probe_location_lookup_method_type lookup_method_type;
-       const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
-       const char *probe_name = NULL, *provider_name = NULL;
+       const struct lttng_userspace_probe_location_lookup_method *lookup = nullptr;
+       const char *probe_name = nullptr, *provider_name = nullptr;
        int ret = 0;
        int fd, i;
 
@@ -428,7 +428,7 @@ static int userspace_probe_add_callsite(const struct lttng_userspace_probe_locat
                                        gid_t gid,
                                        int fd)
 {
-       const struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+       const struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
        enum lttng_userspace_probe_location_lookup_method_type type;
        int ret;
 
@@ -463,7 +463,7 @@ static int userspace_probe_add_callsite(const struct lttng_userspace_probe_locat
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
        {
                int i;
-               uint64_t *offsets = NULL;
+               uint64_t *offsets = nullptr;
                uint32_t offsets_count;
                struct lttng_kernel_abi_event_callsite callsite;
 
@@ -507,7 +507,7 @@ static int userspace_probe_event_add_callsites(struct lttng_event *ev,
                                               int fd)
 {
        int ret;
-       const struct lttng_userspace_probe_location *location = NULL;
+       const struct lttng_userspace_probe_location *location = nullptr;
 
        LTTNG_ASSERT(ev);
        LTTNG_ASSERT(ev->type == LTTNG_EVENT_USERSPACE_PROBE);
@@ -538,7 +538,7 @@ static int userspace_probe_event_rule_add_callsites(const struct lttng_event_rul
        int ret;
        enum lttng_event_rule_status status;
        enum lttng_event_rule_type event_rule_type;
-       const struct lttng_userspace_probe_location *location = NULL;
+       const struct lttng_userspace_probe_location *location = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(creds);
@@ -833,7 +833,7 @@ _kernel_get_process_attr_tracker(struct ltt_kernel_session *session,
        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
                return session->tracker_vgid;
        default:
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -1180,13 +1180,13 @@ end:
 int kernel_open_metadata(struct ltt_kernel_session *session)
 {
        int ret;
-       struct ltt_kernel_metadata *lkm = NULL;
+       struct ltt_kernel_metadata *lkm = nullptr;
 
        LTTNG_ASSERT(session);
 
        /* Allocate kernel metadata */
        lkm = trace_kernel_create_metadata();
-       if (lkm == NULL) {
+       if (lkm == nullptr) {
                goto error;
        }
 
@@ -1242,7 +1242,7 @@ error:
 /*
  * Make a kernel wait to make sure in-flight probe have completed.
  */
-void kernel_wait_quiescent(void)
+void kernel_wait_quiescent()
 {
        int ret;
        int fd = kernel_tracer_fd;
@@ -1338,7 +1338,7 @@ int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
 
        while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
                lks = trace_kernel_create_stream(channel->channel->name, channel->stream_count);
-               if (lks == NULL) {
+               if (lks == nullptr) {
                        ret = close(ret);
                        if (ret) {
                                PERROR("close");
@@ -1418,7 +1418,7 @@ ssize_t kernel_list_events(struct lttng_event **events)
        }
 
        fp = fdopen(fd, "r");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                PERROR("kernel tracepoint list fdopen");
                goto error_fp;
        }
@@ -1429,7 +1429,7 @@ ssize_t kernel_list_events(struct lttng_event **events)
         */
        nbmem = KERNEL_EVENT_INIT_LIST_SIZE;
        elist = calloc<lttng_event>(nbmem);
-       if (elist == NULL) {
+       if (elist == nullptr) {
                PERROR("alloc list events");
                count = -ENOMEM;
                goto end;
@@ -1444,7 +1444,7 @@ ssize_t kernel_list_events(struct lttng_event **events)
                        DBG("Reallocating event list from %zu to %zu bytes", nbmem, new_nbmem);
                        new_elist = (lttng_event *) realloc(elist,
                                                            new_nbmem * sizeof(struct lttng_event));
-                       if (new_elist == NULL) {
+                       if (new_elist == nullptr) {
                                PERROR("realloc list events");
                                free(event);
                                free(elist);
@@ -1534,7 +1534,7 @@ error:
 /*
  * Kernel work-arounds called at the start of sessiond main().
  */
-int init_kernel_workarounds(void)
+int init_kernel_workarounds()
 {
        int ret;
        FILE *fp;
@@ -1571,7 +1571,7 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess)
 {
        struct lttng_trace_chunk *trace_chunk;
 
-       if (ksess == NULL) {
+       if (ksess == nullptr) {
                DBG3("No kernel session when tearing down session");
                return;
        }
@@ -1617,7 +1617,7 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess)
 /* Teardown of data required by destroy notifiers. */
 void kernel_free_session(struct ltt_kernel_session *ksess)
 {
-       if (ksess == NULL) {
+       if (ksess == nullptr) {
                return;
        }
        trace_kernel_free_session(ksess);
@@ -1628,7 +1628,7 @@ void kernel_free_session(struct ltt_kernel_session *ksess)
  */
 void kernel_destroy_channel(struct ltt_kernel_channel *kchan)
 {
-       struct ltt_kernel_session *ksess = NULL;
+       struct ltt_kernel_session *ksess = nullptr;
 
        LTTNG_ASSERT(kchan);
        LTTNG_ASSERT(kchan->channel);
@@ -1667,7 +1667,7 @@ enum lttng_error_code kernel_snapshot_record(struct ltt_kernel_session *ksess,
        struct consumer_socket *socket;
        struct lttng_ht_iter iter;
        struct ltt_kernel_metadata *saved_metadata;
-       char *trace_path = NULL;
+       char *trace_path = nullptr;
        size_t consumer_path_offset = 0;
 
        LTTNG_ASSERT(ksess);
@@ -1799,7 +1799,7 @@ error:
  * Return 1 on success, 0 when feature is not supported, negative value in case
  * of errors.
  */
-int kernel_supports_ring_buffer_snapshot_sample_positions(void)
+int kernel_supports_ring_buffer_snapshot_sample_positions()
 {
        /*
         * RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS was introduced in 2.3
@@ -1813,7 +1813,7 @@ int kernel_supports_ring_buffer_snapshot_sample_positions(void)
  * Return 1 on success, 0 when feature is not supported, negative value in case
  * of errors.
  */
-int kernel_supports_ring_buffer_packet_sequence_number(void)
+int kernel_supports_ring_buffer_packet_sequence_number()
 {
        /*
         * Packet sequence number was introduced in LTTng 2.8,
@@ -1828,7 +1828,7 @@ int kernel_supports_ring_buffer_packet_sequence_number(void)
  * Return 1 on success, 0 when feature is not supported, negative value in case
  * of errors.
  */
-int kernel_supports_event_notifiers(void)
+int kernel_supports_event_notifiers()
 {
        /*
         * Event notifiers were introduced in LTTng 2.13, lttng-modules ABI 2.6.
@@ -1922,7 +1922,7 @@ error:
 /*
  * Setup necessary data for kernel tracer action.
  */
-int init_kernel_tracer(void)
+int init_kernel_tracer()
 {
        int ret;
        bool is_root = !getuid();
@@ -1990,7 +1990,7 @@ int init_kernel_tracer(void)
                }
 
                kernel_token_to_event_notifier_rule_ht = cds_lfht_new(
-                       DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+                       DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
                if (!kernel_token_to_event_notifier_rule_ht) {
                        goto error_token_ht;
                }
@@ -2057,7 +2057,7 @@ error:
        }
 }
 
-void cleanup_kernel_tracer(void)
+void cleanup_kernel_tracer()
 {
        DBG2("Closing kernel event notifier group notification file descriptor");
        if (kernel_tracer_event_notifier_group_notification_fd >= 0) {
@@ -2078,7 +2078,7 @@ void cleanup_kernel_tracer(void)
        }
 
        if (kernel_token_to_event_notifier_rule_ht) {
-               const int ret = cds_lfht_destroy(kernel_token_to_event_notifier_rule_ht, NULL);
+               const int ret = cds_lfht_destroy(kernel_token_to_event_notifier_rule_ht, nullptr);
                LTTNG_ASSERT(ret == 0);
        }
 
@@ -2109,7 +2109,7 @@ void cleanup_kernel_tracer(void)
        free(syscall_table);
 }
 
-bool kernel_tracer_is_initialized(void)
+bool kernel_tracer_is_initialized()
 {
        return kernel_tracer_fd >= 0;
 }
@@ -2284,8 +2284,8 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
        struct ltt_kernel_event_notifier_rule *event_notifier_rule;
        struct lttng_kernel_abi_event_notifier kernel_event_notifier = {};
        unsigned int capture_bytecode_count = 0, i;
-       const struct lttng_condition *condition = NULL;
-       const struct lttng_event_rule *event_rule = NULL;
+       const struct lttng_condition *condition = nullptr;
+       const struct lttng_event_rule *event_rule = nullptr;
        enum lttng_condition_status cond_status;
 
        LTTNG_ASSERT(trigger);
@@ -2392,7 +2392,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
                        lttng_condition_event_rule_matches_get_capture_bytecode_at_index(condition,
                                                                                         i);
 
-               if (capture_bytecode == NULL) {
+               if (capture_bytecode == nullptr) {
                        ERR("Unexpected NULL capture bytecode on condition");
                        error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
                        goto capture_error;
@@ -2520,7 +2520,7 @@ error:
        return error_code_ret;
 }
 
-int kernel_get_notification_fd(void)
+int kernel_get_notification_fd()
 {
        return kernel_tracer_event_notifier_group_notification_fd;
 }
index 3f09090cb37a6821fe61e6a1de68e3a049c46467..dd042fd361aa752862e9dba5bb0c75de569ee86d 100644 (file)
@@ -85,7 +85,7 @@ int syscall_init_table(int tracer_fd)
                                /* Overflow, stop everything, something went really wrong. */
                                ERR("Syscall listing memory size overflow. Stopping");
                                free(syscall_table);
-                               syscall_table = NULL;
+                               syscall_table = nullptr;
                                ret = -EINVAL;
                                goto error;
                        }
@@ -110,7 +110,7 @@ int syscall_init_table(int tracer_fd)
                            syscall_table[index].name, name, sizeof(syscall_table[index].name))) {
                        ret = -EINVAL;
                        free(syscall_table);
-                       syscall_table = NULL;
+                       syscall_table = nullptr;
                        goto error;
                }
                /*
@@ -203,7 +203,7 @@ static struct syscall *lookup_syscall(struct lttng_ht *ht, const char *name)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
-       struct syscall *ksyscall = NULL;
+       struct syscall *ksyscall = nullptr;
 
        LTTNG_ASSERT(ht);
        LTTNG_ASSERT(name);
@@ -277,7 +277,7 @@ ssize_t syscall_table_list(struct lttng_event **_events)
        ssize_t ret;
        struct lttng_event *events;
        /* Hash table used to filter duplicate out. */
-       struct lttng_ht *syscalls_ht = NULL;
+       struct lttng_ht *syscalls_ht = nullptr;
 
        LTTNG_ASSERT(_events);
 
index 0037d9e71bc3afc1554530835130f7a934856680..01633390522d6ecec7f2c265155663d48fcd7ea9 100644 (file)
@@ -84,7 +84,7 @@ static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-sessiond.8.h>
 #else
-       NULL
+       nullptr
 #endif
        ;
 
@@ -104,37 +104,37 @@ static int recv_child_signal;
 
 /* Command line options */
 static const struct option long_options[] = {
-       { "client-sock", required_argument, 0, 'c' },
-       { "apps-sock", required_argument, 0, 'a' },
-       { "kconsumerd-cmd-sock", required_argument, 0, '\0' },
-       { "kconsumerd-err-sock", required_argument, 0, '\0' },
-       { "ustconsumerd32-cmd-sock", required_argument, 0, '\0' },
-       { "ustconsumerd32-err-sock", required_argument, 0, '\0' },
-       { "ustconsumerd64-cmd-sock", required_argument, 0, '\0' },
-       { "ustconsumerd64-err-sock", required_argument, 0, '\0' },
-       { "consumerd32-path", required_argument, 0, '\0' },
-       { "consumerd32-libdir", required_argument, 0, '\0' },
-       { "consumerd64-path", required_argument, 0, '\0' },
-       { "consumerd64-libdir", required_argument, 0, '\0' },
-       { "daemonize", no_argument, 0, 'd' },
-       { "background", no_argument, 0, 'b' },
-       { "sig-parent", no_argument, 0, 'S' },
-       { "help", no_argument, 0, 'h' },
-       { "group", required_argument, 0, 'g' },
-       { "version", no_argument, 0, 'V' },
-       { "quiet", no_argument, 0, 'q' },
-       { "verbose", no_argument, 0, 'v' },
-       { "verbose-consumer", no_argument, 0, '\0' },
-       { "no-kernel", no_argument, 0, '\0' },
-       { "pidfile", required_argument, 0, 'p' },
-       { "agent-tcp-port", required_argument, 0, '\0' },
-       { "config", required_argument, 0, 'f' },
-       { "load", required_argument, 0, 'l' },
-       { "kmod-probes", required_argument, 0, '\0' },
-       { "extra-kmod-probes", required_argument, 0, '\0' },
-       { EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR, required_argument, 0, '\0' },
-       { EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR, required_argument, 0, '\0' },
-       { NULL, 0, 0, 0 }
+       { "client-sock", required_argument, nullptr, 'c' },
+       { "apps-sock", required_argument, nullptr, 'a' },
+       { "kconsumerd-cmd-sock", required_argument, nullptr, '\0' },
+       { "kconsumerd-err-sock", required_argument, nullptr, '\0' },
+       { "ustconsumerd32-cmd-sock", required_argument, nullptr, '\0' },
+       { "ustconsumerd32-err-sock", required_argument, nullptr, '\0' },
+       { "ustconsumerd64-cmd-sock", required_argument, nullptr, '\0' },
+       { "ustconsumerd64-err-sock", required_argument, nullptr, '\0' },
+       { "consumerd32-path", required_argument, nullptr, '\0' },
+       { "consumerd32-libdir", required_argument, nullptr, '\0' },
+       { "consumerd64-path", required_argument, nullptr, '\0' },
+       { "consumerd64-libdir", required_argument, nullptr, '\0' },
+       { "daemonize", no_argument, nullptr, 'd' },
+       { "background", no_argument, nullptr, 'b' },
+       { "sig-parent", no_argument, nullptr, 'S' },
+       { "help", no_argument, nullptr, 'h' },
+       { "group", required_argument, nullptr, 'g' },
+       { "version", no_argument, nullptr, 'V' },
+       { "quiet", no_argument, nullptr, 'q' },
+       { "verbose", no_argument, nullptr, 'v' },
+       { "verbose-consumer", no_argument, nullptr, '\0' },
+       { "no-kernel", no_argument, nullptr, '\0' },
+       { "pidfile", required_argument, nullptr, 'p' },
+       { "agent-tcp-port", required_argument, nullptr, '\0' },
+       { "config", required_argument, nullptr, 'f' },
+       { "load", required_argument, nullptr, 'l' },
+       { "kmod-probes", required_argument, nullptr, '\0' },
+       { "extra-kmod-probes", required_argument, nullptr, '\0' },
+       { EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR, required_argument, nullptr, '\0' },
+       { EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR, required_argument, nullptr, '\0' },
+       { nullptr, 0, nullptr, 0 }
 };
 
 /* Command line options to ignore from configuration file */
@@ -170,7 +170,7 @@ static int is_root;
  * Notify the main thread to initiate the teardown of the worker threads by
  * writing to the main quit pipe.
  */
-static void notify_main_quit_pipe(void)
+static void notify_main_quit_pipe()
 {
        int ret;
 
@@ -185,7 +185,7 @@ static void notify_main_quit_pipe(void)
 /*
  * Close every consumer sockets.
  */
-static void close_consumer_sockets(void)
+static void close_consumer_sockets()
 {
        int ret;
 
@@ -273,7 +273,7 @@ static void wait_consumer(struct consumer_data *consumer_data)
 /*
  * Cleanup the session daemon's data structures.
  */
-static void sessiond_cleanup(void)
+static void sessiond_cleanup()
 {
        int ret;
        struct ltt_session_list *session_list = session_get_list();
@@ -357,7 +357,7 @@ static void sessiond_cleanup(void)
 /*
  * Cleanup the daemon's option data structures.
  */
-static void sessiond_cleanup_options(void)
+static void sessiond_cleanup_options()
 {
        DBG("Cleaning up options");
 
@@ -641,7 +641,7 @@ static int set_option(int opt, const char *arg, const char *optname)
                        unsigned long v;
 
                        errno = 0;
-                       v = strtoul(arg, NULL, 0);
+                       v = strtoul(arg, nullptr, 0);
                        if (errno != 0 || !isdigit(arg[0])) {
                                ERR("Wrong value in --agent-tcp-port parameter: %s", arg);
                                return -1;
@@ -702,7 +702,7 @@ static int set_option(int opt, const char *arg, const char *optname)
                unsigned long v;
 
                errno = 0;
-               v = strtoul(arg, NULL, 0);
+               v = strtoul(arg, nullptr, 0);
                if (errno != 0 || !isdigit(arg[0])) {
                        ERR("Wrong value in --%s parameter: %s",
                            EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR,
@@ -723,7 +723,7 @@ static int set_option(int opt, const char *arg, const char *optname)
                unsigned long v;
 
                errno = 0;
-               v = strtoul(arg, NULL, 0);
+               v = strtoul(arg, nullptr, 0);
                if (errno != 0 || !isdigit(arg[0])) {
                        ERR("Wrong value in --%s parameter: %s",
                            EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR,
@@ -823,7 +823,7 @@ end:
        return ret;
 }
 
-static void print_version(void)
+static void print_version()
 {
        fprintf(stdout, "%s\n", VERSION);
 }
@@ -836,7 +836,7 @@ static int set_options(int argc, char **argv)
        int ret = 0, c = 0, option_index = 0;
        int orig_optopt = optopt, orig_optind = optind;
        char *optstring;
-       char *config_path = NULL;
+       char *config_path = nullptr;
 
        optstring = utils_generate_optstring(long_options,
                                             sizeof(long_options) / sizeof(struct option));
@@ -868,7 +868,7 @@ static int set_options(int argc, char **argv)
        }
 
        ret = config_get_section_entries(
-               config_path, config_section_name, config_entry_handler, NULL);
+               config_path, config_section_name, config_entry_handler, nullptr);
        if (ret) {
                if (ret > 0) {
                        ERR("Invalid configuration option at line %i", ret);
@@ -880,7 +880,7 @@ static int set_options(int argc, char **argv)
        /* Reset getopt's global state */
        optopt = orig_optopt;
        optind = orig_optind;
-       while (1) {
+       while (true) {
                option_index = -1;
                /*
                 * getopt_long() will not set option_index if it encounters a
@@ -896,7 +896,7 @@ static int set_options(int argc, char **argv)
                 * unset.
                 */
                ret = set_option(
-                       c, optarg, option_index < 0 ? NULL : long_options[option_index].name);
+                       c, optarg, option_index < 0 ? nullptr : long_options[option_index].name);
                if (ret < 0) {
                        break;
                }
@@ -911,7 +911,7 @@ end:
 /*
  * Create lockfile using the rundir and return its fd.
  */
-static int create_lockfile(void)
+static int create_lockfile()
 {
        return utils_create_lock_file(the_config.lock_file_path.value);
 }
@@ -922,7 +922,7 @@ static int create_lockfile(void)
  *
  * Also attempts to create and hold the lock file.
  */
-static int check_existing_daemon(void)
+static int check_existing_daemon()
 {
        int ret = 0;
 
@@ -941,7 +941,7 @@ end:
        return ret;
 }
 
-static void sessiond_cleanup_lock_file(void)
+static void sessiond_cleanup_lock_file()
 {
        int ret;
 
@@ -1032,7 +1032,7 @@ static int set_permissions(char *rundir)
 /*
  * Create the lttng run directory needed for all global sockets and pipe.
  */
-static int create_lttng_rundir(void)
+static int create_lttng_rundir()
 {
        int ret;
 
@@ -1059,7 +1059,7 @@ error:
 static int set_consumer_sockets(struct consumer_data *consumer_data)
 {
        int ret;
-       char *path = NULL;
+       char *path = nullptr;
 
        switch (consumer_data->type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -1179,7 +1179,7 @@ static void sighandler(int sig, siginfo_t *siginfo, void *arg __attribute__((unu
  * Setup signal handler for :
  *             SIGINT, SIGTERM, SIGPIPE
  */
-static int set_signal_handler(void)
+static int set_signal_handler()
 {
        int ret = 0;
        struct sigaction sa;
@@ -1194,29 +1194,29 @@ static int set_signal_handler(void)
        sa.sa_flags = SA_SIGINFO;
 
        sa.sa_sigaction = sighandler;
-       if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGTERM, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
-       if ((ret = sigaction(SIGINT, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGINT, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
-       if ((ret = sigaction(SIGUSR1, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGUSR1, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
-       if ((ret = sigaction(SIGBUS, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGBUS, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
 
        sa.sa_flags = 0;
        sa.sa_handler = SIG_IGN;
-       if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGPIPE, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                return ret;
        }
@@ -1230,7 +1230,7 @@ static int set_signal_handler(void)
  * Set open files limit to unlimited. This daemon can open a large number of
  * file descriptors in order to consume multiple kernel traces.
  */
-static void set_ulimit(void)
+static void set_ulimit()
 {
        int ret;
        struct rlimit lim;
@@ -1245,15 +1245,15 @@ static void set_ulimit(void)
        }
 }
 
-static int write_pidfile(void)
+static int write_pidfile()
 {
        return utils_create_pid_file(getpid(), the_config.pid_file_path.value);
 }
 
-static int set_clock_plugin_env(void)
+static int set_clock_plugin_env()
 {
        int ret = 0;
-       char *env_value = NULL;
+       char *env_value = nullptr;
 
        if (!the_config.lttng_ust_clock_plugin.value) {
                goto end;
@@ -1279,7 +1279,7 @@ end:
        return ret;
 }
 
-static void destroy_all_sessions_and_wait(void)
+static void destroy_all_sessions_and_wait()
 {
        struct ltt_session *session, *tmp;
        struct ltt_session_list *session_list;
@@ -1303,7 +1303,7 @@ static void destroy_all_sessions_and_wait(void)
                        goto unlock_session;
                }
                (void) cmd_stop_trace(session);
-               (void) cmd_destroy_session(session, the_notification_thread_handle, NULL);
+               (void) cmd_destroy_session(session, the_notification_thread_handle, nullptr);
        unlock_session:
                session_unlock(session);
                session_put(session);
@@ -1316,11 +1316,11 @@ static void destroy_all_sessions_and_wait(void)
        DBG("Destruction of all sessions completed");
 }
 
-static void unregister_all_triggers(void)
+static void unregister_all_triggers()
 {
        enum lttng_error_code ret_code;
        enum lttng_trigger_status trigger_status;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int trigger_count, i;
        const struct lttng_credentials creds = {
                .uid = LTTNG_OPTIONAL_INIT_VALUE(0),
@@ -1392,7 +1392,7 @@ static int launch_run_as_worker(const char *procname)
        return run_as_create_worker(procname, run_as_worker_post_fork_cleanup, &the_config);
 }
 
-static void sessiond_uuid_log(void)
+static void sessiond_uuid_log()
 {
        char uuid_str[LTTNG_UUID_STR_LEN];
 
@@ -1407,16 +1407,17 @@ int main(int argc, char **argv)
 {
        int ret = 0, retval = 0;
        const char *env_app_timeout;
-       struct lttng_pipe *ust32_channel_monitor_pipe = NULL, *ust64_channel_monitor_pipe = NULL,
-                         *kernel_channel_monitor_pipe = NULL;
+       struct lttng_pipe *ust32_channel_monitor_pipe = nullptr,
+                         *ust64_channel_monitor_pipe = nullptr,
+                         *kernel_channel_monitor_pipe = nullptr;
        struct timer_thread_parameters timer_thread_parameters;
        /* Rotation thread handle. */
-       struct rotation_thread_handle *rotation_thread_handle = NULL;
+       struct rotation_thread_handle *rotation_thread_handle = nullptr;
        /* Queue of rotation jobs populated by the sessiond-timer. */
-       struct rotation_thread_timer_queue *rotation_timer_queue = NULL;
-       struct lttng_thread *client_thread = NULL;
-       struct lttng_thread *notification_thread = NULL;
-       struct lttng_thread *register_apps_thread = NULL;
+       struct rotation_thread_timer_queue *rotation_timer_queue = nullptr;
+       struct lttng_thread *client_thread = nullptr;
+       struct lttng_thread *notification_thread = nullptr;
+       struct lttng_thread *register_apps_thread = nullptr;
        enum event_notifier_error_accounting_status event_notifier_error_accounting_status;
 
        logger_set_thread_name("Main", false);
@@ -1850,7 +1851,7 @@ int main(int argc, char **argv)
        }
 
        /* Load sessions. */
-       ret = config_load_session(the_config.load_session_path.value, NULL, 1, 1, NULL);
+       ret = config_load_session(the_config.load_session_path.value, nullptr, 1, 1, nullptr);
        if (ret) {
                ERR("Session load failed: %s", error_get_str(ret));
                retval = -1;
index 8e7f50900bc32bbdf66816f132d89ebad775ff82..27fa6ce85e0e47afd522698c7ebe067f8250ff17 100644 (file)
@@ -84,7 +84,7 @@ static void *thread_application_management(void *data)
 
        health_code_update();
 
-       while (1) {
+       while (true) {
                DBG("Apps thread polling");
 
                /* Inifinite blocking call, waiting for transmission */
@@ -198,7 +198,7 @@ error_testpoint:
        DBG("Application communication apps thread cleanup complete");
        rcu_thread_offline();
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_application_management_thread(void *data)
@@ -212,7 +212,7 @@ static bool shutdown_application_management_thread(void *data)
 bool launch_application_management_thread(int apps_cmd_pipe_read_fd)
 {
        struct lttng_pipe *quit_pipe;
-       struct thread_notifiers *notifiers = NULL;
+       struct thread_notifiers *notifiers = nullptr;
        struct lttng_thread *thread;
 
        notifiers = zmalloc<thread_notifiers>();
index 1c8e08e18d95107490c979051ce418cbb3b104fb..702bd5050cb884972ffff0dc1642ae24c96957bc 100644 (file)
@@ -61,7 +61,7 @@ static void *thread_consumer_management(void *data)
        struct thread_notifiers *notifiers = (thread_notifiers *) data;
        struct consumer_data *consumer_data = notifiers->consumer_data;
        const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(notifiers->quit_pipe);
-       struct consumer_socket *cmd_socket_wrapper = NULL;
+       struct consumer_socket *cmd_socket_wrapper = nullptr;
 
        DBG("[thread] Manage consumer started");
 
@@ -191,12 +191,12 @@ static void *thread_consumer_management(void *data)
 
        /* Create metadata socket lock. */
        consumer_data->metadata_sock.lock = zmalloc<pthread_mutex_t>();
-       if (consumer_data->metadata_sock.lock == NULL) {
+       if (consumer_data->metadata_sock.lock == nullptr) {
                PERROR("zmalloc pthread mutex");
                mark_thread_intialization_as_failed(notifiers);
                goto error;
        }
-       pthread_mutex_init(consumer_data->metadata_sock.lock, NULL);
+       pthread_mutex_init(consumer_data->metadata_sock.lock, nullptr);
 
        DBG("Consumer command socket ready (fd: %d)", consumer_data->cmd_sock);
        DBG("Consumer metadata socket ready (fd: %d)", consumer_data->metadata_fd);
@@ -256,13 +256,13 @@ static void *thread_consumer_management(void *data)
 
        /* Discard the socket wrapper as it is no longer needed. */
        consumer_destroy_socket(cmd_socket_wrapper);
-       cmd_socket_wrapper = NULL;
+       cmd_socket_wrapper = nullptr;
 
        /* The thread is completely initialized, signal that it is ready. */
        mark_thread_as_ready(notifiers);
 
        /* Infinite blocking call, waiting for transmission */
-       while (1) {
+       while (true) {
                health_code_update();
 
                /* Exit the thread because the thread quit pipe has been triggered. */
@@ -405,7 +405,7 @@ error_poll:
        rcu_thread_offline();
        rcu_unregister_thread();
 
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_consumer_management_thread(void *data)
@@ -427,7 +427,7 @@ static void cleanup_consumer_management_thread(void *data)
 bool launch_consumer_management_thread(struct consumer_data *consumer_data)
 {
        struct lttng_pipe *quit_pipe;
-       struct thread_notifiers *notifiers = NULL;
+       struct thread_notifiers *notifiers = nullptr;
        struct lttng_thread *thread;
 
        notifiers = zmalloc<thread_notifiers>();
index ac5c819666b652abe442d0c1d54ba412a0b29c17..49730f497654fe1af8d09be8f6920fa41bce1620 100644 (file)
@@ -44,7 +44,7 @@ static int update_kernel_poll(struct lttng_poll_event *events)
                        continue;
                }
                session_lock(session);
-               if (session->kernel_session == NULL) {
+               if (session->kernel_session == nullptr) {
                        session_unlock(session);
                        session_put(session);
                        continue;
@@ -95,7 +95,7 @@ static int update_kernel_stream(int fd)
                        continue;
                }
                session_lock(session);
-               if (session->kernel_session == NULL) {
+               if (session->kernel_session == nullptr) {
                        session_unlock(session);
                        session_put(session);
                        continue;
@@ -122,7 +122,7 @@ static int update_kernel_stream(int fd)
                         * means that tracing is started so it is safe to send
                         * our updated stream fds.
                         */
-                       if (ksess->consumer_fds_sent != 1 || ksess->consumer == NULL) {
+                       if (ksess->consumer_fds_sent != 1 || ksess->consumer == nullptr) {
                                ret = -1;
                                goto error;
                        }
@@ -189,7 +189,7 @@ static void *thread_kernel_management(void *data)
                goto error_testpoint;
        }
 
-       while (1) {
+       while (true) {
                health_code_update();
 
                if (update_poll_flag == 1) {
@@ -303,7 +303,7 @@ error_testpoint:
        }
        health_unregister(the_health_sessiond);
        DBG("Kernel thread dying");
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_kernel_management_thread(void *data)
@@ -325,7 +325,7 @@ static void cleanup_kernel_management_thread(void *data)
 bool launch_kernel_management_thread(int kernel_poll_pipe_read_fd)
 {
        struct lttng_pipe *quit_pipe;
-       struct thread_notifiers *notifiers = NULL;
+       struct thread_notifiers *notifiers = nullptr;
        struct lttng_thread *thread;
 
        notifiers = zmalloc<thread_notifiers>();
index 0a6d8973e065267c85cb054e572f6ef6cb12d007..ac9f14257c6c5334a38be31e494d98fd6e619656 100644 (file)
@@ -330,7 +330,7 @@ static int setup_kmod_ctx(struct kmod_ctx **ctx)
 {
        int ret = 0;
 
-       *ctx = kmod_new(NULL, NULL);
+       *ctx = kmod_new(nullptr, nullptr);
        if (!ctx) {
                PERROR("Unable to create kmod library context");
                ret = -ENOMEM;
@@ -344,7 +344,7 @@ static int setup_kmod_ctx(struct kmod_ctx **ctx)
         */
        DIAGNOSTIC_PUSH
        DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT
-       kmod_set_log_fn(*ctx, log_kmod, NULL);
+       kmod_set_log_fn(*ctx, log_kmod, nullptr);
        DIAGNOSTIC_POP
        ret = kmod_load_resources(*ctx);
        if (ret < 0) {
@@ -379,7 +379,7 @@ static int modprobe_lttng(struct kern_modules_param *modules, int entries)
        }
 
        for (i = 0; i < entries; i++) {
-               struct kmod_module *mod = NULL;
+               struct kmod_module *mod = nullptr;
 
                ret = kmod_module_new_from_name(ctx, modules[i].name, &mod);
                if (ret < 0) {
@@ -387,7 +387,7 @@ static int modprobe_lttng(struct kern_modules_param *modules, int entries)
                        goto error;
                }
 
-               ret = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL);
+               ret = kmod_module_probe_insert_module(mod, 0, nullptr, nullptr, nullptr, nullptr);
                if (ret == -EEXIST) {
                        DBG("Module %s is already loaded", modules[i].name);
                        ret = 0;
@@ -440,7 +440,7 @@ static int rmmod_recurse(struct kmod_module *mod)
        ret = kmod_module_remove_module(mod, 0);
 
        deps = kmod_module_get_dependencies(mod);
-       if (deps != NULL) {
+       if (deps != nullptr) {
                kmod_list_foreach(itr, deps)
                {
                        struct kmod_module *dep = kmod_module_get_module(itr);
@@ -474,7 +474,7 @@ static void modprobe_remove_lttng(const struct kern_modules_param *modules, int
        }
 
        for (i = entries - 1; i >= 0; i--) {
-               struct kmod_module *mod = NULL;
+               struct kmod_module *mod = nullptr;
 
                if (!modules[i].loaded) {
                        continue;
@@ -598,12 +598,12 @@ static void modprobe_remove_lttng(const struct kern_modules_param *modules, int
 /*
  * Remove control kernel module(s) in reverse load order.
  */
-void modprobe_remove_lttng_control(void)
+void modprobe_remove_lttng_control()
 {
        modprobe_remove_lttng(kern_modules_control_core, ARRAY_SIZE(kern_modules_control_core));
 }
 
-static void free_probes(void)
+static void free_probes()
 {
        int i;
 
@@ -614,14 +614,14 @@ static void free_probes(void)
                free(probes[i].name);
        }
        free(probes);
-       probes = NULL;
+       probes = nullptr;
        nr_probes = 0;
 }
 
 /*
  * Remove data kernel modules in reverse load order.
  */
-void modprobe_remove_lttng_data(void)
+void modprobe_remove_lttng_data()
 {
        if (!probes) {
                return;
@@ -634,7 +634,7 @@ void modprobe_remove_lttng_data(void)
 /*
  * Remove all kernel modules in reverse order.
  */
-void modprobe_remove_lttng_all(void)
+void modprobe_remove_lttng_all()
 {
        modprobe_remove_lttng_data();
        modprobe_remove_lttng_control();
@@ -643,7 +643,7 @@ void modprobe_remove_lttng_all(void)
 /*
  * Load control kernel module(s).
  */
-int modprobe_lttng_control(void)
+int modprobe_lttng_control()
 {
        return modprobe_lttng(kern_modules_control_core, ARRAY_SIZE(kern_modules_control_core));
 }
@@ -652,7 +652,7 @@ int modprobe_lttng_control(void)
  * Grow global list of probes (double capacity or set it to 1 if
  * currently 0 and copy existing data).
  */
-static int grow_probes(void)
+static int grow_probes()
 {
        int i;
        struct kern_modules_param *tmp_probes;
@@ -716,7 +716,7 @@ static int append_list_to_probes(const char *list)
                if (!next) {
                        break;
                }
-               cur_list = NULL;
+               cur_list = nullptr;
 
                /* filter leading spaces */
                while (*next == ' ') {
@@ -765,7 +765,7 @@ error:
 /*
  * Load data kernel module(s).
  */
-int modprobe_lttng_data(void)
+int modprobe_lttng_data()
 {
        int ret, i;
        char *list;
index b51acaf6747169e3f50de35b1d90d514c2932200..a8d774a4f0764081e9d3203fd20fd49cea5fbaf8 100644 (file)
@@ -452,13 +452,13 @@ end:
 struct lttng_event_notifier_notification *lttng_event_notifier_notification_create(
        uint64_t tracer_token, enum lttng_domain_type domain, char *payload, size_t payload_size)
 {
-       struct lttng_event_notifier_notification *notification = NULL;
+       struct lttng_event_notifier_notification *notification = nullptr;
 
        LTTNG_ASSERT(domain != LTTNG_DOMAIN_NONE);
        LTTNG_ASSERT((payload && payload_size) || (!payload && !payload_size));
 
        notification = zmalloc<lttng_event_notifier_notification>();
-       if (notification == NULL) {
+       if (notification == nullptr) {
                ERR("Error allocating notification");
                goto end;
        }
index 8c009f748cc39f28129759ff46a1fc2bccfb2303..c9348cb3d14a6c77e55bb45787210204ce23fef2 100644 (file)
@@ -324,7 +324,7 @@ static struct session_info *get_session_info_by_id(const struct notification_thr
                return session_info;
        }
 
-       return NULL;
+       return nullptr;
 }
 
 static struct session_info *get_session_info_by_name(const struct notification_thread_state *state,
@@ -333,7 +333,7 @@ static struct session_info *get_session_info_by_name(const struct notification_t
        uint64_t session_id;
        const auto found = sample_session_id_by_name(name, &session_id);
 
-       return found ? get_session_info_by_id(state, session_id) : NULL;
+       return found ? get_session_info_by_id(state, session_id) : nullptr;
 }
 
 static const char *notification_command_type_str(enum notification_thread_command_type type)
@@ -389,10 +389,10 @@ static int match_trigger_by_name_uid(struct cds_lfht_node *node, const void *key
                caa_container_of(node, struct lttng_trigger_ht_element, node_by_name_uid);
 
        status = lttng_trigger_get_name(trigger_ht_element->trigger, &element_trigger_name);
-       element_trigger_name = status == LTTNG_TRIGGER_STATUS_OK ? element_trigger_name : NULL;
+       element_trigger_name = status == LTTNG_TRIGGER_STATUS_OK ? element_trigger_name : nullptr;
 
        status = lttng_trigger_get_name(trigger_key, &key_name);
-       key_name = status == LTTNG_TRIGGER_STATUS_OK ? key_name : NULL;
+       key_name = status == LTTNG_TRIGGER_STATUS_OK ? key_name : nullptr;
 
        /*
         * Compare the names.
@@ -518,7 +518,7 @@ static void session_info_destroy(void *_data)
 
        LTTNG_ASSERT(session_info);
        if (session_info->channel_infos_ht) {
-               ret = cds_lfht_destroy(session_info->channel_infos_ht, NULL);
+               ret = cds_lfht_destroy(session_info->channel_infos_ht, nullptr);
                if (ret) {
                        ERR("Failed to destroy channel information hash table");
                }
@@ -568,7 +568,7 @@ static struct session_info *session_info_create(uint64_t id,
        lttng_ref_init(&session_info->ref, session_info_destroy);
 
        session_info->channel_infos_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!session_info->channel_infos_ht) {
                goto error;
        }
@@ -588,7 +588,7 @@ end:
        return session_info;
 error:
        session_info_put(session_info);
-       return NULL;
+       return nullptr;
 }
 
 static void session_info_add_channel(struct session_info *session_info,
@@ -642,7 +642,7 @@ end:
        return channel_info;
 error:
        channel_info_destroy(channel_info);
-       return NULL;
+       return nullptr;
 }
 
 bool notification_client_list_get(struct notification_client_list *list)
@@ -669,7 +669,7 @@ static void notification_client_list_release(struct urcu_ref *list_ref)
                cds_lfht_del(list->notification_trigger_clients_ht,
                             &list->notification_trigger_clients_ht_node);
                rcu_read_unlock();
-               list->notification_trigger_clients_ht = NULL;
+               list->notification_trigger_clients_ht = nullptr;
        }
        cds_list_for_each_entry_safe (client_list_element, tmp, &list->clients_list, node) {
                free(client_list_element);
@@ -711,7 +711,7 @@ notification_client_list_create(struct notification_thread_state *state,
                goto end;
        }
 
-       pthread_mutex_init(&client_list->lock, NULL);
+       pthread_mutex_init(&client_list->lock, nullptr);
        /*
         * The trigger that owns the condition has the first reference to this
         * client list.
@@ -762,7 +762,7 @@ notification_client_list_create(struct notification_thread_state *state,
 
 error_put_client_list:
        notification_client_list_put(client_list);
-       client_list = NULL;
+       client_list = nullptr;
 
 end:
        return client_list;
@@ -783,7 +783,7 @@ get_client_list_from_condition(struct notification_thread_state *state,
 {
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
-       struct notification_client_list *list = NULL;
+       struct notification_client_list *list = nullptr;
 
        rcu_read_lock();
        cds_lfht_lookup(state->notification_trigger_clients_ht,
@@ -795,7 +795,7 @@ get_client_list_from_condition(struct notification_thread_state *state,
        if (node) {
                list = lttng::utils::container_of(
                        node, &notification_client_list::notification_trigger_clients_ht_node);
-               list = notification_client_list_get(list) ? list : NULL;
+               list = notification_client_list_get(list) ? list : nullptr;
        }
 
        rcu_read_unlock();
@@ -811,10 +811,10 @@ static int evaluate_channel_condition_for_client(const struct lttng_condition *c
        int ret;
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
-       struct channel_info *channel_info = NULL;
-       struct channel_key *channel_key = NULL;
-       struct channel_state_sample *last_sample = NULL;
-       struct lttng_channel_trigger_list *channel_trigger_list = NULL;
+       struct channel_info *channel_info = nullptr;
+       struct channel_key *channel_key = nullptr;
+       struct channel_state_sample *last_sample = nullptr;
+       struct lttng_channel_trigger_list *channel_trigger_list = nullptr;
 
        rcu_read_lock();
 
@@ -877,7 +877,7 @@ static int evaluate_channel_condition_for_client(const struct lttng_condition *c
        }
 
        ret = evaluate_buffer_condition(
-               condition, evaluation, state, NULL, last_sample, channel_info);
+               condition, evaluation, state, nullptr, last_sample, channel_info);
        if (ret) {
                WARN("Fatal error occurred while evaluating a newly subscribed-to condition");
                goto end;
@@ -892,7 +892,7 @@ end:
 
 static const char *get_condition_session_name(const struct lttng_condition *condition)
 {
-       const char *session_name = NULL;
+       const char *session_name = nullptr;
        enum lttng_condition_status status;
 
        switch (lttng_condition_get_type(condition)) {
@@ -1060,14 +1060,14 @@ static int evaluate_condition_for_client(const struct lttng_trigger *trigger,
                                         struct notification_thread_state *state)
 {
        int ret;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
        struct notification_client_list client_list = {
                .lock = PTHREAD_MUTEX_INITIALIZER,
                .ref = {},
-               .condition = NULL,
+               .condition = nullptr,
                .triggers_list = {},
                .clients_list = {},
-               .notification_trigger_clients_ht = NULL,
+               .notification_trigger_clients_ht = nullptr,
                .notification_trigger_clients_ht_node = {},
                .rcu_node = {},
        };
@@ -1097,7 +1097,7 @@ static int evaluate_condition_for_client(const struct lttng_trigger *trigger,
                object_uid = session_info->uid;
                object_gid = session_info->gid;
 
-               ret = evaluate_session_condition(condition, session_info, NULL, &evaluation);
+               ret = evaluate_session_condition(condition, session_info, nullptr, &evaluation);
                session_info_put(session_info);
                break;
        }
@@ -1151,9 +1151,9 @@ static int notification_thread_client_subscribe(struct notification_client *clie
                                                enum lttng_notification_channel_status *_status)
 {
        int ret = 0;
-       struct notification_client_list *client_list = NULL;
-       struct lttng_condition_list_element *condition_list_element = NULL;
-       struct notification_client_list_element *client_list_element = NULL;
+       struct notification_client_list *client_list = nullptr;
+       struct lttng_condition_list_element *condition_list_element = nullptr;
+       struct notification_client_list_element *client_list_element = nullptr;
        struct lttng_trigger_ht_element *trigger_ht_element;
        enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
 
@@ -1184,7 +1184,7 @@ static int notification_thread_client_subscribe(struct notification_client *clie
         */
        CDS_INIT_LIST_HEAD(&condition_list_element->node);
        condition_list_element->condition = condition;
-       condition = NULL;
+       condition = nullptr;
        cds_list_add(&condition_list_element->node, &client->condition_list);
 
        client_list = get_client_list_from_condition(state, condition_list_element->condition);
@@ -1309,7 +1309,7 @@ static int notification_thread_client_unsubscribe(struct notification_client *cl
        }
        pthread_mutex_unlock(&client_list->lock);
        notification_client_list_put(client_list);
-       client_list = NULL;
+       client_list = nullptr;
 end:
        lttng_condition_destroy(condition);
        if (_status) {
@@ -1353,7 +1353,7 @@ static struct notification_client *get_client_from_socket(int socket,
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
-       struct notification_client *client = NULL;
+       struct notification_client *client = nullptr;
 
        ASSERT_RCU_READ_LOCKED();
 
@@ -1381,7 +1381,7 @@ static struct notification_client *get_client_from_id(notification_client_id id,
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
-       struct notification_client *client = NULL;
+       struct notification_client *client = nullptr;
 
        ASSERT_RCU_READ_LOCKED();
 
@@ -1401,8 +1401,8 @@ static bool buffer_usage_condition_applies_to_channel(const struct lttng_conditi
 {
        enum lttng_condition_status status;
        enum lttng_domain_type condition_domain;
-       const char *condition_session_name = NULL;
-       const char *condition_channel_name = NULL;
+       const char *condition_session_name = nullptr;
+       const char *condition_channel_name = nullptr;
 
        status = lttng_condition_buffer_usage_get_domain_type(condition, &condition_domain);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
@@ -1458,7 +1458,7 @@ fail:
 static struct lttng_session_trigger_list *
 get_session_trigger_list(struct notification_thread_state *state, const char *session_name)
 {
-       struct lttng_session_trigger_list *list = NULL;
+       struct lttng_session_trigger_list *list = nullptr;
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
 
@@ -1492,7 +1492,7 @@ end:
 static struct lttng_session_trigger_list *
 lttng_session_trigger_list_create(const char *session_name, struct cds_lfht *session_triggers_ht)
 {
-       struct lttng_session_trigger_list *list = NULL;
+       struct lttng_session_trigger_list *list = nullptr;
        char *session_name_copy = strdup(session_name);
 
        if (!session_name_copy) {
@@ -1598,8 +1598,8 @@ lttng_session_trigger_list_build(const struct notification_thread_state *state,
                                 const char *session_name)
 {
        int trigger_count = 0;
-       struct lttng_session_trigger_list *session_trigger_list = NULL;
-       struct lttng_trigger_ht_element *trigger_ht_element = NULL;
+       struct lttng_session_trigger_list *session_trigger_list = nullptr;
+       struct lttng_trigger_ht_element *trigger_ht_element = nullptr;
        struct cds_lfht_iter iter;
 
        session_trigger_list =
@@ -1626,7 +1626,7 @@ lttng_session_trigger_list_build(const struct notification_thread_state *state,
        return session_trigger_list;
 error:
        lttng_session_trigger_list_destroy(session_trigger_list);
-       return NULL;
+       return nullptr;
 }
 
 static struct session_info *create_and_publish_session_info(struct notification_thread_state *state,
@@ -1635,7 +1635,7 @@ static struct session_info *create_and_publish_session_info(struct notification_
                                                            uid_t uid,
                                                            gid_t gid)
 {
-       struct session_info *session = NULL;
+       struct session_info *session = nullptr;
        struct lttng_session_trigger_list *trigger_list;
 
        rcu_read_lock();
@@ -1655,7 +1655,7 @@ static struct session_info *create_and_publish_session_info(struct notification_
        }
 
        /* Transferred ownership to the new session. */
-       trigger_list = NULL;
+       trigger_list = nullptr;
 
        if (cds_lfht_add_unique(state->sessions_ht,
                                hash_session_info(session),
@@ -1671,7 +1671,7 @@ static struct session_info *create_and_publish_session_info(struct notification_
 error:
        rcu_read_unlock();
        session_info_put(session);
-       return NULL;
+       return nullptr;
 }
 
 static int handle_notification_thread_command_add_channel(struct notification_thread_state *state,
@@ -1683,16 +1683,16 @@ static int handle_notification_thread_command_add_channel(struct notification_th
                                                          enum lttng_error_code *cmd_result)
 {
        struct cds_list_head trigger_list;
-       struct channel_info *new_channel_info = NULL;
+       struct channel_info *new_channel_info = nullptr;
        struct channel_key channel_key = {
                .key = channel_key_int,
                .domain = channel_domain,
        };
-       struct lttng_channel_trigger_list *channel_trigger_list = NULL;
-       struct lttng_trigger_ht_element *trigger_ht_element = NULL;
+       struct lttng_channel_trigger_list *channel_trigger_list = nullptr;
+       struct lttng_trigger_ht_element *trigger_ht_element = nullptr;
        int trigger_count = 0;
        struct cds_lfht_iter iter;
-       struct session_info *session_info = NULL;
+       struct session_info *session_info = nullptr;
 
        DBG("Adding channel: channel name = `%s`, session id = %" PRIu64 ", channel key = %" PRIu64
            ", domain = %s",
@@ -1958,7 +1958,7 @@ handle_notification_thread_command_session_rotation(struct notification_thread_s
                lttng_trace_archive_location_get(location);
                new_session_state.rotation.location = location;
        } else {
-               new_session_state.rotation.location = NULL;
+               new_session_state.rotation.location = nullptr;
        }
 
        session_creds = {
@@ -1977,7 +1977,7 @@ handle_notification_thread_command_session_rotation(struct notification_thread_s
                const struct lttng_condition *condition;
                struct lttng_trigger *trigger;
                struct notification_client_list *client_list;
-               struct lttng_evaluation *evaluation = NULL;
+               struct lttng_evaluation *evaluation = nullptr;
                enum action_executor_status executor_status;
 
                trigger = trigger_list_element->trigger;
@@ -2005,7 +2005,7 @@ handle_notification_thread_command_session_rotation(struct notification_thread_s
                executor_status = action_executor_enqueue_trigger(
                        state->executor, trigger, evaluation, &session_creds, client_list);
                notification_client_list_put(client_list);
-               evaluation = NULL;
+               evaluation = nullptr;
                switch (executor_status) {
                case ACTION_EXECUTOR_STATUS_OK:
                        break;
@@ -2054,7 +2054,7 @@ handle_notification_thread_command_add_tracer_event_source(struct notification_t
 {
        int ret = 0;
        enum lttng_error_code cmd_result = LTTNG_OK;
-       struct notification_event_tracer_event_source_element *element = NULL;
+       struct notification_event_tracer_event_source_element *element = nullptr;
 
        element = zmalloc<notification_event_tracer_event_source_element>();
        if (!element) {
@@ -2154,7 +2154,7 @@ find_tracer_event_source_element(struct notification_thread_state *state,
                }
        }
 
-       source_element = NULL;
+       source_element = nullptr;
 end:
        return source_element;
 }
@@ -2228,7 +2228,7 @@ static int handle_notification_thread_command_remove_tracer_event_source(
 {
        int ret = 0;
        enum lttng_error_code cmd_result = LTTNG_OK;
-       struct notification_event_tracer_event_source_element *source_element = NULL;
+       struct notification_event_tracer_event_source_element *source_element = nullptr;
 
        source_element = find_tracer_event_source_element(state, tracer_event_source_fd);
 
@@ -2266,7 +2266,7 @@ handle_notification_thread_command_list_triggers(struct notification_thread_hand
        enum lttng_error_code cmd_result = LTTNG_OK;
        struct cds_lfht_iter iter;
        struct lttng_trigger_ht_element *trigger_ht_element;
-       struct lttng_triggers *local_triggers = NULL;
+       struct lttng_triggers *local_triggers = nullptr;
        const struct lttng_credentials *creds;
 
        rcu_read_lock();
@@ -2299,7 +2299,7 @@ handle_notification_thread_command_list_triggers(struct notification_thread_hand
 
        /* Transferring ownership to the caller. */
        *triggers = local_triggers;
-       local_triggers = NULL;
+       local_triggers = nullptr;
 
 end:
        rcu_read_unlock();
@@ -2596,7 +2596,7 @@ static enum lttng_error_code setup_tracer_notifier(struct notification_thread_st
        struct cds_lfht_node *node;
        uint64_t error_counter_index = 0;
        struct lttng_condition *condition = lttng_trigger_get_condition(trigger);
-       struct notification_trigger_tokens_ht_element *trigger_tokens_ht_element = NULL;
+       struct notification_trigger_tokens_ht_element *trigger_tokens_ht_element = nullptr;
 
        trigger_tokens_ht_element = zmalloc<notification_trigger_tokens_ht_element>();
        if (!trigger_tokens_ht_element) {
@@ -2670,12 +2670,12 @@ handle_notification_thread_command_register_trigger(struct notification_thread_s
 {
        int ret = 0;
        struct lttng_condition *condition;
-       struct notification_client_list *client_list = NULL;
-       struct lttng_trigger_ht_element *trigger_ht_element = NULL;
+       struct notification_client_list *client_list = nullptr;
+       struct lttng_trigger_ht_element *trigger_ht_element = nullptr;
        struct cds_lfht_node *node;
        const char *trigger_name;
        bool free_trigger = true;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
        struct lttng_credentials object_creds;
        uid_t object_uid;
        gid_t object_gid;
@@ -2812,7 +2812,7 @@ handle_notification_thread_command_register_trigger(struct notification_thread_s
         * Ownership of the trigger and of its wrapper was transfered to
         * the triggers_ht. Same for token ht element if necessary.
         */
-       trigger_ht_element = NULL;
+       trigger_ht_element = nullptr;
        free_trigger = false;
 
        switch (get_condition_binding_object(condition)) {
@@ -2887,7 +2887,7 @@ handle_notification_thread_command_register_trigger(struct notification_thread_s
                LTTNG_OPTIONAL_SET(&object_creds.uid, session_info->uid);
                LTTNG_OPTIONAL_SET(&object_creds.gid, session_info->gid);
 
-               ret = evaluate_session_condition(condition, session_info, NULL, &evaluation);
+               ret = evaluate_session_condition(condition, session_info, nullptr, &evaluation);
                session_info_put(session_info);
                break;
        }
@@ -2924,7 +2924,7 @@ handle_notification_thread_command_register_trigger(struct notification_thread_s
         */
        executor_status = action_executor_enqueue_trigger(
                state->executor, trigger, evaluation, &object_creds, client_list);
-       evaluation = NULL;
+       evaluation = nullptr;
        switch (executor_status) {
        case ACTION_EXECUTOR_STATUS_OK:
                break;
@@ -3048,7 +3048,7 @@ handle_notification_thread_command_unregister_trigger(struct notification_thread
        struct cds_lfht_iter iter;
        struct cds_lfht_node *triggers_ht_node;
        struct notification_client_list *client_list;
-       struct lttng_trigger_ht_element *trigger_ht_element = NULL;
+       struct lttng_trigger_ht_element *trigger_ht_element = nullptr;
        const struct lttng_condition *condition = lttng_trigger_get_const_condition(trigger);
        enum lttng_error_code cmd_reply;
 
@@ -3139,7 +3139,7 @@ handle_notification_thread_command_unregister_trigger(struct notification_thread
                /* Put new reference and the hashtable's reference. */
                notification_client_list_put(client_list);
                notification_client_list_put(client_list);
-               client_list = NULL;
+               client_list = nullptr;
        }
 
        /* Remove trigger from triggers_ht. */
@@ -3259,7 +3259,7 @@ int handle_notification_thread_command(struct notification_thread_handle *handle
                break;
        case NOTIFICATION_COMMAND_TYPE_LIST_TRIGGERS:
        {
-               struct lttng_triggers *triggers = NULL;
+               struct lttng_triggers *triggers = nullptr;
 
                ret = handle_notification_thread_command_list_triggers(
                        handle,
@@ -3277,7 +3277,7 @@ int handle_notification_thread_command(struct notification_thread_handle *handle
                goto end;
        case NOTIFICATION_COMMAND_TYPE_GET_TRIGGER:
        {
-               struct lttng_trigger *trigger = NULL;
+               struct lttng_trigger *trigger = nullptr;
 
                ret = handle_notification_thread_command_get_trigger(
                        state, cmd->parameters.get_trigger.trigger, &trigger, &cmd->reply_code);
@@ -3321,7 +3321,7 @@ int handle_notification_thread_command(struct notification_thread_handle *handle
 end:
        if (cmd->is_async) {
                free(cmd);
-               cmd = NULL;
+               cmd = nullptr;
        } else {
                lttng_waiter_wake_up(&cmd->reply_waiter);
        }
@@ -3388,7 +3388,7 @@ int handle_notification_thread_client_connect(struct notification_thread_state *
                goto error;
        }
 
-       pthread_mutex_init(&client->lock, NULL);
+       pthread_mutex_init(&client->lock, nullptr);
        client->id = state->next_notification_client_id++;
        CDS_INIT_LIST_HEAD(&client->condition_list);
        lttng_payload_init(&client->communication.inbound.payload);
@@ -3475,7 +3475,7 @@ static int notification_thread_client_disconnect(struct notification_client *cli
        /* Release all conditions to which the client was subscribed. */
        cds_list_for_each_entry_safe (condition_list_element, tmp, &client->condition_list, node) {
                (void) notification_thread_client_unsubscribe(
-                       client, condition_list_element->condition, state, NULL);
+                       client, condition_list_element->condition, state, nullptr);
        }
 
        /*
@@ -3537,7 +3537,7 @@ int handle_notification_thread_trigger_unregister_all(struct notification_thread
        rcu_read_lock();
        cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
                int ret = handle_notification_thread_command_unregister_trigger(
-                       state, trigger_ht_element->trigger, NULL);
+                       state, trigger_ht_element->trigger, nullptr);
                if (ret) {
                        error_occurred = true;
                }
@@ -3833,7 +3833,7 @@ static int client_handle_message_unknown(struct notification_client *client,
                                            msg->size);
 
        /* msg is not valid anymore due to lttng_dynamic_buffer_set_size. */
-       msg = NULL;
+       msg = nullptr;
 end:
        return ret;
 }
@@ -4541,8 +4541,8 @@ recv_one_event_notifier_notification(int notification_pipe_read_fd, enum lttng_d
 {
        int ret;
        uint64_t token;
-       struct lttng_event_notifier_notification *notification = NULL;
-       char *capture_buffer = NULL;
+       struct lttng_event_notifier_notification *notification = nullptr;
+       char *capture_buffer = nullptr;
        size_t capture_buffer_size;
        void *reception_buffer;
        size_t reception_size;
@@ -4592,7 +4592,7 @@ recv_one_event_notifier_notification(int notification_pipe_read_fd, enum lttng_d
        }
 
        if (capture_buffer_size == 0) {
-               capture_buffer = NULL;
+               capture_buffer = nullptr;
                goto skip_capture;
        }
 
@@ -4619,14 +4619,14 @@ recv_one_event_notifier_notification(int notification_pipe_read_fd, enum lttng_d
 skip_capture:
        notification = lttng_event_notifier_notification_create(
                token, domain, capture_buffer, capture_buffer_size);
-       if (notification == NULL) {
+       if (notification == nullptr) {
                goto end;
        }
 
        /*
         * Ownership transfered to the lttng_event_notifier_notification object.
         */
-       capture_buffer = NULL;
+       capture_buffer = nullptr;
 
 end:
        free(capture_buffer);
@@ -4640,9 +4640,9 @@ dispatch_one_event_notifier_notification(struct notification_thread_state *state
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
        struct notification_trigger_tokens_ht_element *element;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
        enum action_executor_status executor_status;
-       struct notification_client_list *client_list = NULL;
+       struct notification_client_list *client_list = nullptr;
        int ret;
        unsigned int capture_count = 0;
 
@@ -4688,7 +4688,7 @@ dispatch_one_event_notifier_notification(struct notification_thread_state *state
                notification->capture_buf_size,
                false);
 
-       if (evaluation == NULL) {
+       if (evaluation == nullptr) {
                ERR("Failed to create event rule matches evaluation while creating and enqueuing action executor job");
                ret = -1;
                goto end_unlock;
@@ -4697,7 +4697,7 @@ dispatch_one_event_notifier_notification(struct notification_thread_state *state
        client_list = get_client_list_from_condition(
                state, lttng_trigger_get_const_condition(element->trigger));
        executor_status = action_executor_enqueue_trigger(
-               state->executor, element->trigger, evaluation, NULL, client_list);
+               state->executor, element->trigger, evaluation, nullptr, client_list);
        switch (executor_status) {
        case ACTION_EXECUTOR_STATUS_OK:
                ret = 0;
@@ -4770,10 +4770,10 @@ static int handle_one_event_notifier_notification(struct notification_thread_sta
                                                  enum lttng_domain_type domain)
 {
        int ret = 0;
-       struct lttng_event_notifier_notification *notification = NULL;
+       struct lttng_event_notifier_notification *notification = nullptr;
 
        notification = recv_one_event_notifier_notification(pipe, domain);
-       if (notification == NULL) {
+       if (notification == nullptr) {
                /* Reception failed, don't consider it fatal. */
                ERR("Error receiving an event notifier notification from tracer: fd = %i, domain = %s",
                    pipe,
@@ -4807,7 +4807,7 @@ int handle_notification_thread_channel_sample(struct notification_thread_state *
 {
        int ret = 0;
        struct lttcomm_consumer_channel_monitor_msg sample_msg;
-       struct channel_info *channel_info = NULL;
+       struct channel_info *channel_info = nullptr;
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
        struct lttng_channel_trigger_list *channel_trigger_list;
@@ -4858,8 +4858,8 @@ int handle_notification_thread_channel_sample(struct notification_thread_state *
        cds_list_for_each_entry (trigger_list_element, &session_trigger_list->list, node) {
                const struct lttng_condition *condition;
                struct lttng_trigger *trigger;
-               struct notification_client_list *client_list = NULL;
-               struct lttng_evaluation *evaluation = NULL;
+               struct notification_client_list *client_list = nullptr;
+               struct lttng_evaluation *evaluation = nullptr;
                enum action_executor_status executor_status;
 
                ret = 0;
@@ -4886,7 +4886,7 @@ int handle_notification_thread_channel_sample(struct notification_thread_state *
                executor_status = action_executor_enqueue_trigger(
                        state->executor, trigger, evaluation, &session_creds, client_list);
                notification_client_list_put(client_list);
-               evaluation = NULL;
+               evaluation = nullptr;
                switch (executor_status) {
                case ACTION_EXECUTOR_STATUS_OK:
                        break;
@@ -5003,8 +5003,8 @@ int handle_notification_thread_channel_sample(struct notification_thread_state *
        cds_list_for_each_entry (trigger_list_element, &channel_trigger_list->list, node) {
                const struct lttng_condition *condition;
                struct lttng_trigger *trigger;
-               struct notification_client_list *client_list = NULL;
-               struct lttng_evaluation *evaluation = NULL;
+               struct notification_client_list *client_list = nullptr;
+               struct lttng_evaluation *evaluation = nullptr;
                enum action_executor_status executor_status;
 
                ret = 0;
@@ -5016,7 +5016,7 @@ int handle_notification_thread_channel_sample(struct notification_thread_state *
                        condition,
                        &evaluation,
                        state,
-                       previous_sample_available ? &channel_previous_sample : NULL,
+                       previous_sample_available ? &channel_previous_sample : nullptr,
                        &channel_new_sample,
                        channel_info);
                if (caa_unlikely(ret)) {
@@ -5036,7 +5036,7 @@ int handle_notification_thread_channel_sample(struct notification_thread_state *
                executor_status = action_executor_enqueue_trigger(
                        state->executor, trigger, evaluation, &channel_creds, client_list);
                notification_client_list_put(client_list);
-               evaluation = NULL;
+               evaluation = nullptr;
                switch (executor_status) {
                case ACTION_EXECUTOR_STATUS_OK:
                        break;
index bd3ba44ded5f5f10ecb7c6a76aa4d5b4ae09bb15..72aa08292141c7b8d7439fc3d9579ca8d3183c40 100644 (file)
@@ -113,7 +113,7 @@ notification_thread_handle_create(struct lttng_pipe *ust32_channel_monitor_pipe,
        handle->cmd_queue.event_fd = event_fd;
 
        CDS_INIT_LIST_HEAD(&handle->cmd_queue.list);
-       ret = pthread_mutex_init(&handle->cmd_queue.lock, NULL);
+       ret = pthread_mutex_init(&handle->cmd_queue.lock, nullptr);
        if (ret) {
                goto error;
        }
@@ -150,10 +150,10 @@ end:
        return handle;
 error:
        notification_thread_handle_destroy(handle);
-       return NULL;
+       return nullptr;
 }
 
-static char *get_notification_channel_sock_path(void)
+static char *get_notification_channel_sock_path()
 {
        int ret;
        bool is_root = !getuid();
@@ -190,7 +190,7 @@ static char *get_notification_channel_sock_path(void)
        return sock_path;
 error:
        free(sock_path);
-       return NULL;
+       return nullptr;
 }
 
 static void notification_channel_socket_destroy(int fd)
@@ -214,7 +214,7 @@ static void notification_channel_socket_destroy(int fd)
        }
 }
 
-static int notification_channel_socket_create(void)
+static int notification_channel_socket_create()
 {
        int fd = -1, ret;
        char *sock_path = get_notification_channel_sock_path();
@@ -324,45 +324,45 @@ static void fini_thread_state(struct notification_thread_state *state)
        if (state->client_socket_ht) {
                ret = handle_notification_thread_client_disconnect_all(state);
                LTTNG_ASSERT(!ret);
-               ret = cds_lfht_destroy(state->client_socket_ht, NULL);
+               ret = cds_lfht_destroy(state->client_socket_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->client_id_ht) {
-               ret = cds_lfht_destroy(state->client_id_ht, NULL);
+               ret = cds_lfht_destroy(state->client_id_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->triggers_ht) {
                ret = handle_notification_thread_trigger_unregister_all(state);
                LTTNG_ASSERT(!ret);
-               ret = cds_lfht_destroy(state->triggers_ht, NULL);
+               ret = cds_lfht_destroy(state->triggers_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->channel_triggers_ht) {
-               ret = cds_lfht_destroy(state->channel_triggers_ht, NULL);
+               ret = cds_lfht_destroy(state->channel_triggers_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->channel_state_ht) {
-               ret = cds_lfht_destroy(state->channel_state_ht, NULL);
+               ret = cds_lfht_destroy(state->channel_state_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->notification_trigger_clients_ht) {
-               ret = cds_lfht_destroy(state->notification_trigger_clients_ht, NULL);
+               ret = cds_lfht_destroy(state->notification_trigger_clients_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->channels_ht) {
-               ret = cds_lfht_destroy(state->channels_ht, NULL);
+               ret = cds_lfht_destroy(state->channels_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->sessions_ht) {
-               ret = cds_lfht_destroy(state->sessions_ht, NULL);
+               ret = cds_lfht_destroy(state->sessions_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->triggers_by_name_uid_ht) {
-               ret = cds_lfht_destroy(state->triggers_by_name_uid_ht, NULL);
+               ret = cds_lfht_destroy(state->triggers_by_name_uid_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->trigger_tokens_ht) {
-               ret = cds_lfht_destroy(state->trigger_tokens_ht, NULL);
+               ret = cds_lfht_destroy(state->trigger_tokens_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        /*
@@ -370,7 +370,7 @@ static void fini_thread_state(struct notification_thread_state *state)
         * See comment in struct lttng_session_trigger_list.
         */
        if (state->session_triggers_ht) {
-               ret = cds_lfht_destroy(state->session_triggers_ht, NULL);
+               ret = cds_lfht_destroy(state->session_triggers_ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        if (state->notification_channel_socket >= 0) {
@@ -427,64 +427,64 @@ static int init_thread_state(struct notification_thread_handle *handle,
        }
 
        state->client_socket_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->client_socket_ht) {
                goto error;
        }
 
        state->client_id_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->client_id_ht) {
                goto error;
        }
 
        state->channel_triggers_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->channel_triggers_ht) {
                goto error;
        }
 
        state->session_triggers_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->session_triggers_ht) {
                goto error;
        }
 
        state->channel_state_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->channel_state_ht) {
                goto error;
        }
 
        state->notification_trigger_clients_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->notification_trigger_clients_ht) {
                goto error;
        }
 
        state->channels_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->channels_ht) {
                goto error;
        }
        state->sessions_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->sessions_ht) {
                goto error;
        }
        state->triggers_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->triggers_ht) {
                goto error;
        }
        state->triggers_by_name_uid_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->triggers_by_name_uid_ht) {
                goto error;
        }
 
        state->trigger_tokens_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!state->trigger_tokens_ht) {
                goto error;
        }
@@ -753,7 +753,7 @@ end:
        rcu_thread_offline();
        rcu_unregister_thread();
        health_unregister(the_health_sessiond);
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_notification_thread(void *thread_data)
@@ -769,7 +769,7 @@ struct lttng_thread *launch_notification_thread(struct notification_thread_handl
        struct lttng_thread *thread;
 
        thread = lttng_thread_create(
-               "Notification", thread_notification, shutdown_notification_thread, NULL, handle);
+               "Notification", thread_notification, shutdown_notification_thread, nullptr, handle);
        if (!thread) {
                goto error;
        }
@@ -782,5 +782,5 @@ struct lttng_thread *launch_notification_thread(struct notification_thread_handl
        wait_until_thread_is_ready(handle);
        return thread;
 error:
-       return NULL;
+       return nullptr;
 }
index 5d67a914f8ecbc6abefba99b8a6709bd33efd61c..a73e9df5837cb0723b4190ce0fd1f50a025b3b5c 100644 (file)
@@ -69,7 +69,7 @@ static void *thread_application_notification(void *data)
 
        health_code_update();
 
-       while (1) {
+       while (true) {
                DBG3("[ust-thread] Manage notify polling");
 
                /* Inifinite blocking call, waiting for transmission */
@@ -197,7 +197,7 @@ error_testpoint:
        health_unregister(the_health_sessiond);
        rcu_thread_offline();
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_application_notification_thread(void *data)
index 518536e21ac31430d6171e7d740687787ce660b0..ebc8bb548755e7983f40354427668d67d6be3ccb 100644 (file)
@@ -12,7 +12,7 @@
 #include <signal.h>
 
 /* Notify parents that we are ready for cmd and health check */
-void sessiond_signal_parents(void)
+void sessiond_signal_parents()
 {
        /*
         * Notify parent pid that we are ready to accept command
index 039e54d6f7abd045ac1b0b5c9471a45fd00d5ad7..3740b380acddf6039ffa2cc13bf49da4d0e7ac16 100644 (file)
@@ -38,7 +38,7 @@ struct thread_state {
 /*
  * Creates the application socket.
  */
-static int create_application_socket(void)
+static int create_application_socket()
 {
        int ret = 0;
        int apps_sock;
@@ -92,7 +92,7 @@ static int notify_ust_apps(int active, bool is_root)
 
        /* See shm.c for this call implying mmap, shm and futex calls */
        wait_shm_mmap = shm_ust_get_mmap(the_config.wait_shm_path.value, is_root);
-       if (wait_shm_mmap == NULL) {
+       if (wait_shm_mmap == nullptr) {
                goto error;
        }
 
@@ -157,7 +157,7 @@ static void *thread_application_registration(void *data)
         * Gets allocated in this thread, enqueued to a global queue, dequeued
         * and freed in the manage apps thread.
         */
-       struct ust_command *ust_cmd = NULL;
+       struct ust_command *ust_cmd = nullptr;
        const bool is_root = (getuid() == 0);
        struct thread_state *thread_state = (struct thread_state *) data;
        const int application_socket = thread_state->application_socket;
@@ -201,7 +201,7 @@ static void *thread_application_registration(void *data)
                goto error_poll_add;
        }
 
-       while (1) {
+       while (true) {
                DBG("Accepting application registration");
 
                /* Inifinite blocking call, waiting for transmission */
@@ -263,7 +263,7 @@ static void *thread_application_registration(void *data)
 
                                /* Create UST registration command for enqueuing */
                                ust_cmd = zmalloc<ust_command>();
-                               if (ust_cmd == NULL) {
+                               if (ust_cmd == nullptr) {
                                        PERROR("ust command zmalloc");
                                        ret = close(sock);
                                        if (ret) {
@@ -370,7 +370,7 @@ error_create_poll:
                ERR("Health error occurred in %s", __func__);
        }
        health_unregister(the_health_sessiond);
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_application_registration_thread(void *data)
@@ -385,8 +385,8 @@ struct lttng_thread *launch_application_registration_thread(struct ust_cmd_queue
 {
        int ret;
        struct lttng_pipe *quit_pipe;
-       struct thread_state *thread_state = NULL;
-       struct lttng_thread *thread = NULL;
+       struct thread_state *thread_state = nullptr;
+       struct lttng_thread *thread = nullptr;
        const bool is_root = (getuid() == 0);
        int application_socket = -1;
 
@@ -422,7 +422,7 @@ struct lttng_thread *launch_application_registration_thread(struct ust_cmd_queue
         */
        application_socket = -1;
        if (!wait_thread_status(thread_state)) {
-               thread_state = NULL;
+               thread_state = nullptr;
                goto error;
        }
 
@@ -444,5 +444,5 @@ error:
                }
        }
 error_alloc:
-       return NULL;
+       return nullptr;
 }
index 7b0936f48fe70ffcb4607642d38f6dbc1ca96a98..aa5dc4a8c40432a7c7a2f03dfb36e6982f0c150f 100644 (file)
@@ -42,7 +42,7 @@
 #include <urcu.h>
 #include <urcu/list.h>
 
-struct lttng_notification_channel *rotate_notification_channel = NULL;
+struct lttng_notification_channel *rotate_notification_channel = nullptr;
 
 struct rotation_thread {
        struct lttng_poll_event events;
@@ -87,9 +87,9 @@ static const char *get_job_type_str(enum rotation_thread_job_type job_type)
        }
 }
 
-struct rotation_thread_timer_queue *rotation_thread_timer_queue_create(void)
+struct rotation_thread_timer_queue *rotation_thread_timer_queue_create()
 {
-       struct rotation_thread_timer_queue *queue = NULL;
+       struct rotation_thread_timer_queue *queue = nullptr;
 
        queue = zmalloc<rotation_thread_timer_queue>();
        if (!queue) {
@@ -99,7 +99,7 @@ struct rotation_thread_timer_queue *rotation_thread_timer_queue_create(void)
 
        queue->event_pipe = lttng_pipe_open(FD_CLOEXEC | O_NONBLOCK);
        CDS_INIT_LIST_HEAD(&queue->list);
-       pthread_mutex_init(&queue->lock, NULL);
+       pthread_mutex_init(&queue->lock, nullptr);
 end:
        return queue;
 }
@@ -150,7 +150,7 @@ end:
        return handle;
 error:
        rotation_thread_handle_destroy(handle);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -180,7 +180,7 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue,
 {
        int ret;
        const char dummy = '!';
-       struct rotation_thread_job *job = NULL;
+       struct rotation_thread_job *job = nullptr;
        const char *job_type_str = get_job_type_str(job_type);
 
        pthread_mutex_lock(&queue->lock);
@@ -460,7 +460,7 @@ check_session_rotation_pending(struct ltt_session *session,
         * rotations can start now.
         */
        chunk_status = lttng_trace_chunk_get_name(
-               session->chunk_being_archived, &archived_chunk_name, NULL);
+               session->chunk_being_archived, &archived_chunk_name, nullptr);
        LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
        free(session->last_archived_chunk_name);
        session->last_archived_chunk_name = strdup(archived_chunk_name);
@@ -609,7 +609,7 @@ static int handle_condition(const struct lttng_notification *notification,
                            struct notification_thread_handle *notification_thread_handle)
 {
        int ret = 0;
-       const char *condition_session_name = NULL;
+       const char *condition_session_name = nullptr;
        enum lttng_condition_type condition_type;
        enum lttng_condition_status condition_status;
        enum lttng_evaluation_status evaluation_status;
@@ -673,7 +673,7 @@ static int handle_condition(const struct lttng_notification *notification,
        }
 
        ret = cmd_rotate_session(
-               session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+               session, nullptr, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
        switch (ret) {
        case LTTNG_OK:
                break;
@@ -714,7 +714,7 @@ static int handle_notification_channel(int fd __attribute__((unused)),
 {
        int ret;
        bool notification_pending;
-       struct lttng_notification *notification = NULL;
+       struct lttng_notification *notification = nullptr;
        enum lttng_notification_channel_status status;
 
        status = lttng_notification_channel_has_pending_notification(rotate_notification_channel,
@@ -862,7 +862,7 @@ end:
        health_unregister(the_health_sessiond);
        rcu_thread_offline();
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_rotation_thread(void *thread_data)
@@ -878,7 +878,7 @@ bool launch_rotation_thread(struct rotation_thread_handle *handle)
        struct lttng_thread *thread;
 
        thread = lttng_thread_create(
-               "Rotation", thread_rotation, shutdown_rotation_thread, NULL, handle);
+               "Rotation", thread_rotation, shutdown_rotation_thread, nullptr, handle);
        if (!thread) {
                goto error;
        }
index bef38e61934b554f1564788411fb8346580cdbb0..7333c50930db01aad5cdc4dc3fa9e9530034dcc0 100644 (file)
@@ -101,7 +101,7 @@ static int save_kernel_channel_attributes(struct config_writer *writer,
        }
 
        if (attr->extended.ptr) {
-               struct lttng_channel_extended *ext = NULL;
+               struct lttng_channel_extended *ext = nullptr;
 
                ext = (struct lttng_channel_extended *) attr->extended.ptr;
                ret = config_writer_write_element_unsigned_int(
@@ -129,7 +129,7 @@ static int save_ust_channel_attributes(struct config_writer *writer,
                                       struct lttng_ust_abi_channel_attr *attr)
 {
        int ret;
-       struct ltt_ust_channel *channel = NULL;
+       struct ltt_ust_channel *channel = nullptr;
 
        ret = config_writer_write_element_string(writer,
                                                 config_element_overwrite_mode,
@@ -233,7 +233,7 @@ get_kernel_instrumentation_string(enum lttng_kernel_abi_instrumentation instrume
                instrumentation_string = config_event_type_syscall;
                break;
        default:
-               instrumentation_string = NULL;
+               instrumentation_string = nullptr;
        }
 
        return instrumentation_string;
@@ -353,7 +353,7 @@ static const char *get_kernel_context_type_string(enum lttng_kernel_abi_context_
                context_type_string = config_event_context_vsgid;
                break;
        default:
-               context_type_string = NULL;
+               context_type_string = nullptr;
        }
 
        return context_type_string;
@@ -430,7 +430,7 @@ static const char *get_ust_context_type_string(enum lttng_ust_abi_context_type c
                 * are stored as a node of type event_perf_context_type.
                 */
        default:
-               context_type_string = NULL;
+               context_type_string = nullptr;
                break;
        }
 
@@ -452,7 +452,7 @@ static const char *get_buffer_type_string(enum lttng_buffer_type buffer_type)
                buffer_type_string = config_buffer_type_global;
                break;
        default:
-               buffer_type_string = NULL;
+               buffer_type_string = nullptr;
        }
 
        return buffer_type_string;
@@ -473,7 +473,7 @@ static const char *get_loglevel_type_string(enum lttng_ust_abi_loglevel_type log
                loglevel_type_string = config_loglevel_type_single;
                break;
        default:
-               loglevel_type_string = NULL;
+               loglevel_type_string = nullptr;
        }
 
        return loglevel_type_string;
@@ -522,12 +522,12 @@ static int save_kernel_kprobe_event(struct config_writer *writer, struct ltt_ker
                 */
                addr = event->event->u.kprobe.addr;
                offset = event->event->u.kprobe.offset;
-               symbol_name = addr ? NULL : event->event->u.kprobe.symbol_name;
+               symbol_name = addr ? nullptr : event->event->u.kprobe.symbol_name;
                break;
        case LTTNG_KERNEL_ABI_KRETPROBE:
                addr = event->event->u.kretprobe.addr;
                offset = event->event->u.kretprobe.offset;
-               symbol_name = addr ? NULL : event->event->u.kretprobe.symbol_name;
+               symbol_name = addr ? nullptr : event->event->u.kretprobe.symbol_name;
                break;
        default:
                LTTNG_ASSERT(1);
@@ -1629,7 +1629,7 @@ static int save_ust_channel(struct config_writer *writer,
                        goto end;
                }
        } else {
-               struct agent *agent = NULL;
+               struct agent *agent = nullptr;
 
                agent = trace_ust_find_agent(session, ust_chan->domain);
                if (!agent) {
@@ -1752,7 +1752,7 @@ static int save_process_attr_tracker(struct config_writer *writer,
        const char *element_id_tracker, *element_target_id, *element_id;
        const struct process_attr_tracker *tracker;
        enum lttng_tracking_policy tracking_policy;
-       struct lttng_process_attr_values *values = NULL;
+       struct lttng_process_attr_values *values = nullptr;
 
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_PROCESS_ID:
@@ -1844,7 +1844,7 @@ static int save_process_attr_tracker(struct config_writer *writer,
 
                for (i = 0; i < count; i++) {
                        unsigned int integral_value = UINT_MAX;
-                       const char *name = NULL;
+                       const char *name = nullptr;
                        const struct process_attr_value *value =
                                lttng_process_attr_tracker_values_get_at_index(values, i);
 
@@ -2499,7 +2499,7 @@ static int save_session(struct ltt_session *session,
        int ret, fd = -1;
        char config_file_path[LTTNG_PATH_MAX];
        size_t len;
-       struct config_writer *writer = NULL;
+       struct config_writer *writer = nullptr;
        size_t session_name_len;
        const char *provided_path;
        int file_open_flags = O_CREAT | O_WRONLY | O_TRUNC;
index 54b255e056dff80b445420e5ed33b73b0c0d0a3b..0549d36de6b2ba9f9d6bf1770cb493c253c2da1c 100644 (file)
@@ -59,9 +59,9 @@ namespace ls = lttng::sessiond;
 const char *forbidden_name_chars = "/";
 
 /* Global hash table to keep the sessions, indexed by id. */
-struct lttng_ht *ltt_sessions_ht_by_id = NULL;
+struct lttng_ht *ltt_sessions_ht_by_id = nullptr;
 /* Global hash table to keep the sessions, indexed by name. */
-struct lttng_ht *ltt_sessions_ht_by_name = NULL;
+struct lttng_ht *ltt_sessions_ht_by_name = nullptr;
 
 /*
  * Init tracing session list.
@@ -138,7 +138,7 @@ static void del_session_list(struct ltt_session *ls)
 /*
  * Return a pointer to the session list.
  */
-struct ltt_session_list *session_get_list(void)
+struct ltt_session_list *session_get_list()
 {
        return &the_session_list;
 }
@@ -146,7 +146,7 @@ struct ltt_session_list *session_get_list(void)
 /*
  * Returns once the session list is empty.
  */
-void session_list_wait_empty(void)
+void session_list_wait_empty()
 {
        pthread_mutex_lock(&the_session_list.lock);
        while (!cds_list_empty(&the_session_list.head)) {
@@ -158,7 +158,7 @@ void session_list_wait_empty(void)
 /*
  * Acquire session list lock
  */
-void session_lock_list(void)
+void session_lock_list()
 {
        pthread_mutex_lock(&the_session_list.lock);
 }
@@ -166,7 +166,7 @@ void session_lock_list(void)
 /*
  * Try to acquire session list lock
  */
-int session_trylock_list(void)
+int session_trylock_list()
 {
        return pthread_mutex_trylock(&the_session_list.lock);
 }
@@ -174,7 +174,7 @@ int session_trylock_list(void)
 /*
  * Release session list lock
  */
-void session_unlock_list(void)
+void session_unlock_list()
 {
        pthread_mutex_unlock(&the_session_list.lock);
 }
@@ -203,7 +203,7 @@ enum consumer_dst_type session_get_consumer_destination_type(const struct ltt_se
  */
 const char *session_get_net_consumer_hostname(const struct ltt_session *session)
 {
-       const char *hostname = NULL;
+       const char *hostname = nullptr;
        const struct consumer_output *output;
 
        output = session->kernel_session ? session->kernel_session->consumer :
@@ -253,8 +253,8 @@ struct lttng_trace_archive_location *
 session_get_trace_archive_location(const struct ltt_session *session)
 {
        int ret;
-       struct lttng_trace_archive_location *location = NULL;
-       char *chunk_path = NULL;
+       struct lttng_trace_archive_location *location = nullptr;
+       char *chunk_path = nullptr;
 
        if (session->rotation_state != LTTNG_ROTATION_STATE_COMPLETED ||
            !session->last_archived_chunk_name) {
@@ -300,7 +300,7 @@ end:
  *
  * The session list lock must be held.
  */
-static int ltt_sessions_ht_alloc(void)
+static int ltt_sessions_ht_alloc()
 {
        int ret = 0;
 
@@ -329,16 +329,16 @@ end:
  *
  * The session list lock must be held.
  */
-static void ltt_sessions_ht_destroy(void)
+static void ltt_sessions_ht_destroy()
 {
        if (ltt_sessions_ht_by_id) {
                lttng_ht_destroy(ltt_sessions_ht_by_id);
-               ltt_sessions_ht_by_id = NULL;
+               ltt_sessions_ht_by_id = nullptr;
        }
 
        if (ltt_sessions_ht_by_name) {
                lttng_ht_destroy(ltt_sessions_ht_by_name);
-               ltt_sessions_ht_by_name = NULL;
+               ltt_sessions_ht_by_name = nullptr;
        }
 
        return;
@@ -381,7 +381,7 @@ end:
  * Return `false` if hash table objects are null.
  * The session list lock must be held.
  */
-static bool ltt_sessions_ht_empty(void)
+static bool ltt_sessions_ht_empty()
 {
        bool empty = false;
 
@@ -481,14 +481,14 @@ static int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
         * `current_trace_chunk`.
         */
        current_trace_chunk = session->current_trace_chunk;
-       session->current_trace_chunk = NULL;
+       session->current_trace_chunk = nullptr;
        if (session->ust_session) {
                lttng_trace_chunk_put(session->ust_session->current_trace_chunk);
-               session->ust_session->current_trace_chunk = NULL;
+               session->ust_session->current_trace_chunk = nullptr;
        }
        if (session->kernel_session) {
                lttng_trace_chunk_put(session->kernel_session->current_trace_chunk);
-               session->kernel_session->current_trace_chunk = NULL;
+               session->kernel_session->current_trace_chunk = nullptr;
        }
        if (!new_trace_chunk) {
                ret = 0;
@@ -577,7 +577,7 @@ static int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
 end:
        if (_current_trace_chunk) {
                *_current_trace_chunk = current_trace_chunk;
-               current_trace_chunk = NULL;
+               current_trace_chunk = nullptr;
        }
 end_no_move:
        rcu_read_unlock();
@@ -585,10 +585,10 @@ end_no_move:
        return ret;
 error:
        if (session->ust_session) {
-               session->ust_session->current_trace_chunk = NULL;
+               session->ust_session->current_trace_chunk = nullptr;
        }
        if (session->kernel_session) {
-               session->kernel_session->current_trace_chunk = NULL;
+               session->kernel_session->current_trace_chunk = nullptr;
        }
        /*
         * Release references taken in the case where all references could not
@@ -609,12 +609,12 @@ session_create_new_trace_chunk(const struct ltt_session *session,
                               const char *chunk_name_override)
 {
        int ret;
-       struct lttng_trace_chunk *trace_chunk = NULL;
+       struct lttng_trace_chunk *trace_chunk = nullptr;
        enum lttng_trace_chunk_status chunk_status;
-       const time_t chunk_creation_ts = time(NULL);
+       const time_t chunk_creation_ts = time(nullptr);
        bool is_local_trace;
        const char *base_path;
-       struct lttng_directory_handle *session_output_directory = NULL;
+       struct lttng_directory_handle *session_output_directory = nullptr;
        const struct lttng_credentials session_credentials = {
                .uid = LTTNG_OPTIONAL_INIT_VALUE(session->uid),
                .gid = LTTNG_OPTIONAL_INIT_VALUE(session->gid),
@@ -655,7 +655,7 @@ session_create_new_trace_chunk(const struct ltt_session *session,
                if (!session->rotated) {
                        new_path = "";
                } else {
-                       new_path = NULL;
+                       new_path = nullptr;
                }
        } else {
                new_path = DEFAULT_CHUNK_TMP_NEW_DIRECTORY;
@@ -697,7 +697,7 @@ session_create_new_trace_chunk(const struct ltt_session *session,
        }
        chunk_status = lttng_trace_chunk_set_as_owner(trace_chunk, session_output_directory);
        lttng_directory_handle_put(session_output_directory);
-       session_output_directory = NULL;
+       session_output_directory = nullptr;
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                goto error;
        }
@@ -706,7 +706,7 @@ end:
 error:
        lttng_directory_handle_put(session_output_directory);
        lttng_trace_chunk_put(trace_chunk);
-       trace_chunk = NULL;
+       trace_chunk = nullptr;
        goto end;
 }
 
@@ -720,7 +720,7 @@ int session_close_trace_chunk(struct ltt_session *session,
        struct cds_lfht_iter iter;
        struct consumer_socket *socket;
        enum lttng_trace_chunk_status chunk_status;
-       const time_t chunk_close_timestamp = time(NULL);
+       const time_t chunk_close_timestamp = time(nullptr);
        const char *new_path;
 
        chunk_status = lttng_trace_chunk_set_close_command(trace_chunk, close_command);
@@ -741,7 +741,7 @@ int session_close_trace_chunk(struct ltt_session *session,
                new_path = "";
        } else {
                /* Use chunk name for new chunk. */
-               new_path = NULL;
+               new_path = nullptr;
        }
        if (session->current_trace_chunk &&
            !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
@@ -760,7 +760,7 @@ int session_close_trace_chunk(struct ltt_session *session,
                if (!session->rotated) {
                        old_path = "";
                } else {
-                       old_path = NULL;
+                       old_path = nullptr;
                }
                /* We need to move back the .tmp_old_chunk to its rightful place. */
                chunk_status = lttng_trace_chunk_rename_path(trace_chunk, old_path);
@@ -1000,10 +1000,10 @@ static void session_release(struct urcu_ref *ref)
 
        consumer_output_put(session->consumer);
        kernel_free_session(ksess);
-       session->kernel_session = NULL;
+       session->kernel_session = nullptr;
        if (usess) {
                trace_ust_free_session(usess);
-               session->ust_session = NULL;
+               session->ust_session = nullptr;
        }
        lttng_dynamic_array_reset(&session->destroy_notifiers);
        lttng_dynamic_array_reset(&session->clear_notifiers);
@@ -1121,9 +1121,9 @@ struct ltt_session *session_find_by_name(const char *name)
                }
        }
 
-       return NULL;
+       return nullptr;
 found:
-       return session_get(iter) ? iter : NULL;
+       return session_get(iter) ? iter : nullptr;
 }
 
 /*
@@ -1146,17 +1146,17 @@ struct ltt_session *session_find_by_id(uint64_t id)
 
        lttng_ht_lookup(ltt_sessions_ht_by_id, &id, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                goto end;
        }
        ls = lttng::utils::container_of(node, &ltt_session::node);
 
        DBG3("Session %" PRIu64 " found by id.", id);
-       return session_get(ls) ? ls : NULL;
+       return session_get(ls) ? ls : nullptr;
 
 end:
        DBG3("Session %" PRIu64 " NOT found by id", id);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1168,7 +1168,7 @@ session_create(const char *name, uid_t uid, gid_t gid, struct ltt_session **out_
 {
        int ret;
        enum lttng_error_code ret_code;
-       struct ltt_session *new_session = NULL;
+       struct ltt_session *new_session = nullptr;
 
        ASSERT_LOCKED(the_session_list.lock);
        if (name) {
@@ -1190,14 +1190,14 @@ session_create(const char *name, uid_t uid, gid_t gid, struct ltt_session **out_
 
        lttng_dynamic_array_init(&new_session->destroy_notifiers,
                                 sizeof(struct ltt_session_destroy_notifier_element),
-                                NULL);
+                                nullptr);
        lttng_dynamic_array_init(&new_session->clear_notifiers,
                                 sizeof(struct ltt_session_clear_notifier_element),
-                                NULL);
+                                nullptr);
        urcu_ref_init(&new_session->ref);
-       pthread_mutex_init(&new_session->lock, NULL);
+       pthread_mutex_init(&new_session->lock, nullptr);
 
-       new_session->creation_time = time(NULL);
+       new_session->creation_time = time(nullptr);
        if (new_session->creation_time == (time_t) -1) {
                PERROR("Failed to sample session creation time");
                ret_code = LTTNG_ERR_SESSION_FAIL;
@@ -1206,7 +1206,7 @@ session_create(const char *name, uid_t uid, gid_t gid, struct ltt_session **out_
 
        /* Create default consumer output. */
        new_session->consumer = consumer_create_output(CONSUMER_DST_LOCAL);
-       if (new_session->consumer == NULL) {
+       if (new_session->consumer == nullptr) {
                ret_code = LTTNG_ERR_NOMEM;
                goto error;
        }
@@ -1332,7 +1332,7 @@ end:
        return ret_code;
 error:
        session_put(new_session);
-       new_session = NULL;
+       new_session = nullptr;
        goto end;
 }
 
@@ -1380,7 +1380,7 @@ int session_reset_rotation_state(struct ltt_session *session, enum lttng_rotatio
                LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
                LTTNG_OPTIONAL_SET(&session->last_archived_chunk_id, chunk_id);
                lttng_trace_chunk_put(session->chunk_being_archived);
-               session->chunk_being_archived = NULL;
+               session->chunk_being_archived = nullptr;
                /*
                 * Fire the clear reply notifiers if we are completing a clear
                 * rotation.
@@ -1415,7 +1415,7 @@ bool sample_session_id_by_name(const char *name, uint64_t *id)
 
        lttng_ht_lookup(ltt_sessions_ht_by_name, name, &iter);
        node = lttng_ht_iter_get_node_str(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                found = false;
                goto end;
        }
index 7673fe10c3952f20c9f53188625fe1510e740ede..48f3532f182728fc1b7db8ef2cd23a91a9e613eb 100644 (file)
@@ -229,9 +229,9 @@ void session_unlock(struct ltt_session *session);
  * In other words, it prevents tracer configurations from changing while they
  * are being transmitted to the various applications.
  */
-void session_lock_list(void);
-int session_trylock_list(void);
-void session_unlock_list(void);
+void session_lock_list();
+int session_trylock_list();
+void session_unlock_list();
 
 void session_destroy(struct ltt_session *session);
 int session_add_destroy_notifier(struct ltt_session *session,
@@ -257,8 +257,8 @@ struct lttng_trace_archive_location *session_get_trace_archive_location(
 struct ltt_session *session_find_by_name(const char *name);
 struct ltt_session *session_find_by_id(ltt_session::id_t id);
 
-struct ltt_session_list *session_get_list(void);
-void session_list_wait_empty(void);
+struct ltt_session_list *session_get_list();
+void session_list_wait_empty();
 
 bool session_access_ok(struct ltt_session *session, uid_t uid);
 
index e45c1bd40013844b581ed312eb17f938d08ba025..e8aeae8efbddb4e805f8ed90fa2a9b9b9ff80b20 100644 (file)
@@ -72,7 +72,7 @@ static struct sessiond_config sessiond_config_build_defaults = {
 
 static void config_string_fini(struct config_string *str)
 {
-       config_string_set(str, NULL);
+       config_string_set(str, nullptr);
 }
 
 static void config_string_set_static(struct config_string *config_str, const char *value)
@@ -178,7 +178,7 @@ static int config_set_paths_non_root(struct sessiond_config *config)
        const char *home_path = utils_get_home_dir();
        char *str;
 
-       if (home_path == NULL) {
+       if (home_path == nullptr) {
                ERR("Can't get HOME directory for sockets creation.");
                ret = -1;
                goto end;
@@ -194,7 +194,7 @@ static int config_set_paths_non_root(struct sessiond_config *config)
                goto end;
        }
        config_string_set(&config->rundir, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_HOME_APPS_UNIX_SOCK, home_path);
        if (ret < 0) {
@@ -202,7 +202,7 @@ static int config_set_paths_non_root(struct sessiond_config *config)
                goto end;
        }
        config_string_set(&config->apps_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_HOME_CLIENT_UNIX_SOCK, home_path);
        if (ret < 0) {
@@ -210,7 +210,7 @@ static int config_set_paths_non_root(struct sessiond_config *config)
                goto end;
        }
        config_string_set(&config->client_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_HOME_APPS_WAIT_SHM_PATH, getuid());
        if (ret < 0) {
@@ -218,7 +218,7 @@ static int config_set_paths_non_root(struct sessiond_config *config)
                goto end;
        }
        config_string_set(&config->wait_shm_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_HOME_HEALTH_UNIX_SOCK, home_path);
        if (ret < 0) {
@@ -226,7 +226,7 @@ static int config_set_paths_non_root(struct sessiond_config *config)
                goto end;
        }
        config_string_set(&config->health_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = 0;
 end:
@@ -258,7 +258,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->consumerd32_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
@@ -266,7 +266,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->consumerd32_err_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
@@ -274,7 +274,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->consumerd32_cmd_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        /* 64 bits consumerd path setup */
        ret = asprintf(&str, DEFAULT_USTCONSUMERD64_PATH, config->rundir.value);
@@ -283,7 +283,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->consumerd64_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
@@ -291,7 +291,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->consumerd64_err_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
@@ -299,7 +299,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->consumerd64_cmd_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        /* kconsumerd consumerd path setup */
        ret = asprintf(&str, DEFAULT_KCONSUMERD_PATH, config->rundir.value);
@@ -308,7 +308,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->kconsumerd_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_KCONSUMERD_ERR_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
@@ -316,7 +316,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->kconsumerd_err_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, DEFAULT_KCONSUMERD_CMD_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
@@ -324,7 +324,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->kconsumerd_cmd_unix_sock_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_PIDFILE);
        if (ret < 0) {
@@ -332,7 +332,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->pid_file_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_LOCKFILE);
        if (ret < 0) {
@@ -340,7 +340,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->lock_file_path, str);
-       str = NULL;
+       str = nullptr;
 
        ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE);
        if (ret < 0) {
@@ -348,7 +348,7 @@ int sessiond_config_init(struct sessiond_config *config)
                goto error;
        }
        config_string_set(&config->agent_port_file_path, str);
-       str = NULL;
+       str = nullptr;
 
        /*
         * Allow INSTALL_BIN_PATH to be used as a target path for the
index dda699fc4bcf5ea6b6b8bf4c2d546ed336c5f7d9..1b48034c2e9c3a84d11895b6ff7e8dd221bc671b 100644 (file)
@@ -157,7 +157,7 @@ int snapshot_output_init(const struct ltt_session *session,
                         struct snapshot *snapshot)
 {
        int ret = 0, nb_uri;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
 
        /* Create an array of URIs from URLs. */
        nb_uri = uri_parse_str_urls(ctrl_url, data_url, &uris);
@@ -173,7 +173,7 @@ error:
        return ret;
 }
 
-struct snapshot_output *snapshot_output_alloc(void)
+struct snapshot_output *snapshot_output_alloc()
 {
        return zmalloc<snapshot_output>();
 }
@@ -244,7 +244,7 @@ void snapshot_output_destroy(struct snapshot_output *obj)
 struct snapshot_output *snapshot_find_output_by_name(const char *name, struct snapshot *snapshot)
 {
        struct lttng_ht_iter iter;
-       struct snapshot_output *output = NULL;
+       struct snapshot_output *output = nullptr;
 
        LTTNG_ASSERT(snapshot);
        LTTNG_ASSERT(name);
@@ -257,7 +257,7 @@ struct snapshot_output *snapshot_find_output_by_name(const char *name, struct sn
        }
 
        /* Not found */
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -270,7 +270,7 @@ struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
-       struct snapshot_output *output = NULL;
+       struct snapshot_output *output = nullptr;
 
        LTTNG_ASSERT(snapshot);
        ASSERT_RCU_READ_LOCKED();
index 6aa06ddc6fb02e6c34afa7ff6c16e92ca0b5162f..9053d3b4a84b54f0ec2629900e7ac171fcfedd0e 100644 (file)
@@ -52,7 +52,7 @@ struct snapshot {
 };
 
 /* Snapshot object. */
-struct snapshot *snapshot_alloc(void);
+struct snapshot *snapshot_alloc();
 void snapshot_destroy(struct snapshot *obj);
 int snapshot_init(struct snapshot *obj);
 void snapshot_delete_output(struct snapshot *snapshot,
@@ -61,7 +61,7 @@ void snapshot_add_output(struct snapshot *snapshot,
                struct snapshot_output *output);
 
 /* Snapshot output object. */
-struct snapshot_output *snapshot_output_alloc(void);
+struct snapshot_output *snapshot_output_alloc();
 void snapshot_output_destroy(struct snapshot_output *obj);
 int snapshot_output_init(const struct ltt_session *session,
                uint64_t max_size, const char *name,
index 5e8579a5e5fd65567e463256fb348ead05f671ff..3231d8acf859182d3dfcfb27b252b2f71509b344 100644 (file)
@@ -26,7 +26,7 @@ static int main_quit_pipe[2] = { -1, -1 };
  *
  * Return -1 on error or 0 if all pipes are created.
  */
-int sessiond_init_main_quit_pipe(void)
+int sessiond_init_main_quit_pipe()
 {
        int ret, i;
 
@@ -91,12 +91,12 @@ end:
        return ret;
 }
 
-int sessiond_notify_main_quit_pipe(void)
+int sessiond_notify_main_quit_pipe()
 {
        return notify_thread_pipe(main_quit_pipe[1]);
 }
 
-void sessiond_close_main_quit_pipe(void)
+void sessiond_close_main_quit_pipe()
 {
        utils_close_pipe(main_quit_pipe);
 }
index 661bc517b2f6a37e8ffa29c935d09f1583f73867..4077f460ef4c11dc31c5ce10b26ca2ed75348f06 100644 (file)
@@ -121,7 +121,7 @@ error_pthread_create:
        /* Release initial reference. */
        lttng_thread_put(thread);
 error_alloc:
-       return NULL;
+       return nullptr;
 }
 
 bool lttng_thread_get(struct lttng_thread *thread)
@@ -183,7 +183,7 @@ bool lttng_thread_shutdown(struct lttng_thread *thread)
        return result;
 }
 
-void lttng_thread_list_shutdown_orphans(void)
+void lttng_thread_list_shutdown_orphans()
 {
        struct lttng_thread *thread, *tmp;
 
index cc1cbd13d209f1bde11d96bb0cfc28dd48bba9b8..f35bb5803d864dd5d2503a7efbcdb51f6eb7d069 100644 (file)
@@ -57,6 +57,6 @@ bool lttng_thread_shutdown(struct lttng_thread *thread);
  *
  * Returns once all orphaned threads have been joined.
  */
-void lttng_thread_list_shutdown_orphans(void);
+void lttng_thread_list_shutdown_orphans();
 
 #endif /* THREAD_H */
index bb5f1d3eabf80cb78fefe6d9fbe0d448d41d4c7b..b99428041fabfae859620d6d338e1acdcf95d236 100644 (file)
@@ -166,7 +166,7 @@ static int timer_start(timer_t *timer_id,
                its.it_interval.tv_nsec = its.it_value.tv_nsec;
        }
 
-       ret = timer_settime(*timer_id, 0, &its, NULL);
+       ret = timer_settime(*timer_id, 0, &its, nullptr);
        if (ret == -1) {
                PERROR("timer_settime");
                goto error_destroy_timer;
@@ -194,7 +194,7 @@ static int timer_stop(timer_t *timer_id, int signal)
        }
 
        timer_signal_thread_qs(signal);
-       *timer_id = 0;
+       *timer_id = nullptr;
 end:
        return ret;
 }
@@ -316,14 +316,14 @@ end:
  * Block the RT signals for the entire process. It must be called from the
  * sessiond main before creating the threads
  */
-int timer_signal_init(void)
+int timer_signal_init()
 {
        int ret;
        sigset_t mask;
 
        /* Block signal for entire process, so only our thread processes it. */
        setmask(&mask);
-       ret = pthread_sigmask(SIG_BLOCK, &mask, NULL);
+       ret = pthread_sigmask(SIG_BLOCK, &mask, nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_sigmask");
@@ -352,7 +352,7 @@ static void *thread_timer(void *data)
        setmask(&mask);
        CMM_STORE_SHARED(timer_signal.tid, pthread_self());
 
-       while (1) {
+       while (true) {
                health_code_update();
 
                health_poll_entry();
@@ -402,7 +402,7 @@ end:
        health_unregister(the_health_sessiond);
        rcu_thread_offline();
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static bool shutdown_timer_thread(void *data __attribute__((unused)))
@@ -415,7 +415,7 @@ bool launch_timer_thread(struct timer_thread_parameters *timer_thread_parameters
        struct lttng_thread *thread;
 
        thread = lttng_thread_create(
-               "Timer", thread_timer, shutdown_timer_thread, NULL, timer_thread_parameters);
+               "Timer", thread_timer, shutdown_timer_thread, nullptr, timer_thread_parameters);
        if (!thread) {
                goto error;
        }
index 2070fcd3fb28d93e9f1c201139df62a0e2c86b09..4cf8e6f862e7d651a29aa39053bb75d423e880ea 100644 (file)
@@ -64,7 +64,7 @@ struct ltt_kernel_channel *trace_kernel_get_channel_by_name(const char *name,
                }
        }
 
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -104,7 +104,7 @@ struct ltt_kernel_event *trace_kernel_find_event(char *name,
                DBG("Found event %s for channel %s", name, channel->channel->name);
                return ev;
        } else {
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -135,7 +135,7 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(char *name,
                DBG("Found event %s for channel %s", name, channel->channel->name);
                return ev;
        } else {
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -144,13 +144,13 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(char *name,
  *
  * Return pointer to structure or NULL.
  */
-struct ltt_kernel_session *trace_kernel_create_session(void)
+struct ltt_kernel_session *trace_kernel_create_session()
 {
-       struct ltt_kernel_session *lks = NULL;
+       struct ltt_kernel_session *lks = nullptr;
 
        /* Allocate a new ltt kernel session */
        lks = zmalloc<ltt_kernel_session>();
-       if (lks == NULL) {
+       if (lks == nullptr) {
                PERROR("create kernel session zmalloc");
                goto alloc_error;
        }
@@ -160,7 +160,7 @@ struct ltt_kernel_session *trace_kernel_create_session(void)
        lks->metadata_stream_fd = -1;
        lks->channel_count = 0;
        lks->stream_count_global = 0;
-       lks->metadata = NULL;
+       lks->metadata = nullptr;
        CDS_INIT_LIST_HEAD(&lks->channel_list.head);
 
        lks->tracker_pid = process_attr_tracker_create();
@@ -188,7 +188,7 @@ struct ltt_kernel_session *trace_kernel_create_session(void)
                goto error;
        }
        lks->consumer = consumer_create_output(CONSUMER_DST_LOCAL);
-       if (lks->consumer == NULL) {
+       if (lks->consumer == nullptr) {
                goto error;
        }
 
@@ -204,7 +204,7 @@ error:
        free(lks);
 
 alloc_error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -215,18 +215,18 @@ alloc_error:
 struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *chan)
 {
        struct ltt_kernel_channel *lkc;
-       struct lttng_channel_extended *extended = NULL;
+       struct lttng_channel_extended *extended = nullptr;
 
        LTTNG_ASSERT(chan);
 
        lkc = zmalloc<ltt_kernel_channel>();
-       if (lkc == NULL) {
+       if (lkc == nullptr) {
                PERROR("ltt_kernel_channel zmalloc");
                goto error;
        }
 
        lkc->channel = zmalloc<lttng_channel>();
-       if (lkc->channel == NULL) {
+       if (lkc->channel == nullptr) {
                PERROR("lttng_channel zmalloc");
                goto error;
        }
@@ -239,7 +239,7 @@ struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *cha
        memcpy(lkc->channel, chan, sizeof(struct lttng_channel));
        memcpy(extended, chan->attr.extended.ptr, sizeof(struct lttng_channel_extended));
        lkc->channel->attr.extended.ptr = extended;
-       extended = NULL;
+       extended = nullptr;
 
        /*
         * If we receive an empty string for channel name, it means the
@@ -268,7 +268,7 @@ error:
        }
        free(extended);
        free(lkc);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -331,13 +331,13 @@ enum lttng_error_code trace_kernel_create_event(struct lttng_event *ev,
        enum lttng_error_code ret;
        struct lttng_kernel_abi_event *attr;
        struct ltt_kernel_event *local_kernel_event;
-       struct lttng_userspace_probe_location *userspace_probe_location = NULL;
+       struct lttng_userspace_probe_location *userspace_probe_location = nullptr;
 
        LTTNG_ASSERT(ev);
 
        local_kernel_event = zmalloc<ltt_kernel_event>();
        attr = zmalloc<lttng_kernel_abi_event>();
-       if (local_kernel_event == NULL || attr == NULL) {
+       if (local_kernel_event == nullptr || attr == nullptr) {
                PERROR("kernel event zmalloc");
                ret = LTTNG_ERR_NOMEM;
                goto error;
@@ -355,8 +355,8 @@ enum lttng_error_code trace_kernel_create_event(struct lttng_event *ev,
                break;
        case LTTNG_EVENT_USERSPACE_PROBE:
        {
-               const struct lttng_userspace_probe_location *location = NULL;
-               const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
+               const struct lttng_userspace_probe_location *location = nullptr;
+               const struct lttng_userspace_probe_location_lookup_method *lookup = nullptr;
 
                location = lttng_event_get_userspace_probe_location(ev);
                if (!location) {
@@ -488,8 +488,8 @@ trace_kernel_create_event_notifier_rule(struct lttng_trigger *trigger,
        enum lttng_event_rule_type event_rule_type;
        enum lttng_condition_status condition_status;
        struct ltt_kernel_event_notifier_rule *local_kernel_token_event_rule;
-       const struct lttng_condition *condition = NULL;
-       const struct lttng_event_rule *event_rule = NULL;
+       const struct lttng_condition *condition = nullptr;
+       const struct lttng_event_rule *event_rule = nullptr;
 
        LTTNG_ASSERT(event_notifier_rule);
 
@@ -507,7 +507,7 @@ trace_kernel_create_event_notifier_rule(struct lttng_trigger *trigger,
        LTTNG_ASSERT(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
 
        local_kernel_token_event_rule = zmalloc<ltt_kernel_event_notifier_rule>();
-       if (local_kernel_token_event_rule == NULL) {
+       if (local_kernel_token_event_rule == nullptr) {
                PERROR("Failed to allocate ltt_kernel_token_event_rule structure");
                ret = LTTNG_ERR_NOMEM;
                goto error;
@@ -547,8 +547,8 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
        case LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE:
        {
                uint64_t address = 0, offset = 0;
-               const char *symbol_name = NULL;
-               const struct lttng_kernel_probe_location *location = NULL;
+               const char *symbol_name = nullptr;
+               const struct lttng_kernel_probe_location *location = nullptr;
                enum lttng_kernel_probe_location_status k_status;
                enum lttng_event_rule_status status;
 
@@ -602,8 +602,8 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
        }
        case LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE:
        {
-               const struct lttng_userspace_probe_location *location = NULL;
-               const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
+               const struct lttng_userspace_probe_location *location = nullptr;
+               const struct lttng_userspace_probe_location_lookup_method *lookup = nullptr;
                enum lttng_event_rule_status status;
 
                status = lttng_event_rule_kernel_uprobe_get_location(rule, &location);
@@ -710,7 +710,7 @@ error:
  *
  * Return pointer to structure or NULL.
  */
-struct ltt_kernel_metadata *trace_kernel_create_metadata(void)
+struct ltt_kernel_metadata *trace_kernel_create_metadata()
 {
        int ret;
        struct ltt_kernel_metadata *lkm;
@@ -718,7 +718,7 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void)
 
        lkm = zmalloc<ltt_kernel_metadata>();
        chan = zmalloc<lttng_channel>();
-       if (lkm == NULL || chan == NULL) {
+       if (lkm == nullptr || chan == nullptr) {
                PERROR("kernel metadata zmalloc");
                goto error;
        }
@@ -763,7 +763,7 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void)
 error:
        free(lkm);
        free(chan);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -780,7 +780,7 @@ struct ltt_kernel_stream *trace_kernel_create_stream(const char *name, unsigned
        LTTNG_ASSERT(name);
 
        lks = zmalloc<ltt_kernel_stream>();
-       if (lks == NULL) {
+       if (lks == nullptr) {
                PERROR("kernel stream zmalloc");
                goto error;
        }
@@ -801,7 +801,7 @@ struct ltt_kernel_stream *trace_kernel_create_stream(const char *name, unsigned
        return lks;
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -999,7 +999,7 @@ void trace_kernel_destroy_session(struct ltt_kernel_session *session)
                }
        }
 
-       if (session->metadata != NULL) {
+       if (session->metadata != nullptr) {
                trace_kernel_destroy_metadata(session->metadata);
        }
 
index 50a58667ed88a7ad3f06f05aa6db51ebf96a62b7..febdf2e412e1be0dc98723c3b1fe77c6628f178a 100644 (file)
@@ -154,13 +154,13 @@ struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
 /*
  * Create functions malloc() the data structure.
  */
-struct ltt_kernel_session *trace_kernel_create_session(void);
+struct ltt_kernel_session *trace_kernel_create_session();
 struct ltt_kernel_channel *trace_kernel_create_channel(
                struct lttng_channel *chan);
 enum lttng_error_code trace_kernel_create_event(struct lttng_event *ev,
                char *filter_expression, struct lttng_bytecode *filter,
                struct ltt_kernel_event **kernel_event);
-struct ltt_kernel_metadata *trace_kernel_create_metadata(void);
+struct ltt_kernel_metadata *trace_kernel_create_metadata();
 struct ltt_kernel_stream *trace_kernel_create_stream(const char *name,
                unsigned int count);
 struct ltt_kernel_context *trace_kernel_create_context(
index bf57a4056df382c0210eec5dde37298b78831fe1..285e57909a87dd0902252058b4d3260ea802fe3a 100644 (file)
@@ -174,7 +174,7 @@ struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, cons
 
        lttng_ht_lookup(ht, (void *) name, &iter);
        node = lttng_ht_iter_get_node_str(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                goto error;
        }
 
@@ -184,7 +184,7 @@ struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, cons
 
 error:
        DBG2("Trace UST channel %s not found by name", name);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -218,7 +218,7 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
                        &key,
                        &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                goto error;
        }
 
@@ -228,7 +228,7 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
 
 error:
        DBG2("Trace UST event %s NOT found", key.name);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -241,7 +241,7 @@ error:
 struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
                                   enum lttng_domain_type domain_type)
 {
-       struct agent *agt = NULL;
+       struct agent *agt = nullptr;
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
        uint64_t key;
@@ -274,7 +274,7 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
 
        /* Allocate a new ltt ust session */
        lus = zmalloc<ltt_ust_session>();
-       if (lus == NULL) {
+       if (lus == nullptr) {
                PERROR("create ust session zmalloc");
                goto error_alloc;
        }
@@ -321,7 +321,7 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
                goto error;
        }
        lus->consumer = consumer_create_output(CONSUMER_DST_LOCAL);
-       if (lus->consumer == NULL) {
+       if (lus->consumer == nullptr) {
                goto error;
        }
 
@@ -337,7 +337,7 @@ error:
        lttng_ht_destroy(lus->agents);
        free(lus);
 error_alloc:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -353,7 +353,7 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
        LTTNG_ASSERT(chan);
 
        luc = zmalloc<ltt_ust_channel>();
-       if (luc == NULL) {
+       if (luc == nullptr) {
                PERROR("ltt_ust_channel zmalloc");
                goto error;
        }
@@ -464,7 +464,7 @@ enum lttng_error_code trace_ust_create_event(struct lttng_event *ev,
        }
 
        local_ust_event = zmalloc<ltt_ust_event>();
-       if (local_ust_event == NULL) {
+       if (local_ust_event == nullptr) {
                PERROR("ust event zmalloc");
                ret = LTTNG_ERR_NOMEM;
                goto error;
@@ -669,7 +669,7 @@ int trace_ust_match_context(const struct ltt_ust_context *uctx,
  */
 struct ltt_ust_context *trace_ust_create_context(const struct lttng_event_context *ctx)
 {
-       struct ltt_ust_context *uctx = NULL;
+       struct ltt_ust_context *uctx = nullptr;
        int utype;
 
        LTTNG_ASSERT(ctx);
@@ -698,7 +698,7 @@ struct ltt_ust_context *trace_ust_create_context(const struct lttng_event_contex
                break;
        case LTTNG_UST_ABI_CONTEXT_APP_CONTEXT:
        {
-               char *provider_name = NULL, *ctx_name = NULL;
+               char *provider_name = nullptr, *ctx_name = nullptr;
 
                provider_name = strdup(ctx->u.app_ctx.provider_name);
                if (!provider_name) {
@@ -721,7 +721,7 @@ end:
        return uctx;
 error:
        trace_ust_destroy_context(uctx);
-       return NULL;
+       return nullptr;
 }
 
 static void destroy_id_tracker_node_rcu(struct rcu_head *head)
@@ -770,7 +770,7 @@ static void fini_id_tracker(struct ust_id_tracker *id_tracker)
        }
        rcu_read_unlock();
        lttng_ht_destroy(id_tracker->ht);
-       id_tracker->ht = NULL;
+       id_tracker->ht = nullptr;
 }
 
 static struct ust_id_tracker_node *
@@ -784,7 +784,7 @@ id_tracker_lookup(struct ust_id_tracker *id_tracker, int id, struct lttng_ht_ite
        if (node) {
                return lttng::utils::container_of(node, &ust_id_tracker_node::node);
        } else {
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -850,7 +850,7 @@ static struct ust_id_tracker *get_id_tracker(struct ltt_ust_session *session,
        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
                return &session->vgid_tracker;
        default:
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -866,7 +866,7 @@ _trace_ust_get_process_attr_tracker(struct ltt_ust_session *session,
        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
                return session->tracker_vgid;
        default:
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -1333,8 +1333,8 @@ void trace_ust_delete_channel(struct lttng_ht *ht, struct ltt_ust_channel *chann
 int trace_ust_regenerate_metadata(struct ltt_ust_session *usess)
 {
        int ret = 0;
-       struct buffer_reg_uid *uid_reg = NULL;
-       struct buffer_reg_session *session_reg = NULL;
+       struct buffer_reg_uid *uid_reg = nullptr;
+       struct buffer_reg_session *session_reg = nullptr;
 
        rcu_read_lock();
        cds_list_for_each_entry (uid_reg, &usess->buffer_reg_uid_list, lnode) {
index a74e46c2975b9e79fe81566d6f8720c7d7174442..9e1a155adcdefb2b71fc7f478677f30521265afa 100644 (file)
@@ -49,19 +49,19 @@ static void process_attr_tracker_value_node_rcu_free(struct rcu_head *rcu_head)
        free(node);
 }
 
-struct process_attr_tracker *process_attr_tracker_create(void)
+struct process_attr_tracker *process_attr_tracker_create()
 {
        struct process_attr_tracker *tracker;
 
        tracker = zmalloc<process_attr_tracker>();
        if (!tracker) {
-               return NULL;
+               return nullptr;
        }
 
        (void) process_attr_tracker_set_tracking_policy(tracker, LTTNG_TRACKING_POLICY_INCLUDE_ALL);
 
        tracker->inclusion_set_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!tracker->inclusion_set_ht) {
                goto error;
        }
@@ -69,7 +69,7 @@ struct process_attr_tracker *process_attr_tracker_create(void)
        return tracker;
 error:
        process_attr_tracker_destroy(tracker);
-       return NULL;
+       return nullptr;
 }
 
 static void
@@ -97,16 +97,16 @@ static void process_attr_tracker_clear_inclusion_set(struct process_attr_tracker
                process_attr_tracker_remove_value_node(tracker, value_node);
        }
        rcu_read_unlock();
-       ret = cds_lfht_destroy(tracker->inclusion_set_ht, NULL);
+       ret = cds_lfht_destroy(tracker->inclusion_set_ht, nullptr);
        LTTNG_ASSERT(ret == 0);
-       tracker->inclusion_set_ht = NULL;
+       tracker->inclusion_set_ht = nullptr;
 }
 
 static int process_attr_tracker_create_inclusion_set(struct process_attr_tracker *tracker)
 {
        LTTNG_ASSERT(!tracker->inclusion_set_ht);
        tracker->inclusion_set_ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        return tracker->inclusion_set_ht ? 0 : -1;
 }
 
@@ -174,7 +174,7 @@ process_attr_tracker_lookup(const struct process_attr_tracker *tracker,
 
        return node ? lttng::utils::container_of(
                              node, &process_attr_tracker_value_node::inclusion_set_ht_node) :
-                     NULL;
+                     nullptr;
 }
 
 /* Protected by session mutex held by caller. */
@@ -183,8 +183,8 @@ process_attr_tracker_inclusion_set_add_value(struct process_attr_tracker *tracke
                                             const struct process_attr_value *value)
 {
        enum process_attr_tracker_status status = PROCESS_ATTR_TRACKER_STATUS_OK;
-       struct process_attr_value *value_copy = NULL;
-       struct process_attr_tracker_value_node *value_node = NULL;
+       struct process_attr_value *value_copy = nullptr;
+       struct process_attr_tracker_value_node *value_node = nullptr;
 
        rcu_read_lock();
        if (tracker->policy != LTTNG_TRACKING_POLICY_INCLUDE_SET) {
@@ -213,8 +213,8 @@ process_attr_tracker_inclusion_set_add_value(struct process_attr_tracker *tracke
        cds_lfht_add(tracker->inclusion_set_ht,
                     process_attr_value_hash(value_copy),
                     &value_node->inclusion_set_ht_node);
-       value_copy = NULL;
-       value_node = NULL;
+       value_copy = nullptr;
+       value_node = nullptr;
 end:
        if (value_copy) {
                process_attr_value_destroy(value_copy);
@@ -260,7 +260,7 @@ process_attr_tracker_get_inclusion_set(const struct process_attr_tracker *tracke
        struct process_attr_tracker_value_node *value_node;
        enum process_attr_tracker_status status = PROCESS_ATTR_TRACKER_STATUS_OK;
        struct lttng_process_attr_values *values;
-       struct process_attr_value *new_value = NULL;
+       struct process_attr_value *new_value = nullptr;
 
        values = lttng_process_attr_values_create();
        if (!values) {
@@ -290,7 +290,7 @@ process_attr_tracker_get_inclusion_set(const struct process_attr_tracker *tracke
                        goto error_unlock;
                }
 
-               new_value = NULL;
+               new_value = nullptr;
        }
        rcu_read_unlock();
        *_values = values;
index c3f6b9694061ce3dad1c94d7187f9b419820b80e..a4edced0e9c7f2bd89729be50d752cb65d6f8955 100644 (file)
@@ -22,7 +22,7 @@ enum process_attr_tracker_status {
        PROCESS_ATTR_TRACKER_STATUS_INVALID_TRACKING_POLICY,
 };
 
-struct process_attr_tracker *process_attr_tracker_create(void);
+struct process_attr_tracker *process_attr_tracker_create();
 void process_attr_tracker_destroy(struct process_attr_tracker *tracker);
 
 enum lttng_tracking_policy process_attr_tracker_get_tracking_policy(
index 128dd9d15cc8f4fd16bbadb3391adae4a3cac095..a50951f7bb4bfb2bbba4bba7dbbc07db8561b3dd 100644 (file)
@@ -26,7 +26,7 @@ lttng_trigger_condition_add_error_results(const struct lttng_trigger *trigger,
        enum lttng_trigger_status status;
        uint64_t discarded_tracer_messages_count;
        enum event_notifier_error_accounting_status error_accounting_status;
-       struct lttng_error_query_result *discarded_tracer_messages_counter = NULL;
+       struct lttng_error_query_result *discarded_tracer_messages_counter = nullptr;
        const char *trigger_name;
        uid_t trigger_owner;
 
@@ -71,7 +71,7 @@ lttng_trigger_condition_add_error_results(const struct lttng_trigger *trigger,
        }
 
        /* Ownership transferred to the results. */
-       discarded_tracer_messages_counter = NULL;
+       discarded_tracer_messages_counter = nullptr;
 
        status = LTTNG_TRIGGER_STATUS_OK;
 end:
index 3c628fb412f813974dc541c8b53dfdbc6fd44837..ec41be6c6573858b33cbc88b1a3b57616b5c7f7d 100644 (file)
@@ -23,6 +23,7 @@
 #include <set>
 #include <stack>
 #include <unordered_set>
+#include <utility>
 
 namespace lst = lttng::sessiond::trace;
 namespace tsdl = lttng::sessiond::tsdl;
@@ -138,7 +139,7 @@ public:
 
        variant_tsdl_keyword_sanitizer(tsdl::details::type_overrider& type_overrides,
                                       type_lookup_function lookup_type) :
-               _type_overrides{ type_overrides }, _lookup_type(lookup_type)
+               _type_overrides{ type_overrides }, _lookup_type(std::move(lookup_type))
        {
        }
 
@@ -152,56 +153,48 @@ private:
        };
        using unsafe_names = std::set<const char *, _c_string_comparator>;
 
-       virtual void visit(const lst::field& field) override final
+       void visit(const lst::field& field) final
        {
                _type_overrides.type(field.get_type()).accept(*this);
        }
 
-       virtual void visit(const lst::integer_type& type __attribute__((unused))) override final
+       void visit(const lst::integer_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::floating_point_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::floating_point_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::signed_enumeration_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::signed_enumeration_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::unsigned_enumeration_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::unsigned_enumeration_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::static_length_array_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::static_length_array_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::dynamic_length_array_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::dynamic_length_array_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::static_length_blob_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::static_length_blob_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::dynamic_length_blob_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::dynamic_length_blob_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::null_terminated_string_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::null_terminated_string_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::structure_type& type) override final
+       void visit(const lst::structure_type& type) final
        {
                /* Recurse into structure attributes. */
                for (const auto& field : type.fields_) {
@@ -343,27 +336,23 @@ private:
                _type_overrides.publish(type, std::move(sanitized_variant_type));
        }
 
-       virtual void visit(const lst::variant_type<
-                          lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type)
-               override final
+       void visit(const lst::variant_type<
+                  lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type) final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::variant_type<
-                          lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type)
-               override final
+       void visit(const lst::variant_type<
+                  lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type) final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::static_length_string_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::static_length_string_type& type __attribute__((unused))) final
        {
        }
 
-       virtual void visit(const lst::dynamic_length_string_type& type
-                          __attribute__((unused))) override final
+       void visit(const lst::dynamic_length_string_type& type __attribute__((unused))) final
        {
        }
 
@@ -381,7 +370,7 @@ public:
                                   nonstd::nullopt) :
                _indentation_level{ indentation_level },
                _trace_abi{ abi },
-               _bypass_identifier_escape{ false },
+
                _default_clock_class_name{ in_default_clock_class_name ?
                                                   in_default_clock_class_name->c_str() :
                                                   nullptr },
@@ -396,7 +385,7 @@ public:
        }
 
 private:
-       virtual void visit(const lst::field& field) override final
+       void visit(const lst::field& field) final
        {
                /*
                 * Hack: keep the name of the field being visited since
@@ -425,7 +414,7 @@ private:
                _description += ";";
        }
 
-       virtual void visit(const lst::integer_type& type) override final
+       void visit(const lst::integer_type& type) final
        {
                _description += "integer { ";
 
@@ -506,7 +495,7 @@ private:
                _description += " }";
        }
 
-       virtual void visit(const lst::floating_point_type& type) override final
+       void visit(const lst::floating_point_type& type) final
        {
                _description += fmt::format(
                        "floating_point {{ align = {alignment}; mant_dig = {mantissa_digits}; exp_dig = {exponent_digits};",
@@ -564,17 +553,17 @@ private:
                _description += "}";
        }
 
-       virtual void visit(const lst::signed_enumeration_type& type) override final
+       void visit(const lst::signed_enumeration_type& type) final
        {
                visit_enumeration(type);
        }
 
-       virtual void visit(const lst::unsigned_enumeration_type& type) override final
+       void visit(const lst::unsigned_enumeration_type& type) final
        {
                visit_enumeration(type);
        }
 
-       virtual void visit(const lst::static_length_array_type& type) override final
+       void visit(const lst::static_length_array_type& type) final
        {
                if (type.alignment != 0) {
                        LTTNG_ASSERT(_current_field_name.size() > 0);
@@ -589,7 +578,7 @@ private:
                _type_suffixes.emplace(fmt::format("[{}]", type.length));
        }
 
-       virtual void visit(const lst::dynamic_length_array_type& type) override final
+       void visit(const lst::dynamic_length_array_type& type) final
        {
                if (type.alignment != 0) {
                        /*
@@ -615,7 +604,7 @@ private:
                                        *(type.length_field_location.elements_.end() - 1))));
        }
 
-       virtual void visit(const lst::static_length_blob_type& type) override final
+       void visit(const lst::static_length_blob_type& type) final
        {
                /* This type doesn't exist in CTF 1.x, express it as a static length array of
                 * uint8_t. */
@@ -632,7 +621,7 @@ private:
                visit(*array);
        }
 
-       virtual void visit(const lst::dynamic_length_blob_type& type) override final
+       void visit(const lst::dynamic_length_blob_type& type) final
        {
                /* This type doesn't exist in CTF 1.x, express it as a dynamic length array of
                 * uint8_t. */
@@ -649,7 +638,7 @@ private:
                visit(*array);
        }
 
-       virtual void visit(const lst::null_terminated_string_type& type) override final
+       void visit(const lst::null_terminated_string_type& type) final
        {
                /* Defaults to UTF-8. */
                if (type.encoding_ == lst::null_terminated_string_type::encoding::ASCII) {
@@ -659,7 +648,7 @@ private:
                }
        }
 
-       virtual void visit(const lst::structure_type& type) override final
+       void visit(const lst::structure_type& type) final
        {
                _indentation_level++;
                _description += "struct {";
@@ -724,16 +713,14 @@ private:
                _description += "}";
        }
 
-       virtual void visit(const lst::variant_type<
-                          lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type)
-               override final
+       void visit(const lst::variant_type<
+                  lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type) final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::variant_type<
-                          lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type)
-               override final
+       void visit(const lst::variant_type<
+                  lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type) final
        {
                visit_variant(type);
        }
@@ -749,7 +736,7 @@ private:
                        lst::integer_type::base::DECIMAL);
        }
 
-       virtual void visit(const lst::static_length_string_type& type) override final
+       void visit(const lst::static_length_string_type& type) final
        {
                /*
                 * TSDL expresses static-length strings as arrays of 8-bit integer with
@@ -761,7 +748,7 @@ private:
                visit(*char_array);
        }
 
-       virtual void visit(const lst::dynamic_length_string_type& type) override final
+       void visit(const lst::dynamic_length_string_type& type) final
        {
                /*
                 * TSDL expresses dynamic-length strings as arrays of 8-bit integer with
@@ -792,7 +779,7 @@ private:
        /* Description in TSDL format. */
        std::string _description;
 
-       bool _bypass_identifier_escape;
+       bool _bypass_identifier_escape{ false };
        const char *_default_clock_class_name;
        const tsdl::details::type_overrider& _type_overrides;
 };
@@ -803,15 +790,16 @@ public:
        {
        }
 
-       virtual void visit(const lst::environment_field<int64_t>& field) override
+       void visit(const lst::environment_field<int64_t>& field) override
        {
                _environment += fmt::format("   {} = {};\n", field.name, field.value);
        }
 
-       virtual void visit(const lst::environment_field<const char *>& field) override
+       void visit(const lst::environment_field<const char *>& field) override
        {
-               _environment += fmt::format(
-                       "       {} = \"{}\";\n", field.name, escape_tsdl_env_string_value(field.value));
+               _environment += fmt::format("   {} = \"{}\";\n",
+                                           field.name,
+                                           escape_tsdl_env_string_value(field.value));
        }
 
        /* Only call once. */
@@ -829,7 +817,7 @@ private:
 tsdl::trace_class_visitor::trace_class_visitor(
        const lst::abi& trace_abi,
        tsdl::append_metadata_fragment_function append_metadata_fragment) :
-       _trace_abi{ trace_abi }, _append_metadata_fragment(append_metadata_fragment)
+       _trace_abi{ trace_abi }, _append_metadata_fragment(std::move(append_metadata_fragment))
 {
 }
 
index 122bbddaf02fe99289c44207ff2bff657faec784..37e7204eab5ec85cf0d2b6cb5627887eea431404 100644 (file)
@@ -87,7 +87,7 @@ namespace {
  */
 static lsu::registry_session *get_session_registry(const struct ust_app_session *ua_sess)
 {
-       lsu::registry_session *registry = NULL;
+       lsu::registry_session *registry = nullptr;
 
        LTTNG_ASSERT(ua_sess);
 
@@ -135,7 +135,7 @@ lsu::registry_session::locked_ptr get_locked_session_registry(const struct ust_a
 /*
  * Return the incremented value of next_channel_key.
  */
-static uint64_t get_next_channel_key(void)
+static uint64_t get_next_channel_key()
 {
        uint64_t ret;
 
@@ -148,7 +148,7 @@ static uint64_t get_next_channel_key(void)
 /*
  * Return the atomically incremented value of next_session_id.
  */
-static uint64_t get_next_session_id(void)
+static uint64_t get_next_session_id()
 {
        uint64_t ret;
 
@@ -346,9 +346,9 @@ static void delete_ust_app_event(int sock, struct ust_app_event *ua_event, struc
        ASSERT_RCU_READ_LOCKED();
 
        free(ua_event->filter);
-       if (ua_event->exclusion != NULL)
+       if (ua_event->exclusion != nullptr)
                free(ua_event->exclusion);
-       if (ua_event->obj != NULL) {
+       if (ua_event->obj != nullptr) {
                pthread_mutex_lock(&app->sock_lock);
                ret = lttng_ust_ctl_release_object(sock, ua_event->obj);
                pthread_mutex_unlock(&app->sock_lock);
@@ -395,11 +395,11 @@ static void delete_ust_app_event_notifier_rule(
 
        LTTNG_ASSERT(ua_event_notifier_rule);
 
-       if (ua_event_notifier_rule->exclusion != NULL) {
+       if (ua_event_notifier_rule->exclusion != nullptr) {
                free(ua_event_notifier_rule->exclusion);
        }
 
-       if (ua_event_notifier_rule->obj != NULL) {
+       if (ua_event_notifier_rule->obj != nullptr) {
                pthread_mutex_lock(&app->sock_lock);
                ret = lttng_ust_ctl_release_object(sock, ua_event_notifier_rule->obj);
                pthread_mutex_unlock(&app->sock_lock);
@@ -617,7 +617,7 @@ static void delete_ust_app_channel(int sock,
                }
        }
 
-       if (ua_chan->obj != NULL) {
+       if (ua_chan->obj != nullptr) {
                /* Remove channel from application UST object descriptor. */
                iter.iter.node = &ua_chan->ust_objd_node.node;
                ret = lttng_ht_del(app->ust_objd, &iter);
@@ -694,7 +694,7 @@ ssize_t ust_app_push_metadata(const lsu::registry_session::locked_ptr& locked_re
                              int send_zero_data)
 {
        int ret;
-       char *metadata_str = NULL;
+       char *metadata_str = nullptr;
        size_t len, offset, new_metadata_len_sent;
        ssize_t ret_val;
        uint64_t metadata_key, metadata_version;
@@ -1163,13 +1163,13 @@ end:
 /*
  * Alloc new UST app session.
  */
-static struct ust_app_session *alloc_ust_app_session(void)
+static struct ust_app_session *alloc_ust_app_session()
 {
        struct ust_app_session *ua_sess;
 
        /* Init most of the default value by allocating and zeroing */
        ua_sess = zmalloc<ust_app_session>();
-       if (ua_sess == NULL) {
+       if (ua_sess == nullptr) {
                PERROR("malloc");
                goto error_free;
        }
@@ -1177,12 +1177,12 @@ static struct ust_app_session *alloc_ust_app_session(void)
        ua_sess->handle = -1;
        ua_sess->channels = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
        ua_sess->metadata_attr.type = LTTNG_UST_ABI_CHAN_METADATA;
-       pthread_mutex_init(&ua_sess->lock, NULL);
+       pthread_mutex_init(&ua_sess->lock, nullptr);
 
        return ua_sess;
 
 error_free:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1196,7 +1196,7 @@ static struct ust_app_channel *alloc_ust_app_channel(const char *name,
 
        /* Init most of the default value by allocating and zeroing */
        ua_chan = zmalloc<ust_app_channel>();
-       if (ua_chan == NULL) {
+       if (ua_chan == nullptr) {
                PERROR("malloc");
                goto error;
        }
@@ -1235,7 +1235,7 @@ static struct ust_app_channel *alloc_ust_app_channel(const char *name,
        return ua_chan;
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1243,12 +1243,12 @@ error:
  *
  * Return newly allocated stream pointer or NULL on error.
  */
-struct ust_app_stream *ust_app_alloc_stream(void)
+struct ust_app_stream *ust_app_alloc_stream()
 {
-       struct ust_app_stream *stream = NULL;
+       struct ust_app_stream *stream = nullptr;
 
        stream = zmalloc<ust_app_stream>();
-       if (stream == NULL) {
+       if (stream == nullptr) {
                PERROR("zmalloc ust app stream");
                goto error;
        }
@@ -1269,7 +1269,7 @@ static struct ust_app_event *alloc_ust_app_event(char *name, struct lttng_ust_ab
 
        /* Init most of the default value by allocating and zeroing */
        ua_event = zmalloc<ust_app_event>();
-       if (ua_event == NULL) {
+       if (ua_event == nullptr) {
                PERROR("Failed to allocate ust_app_event structure");
                goto error;
        }
@@ -1289,7 +1289,7 @@ static struct ust_app_event *alloc_ust_app_event(char *name, struct lttng_ust_ab
        return ua_event;
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1301,11 +1301,11 @@ alloc_ust_app_event_notifier_rule(struct lttng_trigger *trigger)
        enum lttng_event_rule_generate_exclusions_status generate_exclusion_status;
        enum lttng_condition_status cond_status;
        struct ust_app_event_notifier_rule *ua_event_notifier_rule;
-       struct lttng_condition *condition = NULL;
-       const struct lttng_event_rule *event_rule = NULL;
+       struct lttng_condition *condition = nullptr;
+       const struct lttng_event_rule *event_rule = nullptr;
 
        ua_event_notifier_rule = zmalloc<ust_app_event_notifier_rule>();
-       if (ua_event_notifier_rule == NULL) {
+       if (ua_event_notifier_rule == nullptr) {
                PERROR("Failed to allocate ust_app_event_notifier_rule structure");
                goto error;
        }
@@ -1351,7 +1351,7 @@ error_put_trigger:
        lttng_trigger_put(trigger);
 error:
        free(ua_event_notifier_rule);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1362,7 +1362,7 @@ static struct ust_app_ctx *alloc_ust_app_ctx(struct lttng_ust_context_attr *uctx
        struct ust_app_ctx *ua_ctx;
 
        ua_ctx = zmalloc<ust_app_ctx>();
-       if (ua_ctx == NULL) {
+       if (ua_ctx == nullptr) {
                goto error;
        }
 
@@ -1371,7 +1371,7 @@ static struct ust_app_ctx *alloc_ust_app_ctx(struct lttng_ust_context_attr *uctx
        if (uctx) {
                memcpy(&ua_ctx->ctx, uctx, sizeof(ua_ctx->ctx));
                if (uctx->ctx == LTTNG_UST_ABI_CONTEXT_APP_CONTEXT) {
-                       char *provider_name = NULL, *ctx_name = NULL;
+                       char *provider_name = nullptr, *ctx_name = nullptr;
 
                        provider_name = strdup(uctx->u.app_ctx.provider_name);
                        ctx_name = strdup(uctx->u.app_ctx.ctx_name);
@@ -1390,7 +1390,7 @@ static struct ust_app_ctx *alloc_ust_app_ctx(struct lttng_ust_context_attr *uctx
        return ua_ctx;
 error:
        free(ua_ctx);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1401,7 +1401,7 @@ error:
 static struct lttng_ust_abi_filter_bytecode *
 create_ust_filter_bytecode_from_bytecode(const struct lttng_bytecode *orig_f)
 {
-       struct lttng_ust_abi_filter_bytecode *filter = NULL;
+       struct lttng_ust_abi_filter_bytecode *filter = nullptr;
 
        /* Copy filter bytecode. */
        filter = zmalloc<lttng_ust_abi_filter_bytecode>(sizeof(*filter) + orig_f->len);
@@ -1426,7 +1426,7 @@ error:
 static struct lttng_ust_abi_capture_bytecode *
 create_ust_capture_bytecode_from_bytecode(const struct lttng_bytecode *orig_f)
 {
-       struct lttng_ust_abi_capture_bytecode *capture = NULL;
+       struct lttng_ust_abi_capture_bytecode *capture = nullptr;
 
        /* Copy capture bytecode. */
        capture = zmalloc<lttng_ust_abi_capture_bytecode>(sizeof(*capture) + orig_f->len);
@@ -1457,7 +1457,7 @@ struct ust_app *ust_app_find_by_sock(int sock)
 
        lttng_ht_lookup(ust_app_ht_by_sock, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("UST app find by sock %d not found", sock);
                goto error;
        }
@@ -1465,7 +1465,7 @@ struct ust_app *ust_app_find_by_sock(int sock)
        return lttng::utils::container_of(node, &ust_app::sock_n);
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1481,7 +1481,7 @@ static struct ust_app *find_app_by_notify_sock(int sock)
 
        lttng_ht_lookup(ust_app_ht_by_notify_sock, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("UST app find by notify sock %d not found", sock);
                goto error;
        }
@@ -1489,7 +1489,7 @@ static struct ust_app *find_app_by_notify_sock(int sock)
        return lttng::utils::container_of(node, &ust_app::notify_sock_n);
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1506,7 +1506,7 @@ static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_str *node;
-       struct ust_app_event *event = NULL;
+       struct ust_app_event *event = nullptr;
        struct ust_app_ht_key key;
 
        LTTNG_ASSERT(name);
@@ -1526,7 +1526,7 @@ static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
                        &key,
                        &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                goto end;
        }
 
@@ -1547,14 +1547,14 @@ static struct ust_app_event_notifier_rule *find_ust_app_event_notifier_rule(stru
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
-       struct ust_app_event_notifier_rule *event_notifier_rule = NULL;
+       struct ust_app_event_notifier_rule *event_notifier_rule = nullptr;
 
        LTTNG_ASSERT(ht);
        ASSERT_RCU_READ_LOCKED();
 
        lttng_ht_lookup(ht, &token, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("UST app event notifier rule token not found: token = %" PRIu64, token);
                goto end;
        }
@@ -1619,7 +1619,7 @@ static int set_ust_object_filter(struct ust_app *app,
                                 struct lttng_ust_abi_object_data *ust_object)
 {
        int ret;
-       struct lttng_ust_abi_filter_bytecode *ust_bytecode = NULL;
+       struct lttng_ust_abi_filter_bytecode *ust_bytecode = nullptr;
 
        health_code_update();
 
@@ -1671,7 +1671,7 @@ static int set_ust_capture(struct ust_app *app,
                           struct lttng_ust_abi_object_data *ust_object)
 {
        int ret;
-       struct lttng_ust_abi_capture_bytecode *ust_bytecode = NULL;
+       struct lttng_ust_abi_capture_bytecode *ust_bytecode = nullptr;
 
        health_code_update();
 
@@ -1721,7 +1721,7 @@ error:
 static struct lttng_ust_abi_event_exclusion *
 create_ust_exclusion_from_exclusion(const struct lttng_event_exclusion *exclusion)
 {
-       struct lttng_ust_abi_event_exclusion *ust_exclusion = NULL;
+       struct lttng_ust_abi_event_exclusion *ust_exclusion = nullptr;
        size_t exclusion_alloc_size = sizeof(struct lttng_ust_abi_event_exclusion) +
                LTTNG_UST_ABI_SYM_NAME_LEN * exclusion->count;
 
@@ -1746,7 +1746,7 @@ static int set_ust_object_exclusions(struct ust_app *app,
                                     struct lttng_ust_abi_object_data *ust_object)
 {
        int ret;
-       struct lttng_ust_abi_event_exclusion *ust_exclusions = NULL;
+       struct lttng_ust_abi_event_exclusion *ust_exclusions = nullptr;
 
        LTTNG_ASSERT(exclusions && exclusions->count > 0);
 
@@ -2212,9 +2212,9 @@ static int create_ust_event_notifier(struct ust_app *app,
 {
        int ret = 0;
        enum lttng_condition_status condition_status;
-       const struct lttng_condition *condition = NULL;
+       const struct lttng_condition *condition = nullptr;
        struct lttng_ust_abi_event_notifier event_notifier;
-       const struct lttng_event_rule *event_rule = NULL;
+       const struct lttng_event_rule *event_rule = nullptr;
        unsigned int capture_bytecode_count = 0, i;
        enum lttng_condition_status cond_status;
        enum lttng_event_rule_type event_rule_type;
@@ -2373,7 +2373,7 @@ static void shadow_copy_event(struct ust_app_event *ua_event, struct ltt_ust_eve
                exclusion_alloc_size = sizeof(struct lttng_event_exclusion) +
                        LTTNG_UST_ABI_SYM_NAME_LEN * uevent->exclusion->count;
                ua_event->exclusion = zmalloc<lttng_event_exclusion>(exclusion_alloc_size);
-               if (ua_event->exclusion == NULL) {
+               if (ua_event->exclusion == nullptr) {
                        PERROR("malloc");
                } else {
                        memcpy(ua_event->exclusion, uevent->exclusion, exclusion_alloc_size);
@@ -2539,14 +2539,14 @@ static struct ust_app_session *lookup_session_by_app(const struct ltt_ust_sessio
 
        __lookup_session_by_app(usess, app, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                goto error;
        }
 
        return lttng::utils::container_of(node, &ust_app_session::node);
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -2675,7 +2675,7 @@ static int setup_buffer_reg_uid(struct ltt_ust_session *usess,
                 * that if the buffer registry can be found, its ust registry is
                 * non-NULL.
                 */
-               buffer_reg_uid_destroy(reg_uid, NULL);
+               buffer_reg_uid_destroy(reg_uid, nullptr);
                goto error;
        }
 
@@ -2720,12 +2720,12 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
        health_code_update();
 
        ua_sess = lookup_session_by_app(usess, app);
-       if (ua_sess == NULL) {
+       if (ua_sess == nullptr) {
                DBG2("UST app pid: %d session id %" PRIu64 " not found, creating it",
                     app->pid,
                     usess->id);
                ua_sess = alloc_ust_app_session();
-               if (ua_sess == NULL) {
+               if (ua_sess == nullptr) {
                        /* Only malloc can failed so something is really wrong */
                        ret = -ENOMEM;
                        goto error;
@@ -2737,7 +2737,7 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
        switch (usess->buffer_type) {
        case LTTNG_BUFFER_PER_PID:
                /* Init local registry. */
-               ret = setup_buffer_reg_pid(ua_sess, app, NULL);
+               ret = setup_buffer_reg_pid(ua_sess, app, nullptr);
                if (ret < 0) {
                        delete_ust_app_session(-1, ua_sess, app);
                        goto error;
@@ -2745,7 +2745,7 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
                break;
        case LTTNG_BUFFER_PER_UID:
                /* Look for a global registry. If none exists, create one. */
-               ret = setup_buffer_reg_uid(usess, ua_sess, app, NULL);
+               ret = setup_buffer_reg_uid(usess, ua_sess, app, nullptr);
                if (ret < 0) {
                        delete_ust_app_session(-1, ua_sess, app);
                        goto error;
@@ -2873,7 +2873,7 @@ static struct ust_app_ctx *find_ust_app_context(struct lttng_ht *ht,
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_ulong *node;
-       struct ust_app_ctx *app_ctx = NULL;
+       struct ust_app_ctx *app_ctx = nullptr;
 
        LTTNG_ASSERT(uctx);
        LTTNG_ASSERT(ht);
@@ -2919,7 +2919,7 @@ static int create_ust_app_channel_context(struct ust_app_channel *ua_chan,
        }
 
        ua_ctx = alloc_ust_app_ctx(uctx);
-       if (ua_ctx == NULL) {
+       if (ua_ctx == nullptr) {
                /* malloc failed */
                ret = -ENOMEM;
                goto error;
@@ -3013,7 +3013,7 @@ static int enable_ust_app_channel(struct ust_app_session *ua_sess,
 
        lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &iter);
        ua_chan_node = lttng_ht_iter_get_node_str(&iter);
-       if (ua_chan_node == NULL) {
+       if (ua_chan_node == nullptr) {
                DBG2("Unable to find channel %s in ust session id %" PRIu64,
                     uchan->name,
                     ua_sess->tracing_id);
@@ -3238,7 +3238,7 @@ static int setup_buffer_reg_streams(struct buffer_reg_channel *buf_reg_chan,
                 * stream call does not release the object.
                 */
                reg_stream->obj.ust = stream->obj;
-               stream->obj = NULL;
+               stream->obj = nullptr;
                buffer_reg_stream_add(reg_stream, buf_reg_chan);
 
                /* We don't need the streams anymore. */
@@ -3263,7 +3263,7 @@ static int create_buffer_reg_channel(struct buffer_reg_session *reg_sess,
                                     struct buffer_reg_channel **regp)
 {
        int ret;
-       struct buffer_reg_channel *buf_reg_chan = NULL;
+       struct buffer_reg_channel *buf_reg_chan = nullptr;
 
        LTTNG_ASSERT(reg_sess);
        LTTNG_ASSERT(ua_chan);
@@ -3332,7 +3332,7 @@ static int setup_buffer_reg_channel(struct buffer_reg_session *reg_sess,
        }
 
        buf_reg_chan->obj.ust = ua_chan->obj;
-       ua_chan->obj = NULL;
+       ua_chan->obj = nullptr;
 
        return 0;
 
@@ -3448,7 +3448,7 @@ static int create_channel_per_uid(struct ust_app *app,
        int ret;
        struct buffer_reg_uid *reg_uid;
        struct buffer_reg_channel *buf_reg_chan;
-       struct ltt_session *session = NULL;
+       struct ltt_session *session = nullptr;
        enum lttng_error_code notification_ret;
 
        LTTNG_ASSERT(app);
@@ -3571,7 +3571,7 @@ static int create_channel_per_pid(struct ust_app *app,
        int ret;
        lsu::registry_session *registry;
        enum lttng_error_code cmd_ret;
-       struct ltt_session *session = NULL;
+       struct ltt_session *session = nullptr;
        uint64_t chan_reg_key;
 
        LTTNG_ASSERT(app);
@@ -3743,13 +3743,13 @@ static int ust_app_channel_allocate(struct ust_app_session *ua_sess,
        /* Lookup channel in the ust app session */
        lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &iter);
        ua_chan_node = lttng_ht_iter_get_node_str(&iter);
-       if (ua_chan_node != NULL) {
+       if (ua_chan_node != nullptr) {
                ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
                goto end;
        }
 
        ua_chan = alloc_ust_app_channel(uchan->name, ua_sess, &uchan->attr);
-       if (ua_chan == NULL) {
+       if (ua_chan == nullptr) {
                /* Only malloc can fail here */
                ret = -ENOMEM;
                goto error;
@@ -3789,7 +3789,7 @@ static int create_ust_app_event(struct ust_app_channel *ua_chan,
        ASSERT_RCU_READ_LOCKED();
 
        ua_event = alloc_ust_app_event(uevent->attr.name, &uevent->attr);
-       if (ua_event == NULL) {
+       if (ua_event == nullptr) {
                /* Only failure mode of alloc_ust_app_event(). */
                ret = -ENOMEM;
                goto end;
@@ -3844,7 +3844,7 @@ static int create_ust_app_event_notifier_rule(struct lttng_trigger *trigger, str
        ASSERT_RCU_READ_LOCKED();
 
        ua_event_notifier_rule = alloc_ust_app_event_notifier_rule(trigger);
-       if (ua_event_notifier_rule == NULL) {
+       if (ua_event_notifier_rule == nullptr) {
                ret = -ENOMEM;
                goto end;
        }
@@ -3899,7 +3899,7 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
        int ret = 0;
        struct ust_app_channel *metadata;
        struct consumer_socket *socket;
-       struct ltt_session *session = NULL;
+       struct ltt_session *session = nullptr;
 
        LTTNG_ASSERT(ua_sess);
        LTTNG_ASSERT(app);
@@ -3917,7 +3917,7 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
        }
 
        /* Allocate UST metadata */
-       metadata = alloc_ust_app_channel(DEFAULT_METADATA_NAME, ua_sess, NULL);
+       metadata = alloc_ust_app_channel(DEFAULT_METADATA_NAME, ua_sess, nullptr);
        if (!metadata) {
                /* malloc() failed */
                ret = -ENOMEM;
@@ -4002,13 +4002,13 @@ error:
  */
 struct ust_app *ust_app_find_by_pid(pid_t pid)
 {
-       struct ust_app *app = NULL;
+       struct ust_app *app = nullptr;
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
 
        lttng_ht_lookup(ust_app_ht, (void *) ((unsigned long) pid), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("UST app no found with pid %d", pid);
                goto error;
        }
@@ -4031,8 +4031,8 @@ error:
 struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
 {
        int ret;
-       struct ust_app *lta = NULL;
-       struct lttng_pipe *event_notifier_event_source_pipe = NULL;
+       struct ust_app *lta = nullptr;
+       struct lttng_pipe *event_notifier_event_source_pipe = nullptr;
 
        LTTNG_ASSERT(msg);
        LTTNG_ASSERT(sock >= 0);
@@ -4071,7 +4071,7 @@ struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
        }
 
        lta = zmalloc<ust_app>();
-       if (lta == NULL) {
+       if (lta == nullptr) {
                PERROR("malloc");
                goto error_free_pipe;
        }
@@ -4116,7 +4116,7 @@ struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
        lta->pid = msg->pid;
        lttng_ht_node_init_ulong(&lta->pid_n, (unsigned long) lta->pid);
        lta->sock = sock;
-       pthread_mutex_init(&lta->sock_lock, NULL);
+       pthread_mutex_init(&lta->sock_lock, nullptr);
        lttng_ht_node_init_ulong(&lta->sock_n, (unsigned long) lta->sock);
 
        CDS_INIT_LIST_HEAD(&lta->teardown_head);
@@ -4126,7 +4126,7 @@ error_free_pipe:
        lttng_pipe_destroy(event_notifier_event_source_pipe);
        lttng_fd_put(LTTNG_FD_APPS, 2);
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -4137,7 +4137,7 @@ void ust_app_add(struct ust_app *app)
        LTTNG_ASSERT(app);
        LTTNG_ASSERT(app->notify_sock >= 0);
 
-       app->registration_time = time(NULL);
+       app->registration_time = time(nullptr);
 
        rcu_read_lock();
 
@@ -4228,7 +4228,7 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
 {
        int ret;
        int event_pipe_write_fd;
-       struct lttng_ust_abi_object_data *event_notifier_group = NULL;
+       struct lttng_ust_abi_object_data *event_notifier_group = nullptr;
        enum lttng_error_code lttng_ret;
        enum event_notifier_error_accounting_status event_notifier_error_accounting_status;
 
@@ -4331,7 +4331,7 @@ error_accounting:
 error:
        lttng_ust_ctl_release_object(app->sock, app->event_notifier_group.object);
        free(app->event_notifier_group.object);
-       app->event_notifier_group.object = NULL;
+       app->event_notifier_group.object = nullptr;
        return ret;
 }
 
@@ -4476,7 +4476,7 @@ int ust_app_list_events(struct lttng_event **events)
 
        nbmem = UST_APP_EVENT_LIST_SIZE;
        tmp_event = calloc<lttng_event>(nbmem);
-       if (tmp_event == NULL) {
+       if (tmp_event == nullptr) {
                PERROR("zmalloc ust app events");
                ret = -ENOMEM;
                goto error;
@@ -4545,7 +4545,7 @@ int ust_app_list_events(struct lttng_event **events)
                                     new_nbmem);
                                new_tmp_event = (lttng_event *) realloc(
                                        tmp_event, new_nbmem * sizeof(struct lttng_event));
-                               if (new_tmp_event == NULL) {
+                               if (new_tmp_event == nullptr) {
                                        int release_ret;
 
                                        PERROR("realloc ust app events");
@@ -4622,7 +4622,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
 
        nbmem = UST_APP_EVENT_LIST_SIZE;
        tmp_event = calloc<lttng_event_field>(nbmem);
-       if (tmp_event == NULL) {
+       if (tmp_event == nullptr) {
                PERROR("zmalloc ust app event fields");
                ret = -ENOMEM;
                goto error;
@@ -4691,7 +4691,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
                                     new_nbmem);
                                new_tmp_event = (lttng_event_field *) realloc(
                                        tmp_event, new_nbmem * sizeof(struct lttng_event_field));
-                               if (new_tmp_event == NULL) {
+                               if (new_tmp_event == nullptr) {
                                        int release_ret;
 
                                        PERROR("realloc ust app event fields");
@@ -4754,7 +4754,7 @@ error:
 /*
  * Free and clean all traceable apps of the global list.
  */
-void ust_app_clean_list(void)
+void ust_app_clean_list()
 {
        int ret;
        struct ust_app *app;
@@ -4811,7 +4811,7 @@ void ust_app_clean_list(void)
 /*
  * Init UST app hash table.
  */
-int ust_app_ht_alloc(void)
+int ust_app_ht_alloc()
 {
        ust_app_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
        if (!ust_app_ht) {
@@ -4858,7 +4858,7 @@ int ust_app_disable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_ch
                        continue;
                }
                ua_sess = lookup_session_by_app(usess, app);
-               if (ua_sess == NULL) {
+               if (ua_sess == nullptr) {
                        continue;
                }
 
@@ -4911,7 +4911,7 @@ int ust_app_enable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_cha
                        continue;
                }
                ua_sess = lookup_session_by_app(usess, app);
-               if (ua_sess == NULL) {
+               if (ua_sess == nullptr) {
                        continue;
                }
 
@@ -4961,7 +4961,7 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
                        continue;
                }
                ua_sess = lookup_session_by_app(usess, app);
-               if (ua_sess == NULL) {
+               if (ua_sess == nullptr) {
                        /* Next app */
                        continue;
                }
@@ -4969,7 +4969,7 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
                /* Lookup channel in the ust app session */
                lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
-               if (ua_chan_node == NULL) {
+               if (ua_chan_node == nullptr) {
                        DBG2("Channel %s not found in session id %" PRIu64 " for app pid %d."
                             "Skipping",
                             uchan->name,
@@ -4984,7 +4984,7 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
                                              uevent->filter,
                                              uevent->attr.loglevel,
                                              uevent->exclusion);
-               if (ua_event == NULL) {
+               if (ua_event == nullptr) {
                        DBG2("Event %s not found in channel %s for app pid %d."
                             "Skipping",
                             uevent->attr.name,
@@ -5012,7 +5012,7 @@ static int ust_app_channel_create(struct ltt_ust_session *usess,
                                  struct ust_app_channel **_ua_chan)
 {
        int ret = 0;
-       struct ust_app_channel *ua_chan = NULL;
+       struct ust_app_channel *ua_chan = nullptr;
 
        LTTNG_ASSERT(ua_sess);
        ASSERT_LOCKED(ua_sess->lock);
@@ -5021,7 +5021,7 @@ static int ust_app_channel_create(struct ltt_ust_session *usess,
                copy_channel_attr_to_ustctl(&ua_sess->metadata_attr, &uchan->attr);
                ret = 0;
        } else {
-               struct ltt_ust_context *uctx = NULL;
+               struct ltt_ust_context *uctx = nullptr;
 
                /*
                 * Create channel onto application and synchronize its
@@ -5146,7 +5146,7 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
                                              uevent->filter,
                                              uevent->attr.loglevel,
                                              uevent->exclusion);
-               if (ua_event == NULL) {
+               if (ua_event == nullptr) {
                        DBG3("UST app enable event %s not found for app PID %d."
                             "Skipping app",
                             uevent->attr.name,
@@ -5258,7 +5258,7 @@ static int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *ap
        }
 
        ua_sess = lookup_session_by_app(usess, app);
-       if (ua_sess == NULL) {
+       if (ua_sess == nullptr) {
                /* The session is in teardown process. Ignore and continue. */
                goto end;
        }
@@ -5368,7 +5368,7 @@ static int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app
        }
 
        ua_sess = lookup_session_by_app(usess, app);
-       if (ua_sess == NULL) {
+       if (ua_sess == nullptr) {
                goto end_no_session;
        }
 
@@ -5581,7 +5581,7 @@ static int ust_app_flush_session(struct ltt_ust_session *usess)
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ua_sess = lookup_session_by_app(usess, app);
-                       if (ua_sess == NULL) {
+                       if (ua_sess == nullptr) {
                                continue;
                        }
                        (void) ust_app_flush_app_session(app, ua_sess);
@@ -5721,7 +5721,7 @@ static int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ua_sess = lookup_session_by_app(usess, app);
-                       if (ua_sess == NULL) {
+                       if (ua_sess == nullptr) {
                                continue;
                        }
                        (void) ust_app_clear_quiescent_app_session(app, ua_sess);
@@ -5759,7 +5759,7 @@ static int destroy_trace(struct ltt_ust_session *usess, struct ust_app *app)
 
        __lookup_session_by_app(usess, app, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                /* Session is being or is deleted. */
                goto end;
        }
@@ -5923,7 +5923,7 @@ static int ust_app_channel_synchronize_event(struct ust_app_channel *ua_chan,
                                             struct ust_app *app)
 {
        int ret = 0;
-       struct ust_app_event *ua_event = NULL;
+       struct ust_app_event *ua_event = nullptr;
 
        ua_event = find_ust_app_event(ua_chan->events,
                                      uevent->attr.name,
@@ -5953,7 +5953,7 @@ static void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
        enum lttng_error_code ret_code;
        enum lttng_trigger_status t_status;
        struct lttng_ht_iter app_trigger_iter;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        struct ust_app_event_notifier_rule *event_notifier_rule;
        unsigned int count, i;
 
@@ -6156,7 +6156,7 @@ end:
 static void ust_app_synchronize(struct ltt_ust_session *usess, struct ust_app *app)
 {
        int ret = 0;
-       struct ust_app_session *ua_sess = NULL;
+       struct ust_app_session *ua_sess = nullptr;
 
        /*
         * The application's configuration should only be synchronized for
@@ -6164,7 +6164,7 @@ static void ust_app_synchronize(struct ltt_ust_session *usess, struct ust_app *a
         */
        LTTNG_ASSERT(usess->active);
 
-       ret = find_or_create_ust_app_session(usess, app, &ua_sess, NULL);
+       ret = find_or_create_ust_app_session(usess, app, &ua_sess, nullptr);
        if (ret < 0) {
                /* Tracer is probably gone or ENOMEM. */
                if (ua_sess) {
@@ -6212,7 +6212,7 @@ static void ust_app_global_destroy(struct ltt_ust_session *usess, struct ust_app
        struct ust_app_session *ua_sess;
 
        ua_sess = lookup_session_by_app(usess, app);
-       if (ua_sess == NULL) {
+       if (ua_sess == nullptr) {
                return;
        }
        destroy_app_session(app, ua_sess);
@@ -6267,7 +6267,7 @@ void ust_app_global_update_event_notifier_rules(struct ust_app *app)
                return;
        }
 
-       if (app->event_notifier_group.object == NULL) {
+       if (app->event_notifier_group.object == nullptr) {
                WARN("UST app global update of event notifiers for app skipped since communication handle is null: app = '%s', pid = %d",
                     app->name,
                     app->pid);
@@ -6292,7 +6292,7 @@ void ust_app_global_update_all(struct ltt_ust_session *usess)
        rcu_read_unlock();
 }
 
-void ust_app_global_update_all_event_notifier_rules(void)
+void ust_app_global_update_all_event_notifier_rules()
 {
        struct lttng_ht_iter iter;
        struct ust_app *app;
@@ -6315,7 +6315,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
        int ret = 0;
        struct lttng_ht_node_str *ua_chan_node;
        struct lttng_ht_iter iter, uiter;
-       struct ust_app_channel *ua_chan = NULL;
+       struct ust_app_channel *ua_chan = nullptr;
        struct ust_app_session *ua_sess;
        struct ust_app *app;
 
@@ -6331,7 +6331,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
                        continue;
                }
                ua_sess = lookup_session_by_app(usess, app);
-               if (ua_sess == NULL) {
+               if (ua_sess == nullptr) {
                        continue;
                }
 
@@ -6345,7 +6345,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
                /* Lookup channel in the ust app session */
                lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
-               if (ua_chan_node == NULL) {
+               if (ua_chan_node == nullptr) {
                        goto next_app;
                }
                ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
@@ -6427,14 +6427,14 @@ static struct ust_app_session *find_session_by_objd(struct ust_app *app, int obj
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
-       struct ust_app_session *ua_sess = NULL;
+       struct ust_app_session *ua_sess = nullptr;
 
        LTTNG_ASSERT(app);
        ASSERT_RCU_READ_LOCKED();
 
        lttng_ht_lookup(app->ust_sessions_objd, (void *) ((unsigned long) objd), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("UST app session find by objd %d not found", objd);
                goto error;
        }
@@ -6454,14 +6454,14 @@ static struct ust_app_channel *find_channel_by_objd(struct ust_app *app, int obj
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
-       struct ust_app_channel *ua_chan = NULL;
+       struct ust_app_channel *ua_chan = nullptr;
 
        LTTNG_ASSERT(app);
        ASSERT_RCU_READ_LOCKED();
 
        lttng_ht_lookup(app->ust_objd, (void *) ((unsigned long) objd), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node == NULL) {
+       if (node == nullptr) {
                DBG2("UST app channel find by objd %d not found", objd);
                goto error;
        }
@@ -7134,7 +7134,7 @@ enum lttng_error_code ust_app_snapshot_record(const struct ltt_ust_session *uses
        enum lttng_error_code status = LTTNG_OK;
        struct lttng_ht_iter iter;
        struct ust_app *app;
-       char *trace_path = NULL;
+       char *trace_path = nullptr;
 
        LTTNG_ASSERT(usess);
        LTTNG_ASSERT(output);
@@ -7434,7 +7434,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
                struct lttng_ht_iter uiter;
 
                ua_sess = lookup_session_by_app(usess, app);
-               if (ua_sess == NULL) {
+               if (ua_sess == nullptr) {
                        continue;
                }
 
@@ -7480,7 +7480,7 @@ static int ust_app_regenerate_statedump(struct ltt_ust_session *usess, struct us
        rcu_read_lock();
 
        ua_sess = lookup_session_by_app(usess, app);
-       if (ua_sess == NULL) {
+       if (ua_sess == nullptr) {
                /* The session is in teardown process. Ignore and continue. */
                goto end;
        }
index d0cbd217ce857aa48c0e7164e2143de66e2f7986..ab00b1c195df52b3f7c35e079f20f2a2a65fb51c 100644 (file)
@@ -374,12 +374,12 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
 void ust_app_global_update(struct ltt_ust_session *usess, struct ust_app *app);
 void ust_app_global_update_all(struct ltt_ust_session *usess);
 void ust_app_global_update_event_notifier_rules(struct ust_app *app);
-void ust_app_global_update_all_event_notifier_rules(void);
+void ust_app_global_update_all_event_notifier_rules();
 
-void ust_app_clean_list(void);
-int ust_app_ht_alloc(void);
+void ust_app_clean_list();
+int ust_app_ht_alloc();
 struct ust_app *ust_app_find_by_pid(pid_t pid);
-struct ust_app_stream *ust_app_alloc_stream(void);
+struct ust_app_stream *ust_app_alloc_stream();
 int ust_app_recv_registration(int sock, struct ust_register_msg *msg);
 int ust_app_recv_notify(int sock);
 void ust_app_add(struct ust_app *app);
@@ -416,7 +416,7 @@ enum lttng_error_code ust_app_open_packets(struct ltt_session *session);
 int ust_app_setup_event_notifier_group(struct ust_app *app);
 
 static inline
-int ust_app_supported(void)
+int ust_app_supported()
 {
        return 1;
 }
index b4a8e208bc28e665855d667a9b6b9dc7b981279c..cdb3b50a5fe5154c57322eed7f4db975ae0b8f9d 100644 (file)
@@ -146,7 +146,7 @@ void measure_single_clock_offset(struct offset_sample *sample)
  * to complete, thus removing imprecision caused by preemption.
  * May return a negative offset.
  */
-lst::clock_class::scycles_t measure_clock_offset(void)
+lst::clock_class::scycles_t measure_clock_offset()
 {
        struct offset_sample offset_best_sample = {
                .offset = 0,
index 6b646fb941c767b1e4bdbd546619625f6c1186f3..1d8e8ac054669736dd464f78fde48d783358a3bd 100644 (file)
@@ -42,7 +42,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
        int ret, output;
        uint32_t chan_id;
        uint64_t key, chan_reg_key;
-       char *pathname = NULL;
+       char *pathname = nullptr;
        struct lttcomm_consumer_msg msg;
        char shm_path[PATH_MAX] = "";
        char root_shm_path[PATH_MAX] = "";
@@ -266,12 +266,12 @@ int ust_consumer_get_channel(struct consumer_socket *socket, struct ust_app_chan
        }
 
        /* Next, get all streams. */
-       while (1) {
+       while (true) {
                struct ust_app_stream *stream;
 
                /* Create UST stream */
                stream = ust_app_alloc_stream();
-               if (stream == NULL) {
+               if (stream == nullptr) {
                        ret = -ENOMEM;
                        goto error;
                }
index 0c713c21ba56c85a51c00d17f44ad40cec651bea..67fcdf1b21b786e2a90e7a0d10e19835b9d6f68d 100644 (file)
@@ -11,6 +11,7 @@
 #include <common/make-unique.hpp>
 
 #include <unordered_map>
+#include <utility>
 
 namespace lst = lttng::sessiond::trace;
 namespace lsu = lttng::sessiond::ust;
@@ -29,7 +30,7 @@ public:
 
        session_attributes(registry_enum_getter_fn reg_enum_getter,
                           lst::byte_order native_trace_byte_order) :
-               get_registry_enum{ reg_enum_getter },
+               get_registry_enum{ std::move(reg_enum_getter) },
                _native_trace_byte_order{ native_trace_byte_order }
        {
        }
@@ -49,8 +50,8 @@ create_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
                                const lttng_ust_ctl_field *end,
                                const session_attributes& session_attributes,
                                const lttng_ust_ctl_field **next_ust_ctl_field,
-                               publish_field_fn publish_field,
-                               lookup_field_fn lookup_field,
+                               const publish_field_fn& publish_field,
+                               const lookup_field_fn& lookup_field,
                                lst::field_location::root lookup_root,
                                lst::field_location::elements& current_field_location_elements,
                                lsu::ctl_field_quirks quirks);
@@ -59,8 +60,8 @@ void create_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
                                      const lttng_ust_ctl_field *end,
                                      const session_attributes& session_attributes,
                                      const lttng_ust_ctl_field **next_ust_ctl_field,
-                                     publish_field_fn publish_field,
-                                     lookup_field_fn lookup_field,
+                                     const publish_field_fn& publish_field,
+                                     const lookup_field_fn& lookup_field,
                                      lst::field_location::root lookup_root,
                                      lst::field_location::elements& current_field_location_elements,
                                      lsu::ctl_field_quirks quirks);
@@ -346,8 +347,8 @@ lst::type::cuptr create_array_nestable_type_from_ust_ctl_fields(
        const lttng_ust_ctl_field *end,
        const session_attributes& session_attributes,
        const lttng_ust_ctl_field **next_ust_ctl_field,
-       publish_field_fn publish_field,
-       lookup_field_fn lookup_field,
+       const publish_field_fn& publish_field,
+       const lookup_field_fn& lookup_field,
        lst::field_location::root lookup_root,
        lst::field_location::elements& current_field_location_elements,
        lsu::ctl_field_quirks quirks)
@@ -413,7 +414,7 @@ lst::type::cuptr create_sequence_type_from_ust_ctl_fields(
        const lttng_ust_ctl_field *end,
        const session_attributes& session_attributes,
        const lttng_ust_ctl_field **next_ust_ctl_field,
-       publish_field_fn publish_field,
+       const publish_field_fn& publish_field,
        lst::field_location::root lookup_root,
        lst::field_location::elements& current_field_location_elements,
        lsu::ctl_field_quirks quirks __attribute__((unused)))
@@ -450,7 +451,7 @@ lst::type::cuptr create_sequence_type_from_ust_ctl_fields(
                        element_uctl_type.u.basic.integer.encoding);
        }
 
-       const auto length_field_name = fmt::format("_{}_length", sequence_uctl_field.name);
+       auto length_field_name = fmt::format("_{}_length", sequence_uctl_field.name);
        auto element_type =
                create_integer_type_from_ust_ctl_basic_type(element_uctl_type, session_attributes);
        auto length_type =
@@ -460,9 +461,8 @@ lst::type::cuptr create_sequence_type_from_ust_ctl_fields(
                current_field_location_elements;
        length_field_location_elements.emplace_back(length_field_name);
 
-       const lst::field_location length_field_location{
-               lookup_root, std::move(length_field_location_elements)
-       };
+       lst::field_location length_field_location{ lookup_root,
+                                                  std::move(length_field_location_elements) };
 
        /* Publish an implicit length field _before_ the sequence field. */
        publish_field(lttng::make_unique<lst::field>(std::move(length_field_name),
@@ -494,8 +494,8 @@ lst::type::cuptr create_sequence_nestable_type_from_ust_ctl_fields(
        const lttng_ust_ctl_field *end,
        const session_attributes& session_attributes,
        const lttng_ust_ctl_field **next_ust_ctl_field,
-       publish_field_fn publish_field,
-       lookup_field_fn lookup_field,
+       const publish_field_fn& publish_field,
+       const lookup_field_fn& lookup_field,
        lst::field_location::root lookup_root,
        lst::field_location::elements& current_field_location_elements,
        lsu::ctl_field_quirks quirks)
@@ -541,9 +541,8 @@ lst::type::cuptr create_sequence_nestable_type_from_ust_ctl_fields(
                current_field_location_elements;
        length_field_location_elements.emplace_back(std::move(length_field_name));
 
-       const lst::field_location length_field_location{
-               lookup_root, std::move(length_field_location_elements)
-       };
+       lst::field_location length_field_location{ lookup_root,
+                                                  std::move(length_field_location_elements) };
 
        /* Validate existence of length field (throws if not found). */
        const auto& length_field = lookup_field(length_field_location);
@@ -689,7 +688,7 @@ lst::type::cuptr create_variant_field_from_ust_ctl_fields(
        const lttng_ust_ctl_field *end,
        const session_attributes& session_attributes,
        const lttng_ust_ctl_field **next_ust_ctl_field,
-       lookup_field_fn lookup_field,
+       const lookup_field_fn& lookup_field,
        lst::field_location::root lookup_root,
        lst::field_location::elements& current_field_location_elements,
        lsu::ctl_field_quirks quirks)
@@ -720,9 +719,8 @@ lst::type::cuptr create_variant_field_from_ust_ctl_fields(
                current_field_location_elements;
        selector_field_location_elements.emplace_back(tag_name);
 
-       const lst::field_location selector_field_location{
-               lookup_root, std::move(selector_field_location_elements)
-       };
+       lst::field_location selector_field_location{ lookup_root,
+                                                    std::move(selector_field_location_elements) };
 
        /* Validate existence of selector field (throws if not found). */
        const auto& selector_field = lookup_field(selector_field_location);
@@ -778,8 +776,8 @@ create_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
                                const lttng_ust_ctl_field *end,
                                const session_attributes& session_attributes,
                                const lttng_ust_ctl_field **next_ust_ctl_field,
-                               publish_field_fn publish_field,
-                               lookup_field_fn lookup_field,
+                               const publish_field_fn& publish_field,
+                               const lookup_field_fn& lookup_field,
                                lst::field_location::root lookup_root,
                                lst::field_location::elements& current_field_location_elements,
                                lsu::ctl_field_quirks quirks)
@@ -860,8 +858,8 @@ void create_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
                                      const lttng_ust_ctl_field *end,
                                      const session_attributes& session_attributes,
                                      const lttng_ust_ctl_field **next_ust_ctl_field,
-                                     publish_field_fn publish_field,
-                                     lookup_field_fn lookup_field,
+                                     const publish_field_fn& publish_field,
+                                     const lookup_field_fn& lookup_field,
                                      lst::field_location::root lookup_root,
                                      lst::field_location::elements& current_field_location_elements,
                                      lsu::ctl_field_quirks quirks)
index ceba9a8963ab333bd381e6a6a6e87a6419be1ae6..3cf58e0889082acce22b8d3f09ba00b807b215f3 100644 (file)
@@ -16,6 +16,8 @@
 #include <common/make-unique.hpp>
 #include <common/urcu.hpp>
 
+#include <utility>
+
 namespace lst = lttng::sessiond::trace;
 namespace lsu = lttng::sessiond::ust;
 
@@ -342,8 +344,8 @@ lsu::registry_channel::registry_channel(
        _key{ -1ULL },
        _consumer_key{ -1ULL },
        _next_event_id{ 0 },
-       _is_registered_listener{ channel_registered_listener },
-       _event_added_listener{ event_added_listener },
+       _is_registered_listener{ std::move(channel_registered_listener) },
+       _event_added_listener{ std::move(event_added_listener) },
        _is_registered{ false }
 {
        _events = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
index a32b8088eed172ed7443f7d37fffb61d661080db..cbe1ab5af48fd4e9153dca746dcdff4dcc980d51 100644 (file)
@@ -46,9 +46,9 @@ public:
                        lttng_buffer_type buffer_type,
                        const ust_app& app,
                        uint32_t& out_event_id);
-       virtual ~registry_channel();
+       ~registry_channel() override;
 
-       virtual const lttng::sessiond::trace::type *event_context() const override final;
+       const lttng::sessiond::trace::type *event_context() const final;
        void event_context(lttng::sessiond::trace::type::cuptr context);
 
        /* Channel was registered to at least one application. */
@@ -70,8 +70,8 @@ public:
        uint32_t _next_event_id;
 
 private:
-       virtual void _accept_on_event_classes(
-                       lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const override final;
+       void _accept_on_event_classes(
+                       lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final;
 
        registered_listener_fn _is_registered_listener;
        event_added_listener_fn _event_added_listener;
index 5dc98032a2900d58f650bdbdbfa213b90c22164f..6b2ebc8434a8428dfea27626713988aba7d4cf85 100644 (file)
@@ -36,7 +36,7 @@ public:
                        std::vector<lttng::sessiond::trace::field::cuptr> fields,
                        int loglevel_value,
                        nonstd::optional<std::string> model_emf_uri);
-       virtual ~registry_event() = default;
+       ~registry_event() override = default;
 
        /* Both objd are set by the tracer. */
        const int session_objd;
index 0bca522d1bc66d5518f23dd93eaddafda78f322a..c75fc38481245894cdf251fabf18286d26ee1562 100644 (file)
@@ -252,7 +252,7 @@ lsu::registry_session::registry_session(const struct lst::abi& in_abi,
                [this](const std::string& fragment) { _append_metadata_fragment(fragment); }) },
        _packet_header{ _create_packet_header() }
 {
-       pthread_mutex_init(&_lock, NULL);
+       pthread_mutex_init(&_lock, nullptr);
        if (_shm_path.size() > 0) {
                if (run_as_mkdir_recursive(_shm_path.c_str(), S_IRWXU | S_IRWXG, euid, egid)) {
                        LTTNG_THROW_POSIX("run_as_mkdir_recursive", errno);
@@ -283,8 +283,8 @@ lsu::registry_session::registry_session(const struct lst::abi& in_abi,
        }
 
        /* hash/match functions are specified at call site. */
-       _enums->match_fct = NULL;
-       _enums->hash_fct = NULL;
+       _enums->match_fct = nullptr;
+       _enums->hash_fct = nullptr;
 
        _channels.reset(lttng_ht_new(0, LTTNG_HT_TYPE_U64));
        if (!_channels) {
@@ -702,7 +702,7 @@ void lsu::registry_session::regenerate_metadata()
 lsu::registry_enum::const_rcu_protected_reference
 lsu::registry_session::enumeration(const char *enum_name, uint64_t enum_id) const
 {
-       lsu::registry_enum *reg_enum = NULL;
+       lsu::registry_enum *reg_enum = nullptr;
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
        lttng::urcu::unique_read_lock rcu_lock;
@@ -743,7 +743,7 @@ lsu::registry_session::enumeration(const char *enum_name, uint64_t enum_id) cons
 lsu::registry_enum *
 lsu::registry_session::_lookup_enum(const lsu::registry_enum *reg_enum_lookup) const
 {
-       lsu::registry_enum *reg_enum = NULL;
+       lsu::registry_enum *reg_enum = nullptr;
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
 
@@ -783,7 +783,7 @@ void lsu::registry_session::create_or_find_enum(int session_objd,
                                                uint64_t *enum_id)
 {
        struct cds_lfht_node *nodep;
-       lsu::registry_enum *reg_enum = NULL, *old_reg_enum;
+       lsu::registry_enum *reg_enum = nullptr, *old_reg_enum;
        lttng::urcu::read_lock_guard read_lock_guard;
        auto entries =
                lttng::make_unique_wrapper<lttng_ust_ctl_enum_entry, lttng::free>(raw_entries);
index 3ef3d2a4f47daa97a292981dbc95ff60fa71f434..03ffc29f18c9ad8332d5a5cebe27ad41c78762bd 100644 (file)
@@ -60,9 +60,9 @@ public:
                        const char *enum_name, uint64_t enum_id) const;
 
        void regenerate_metadata();
-       virtual ~registry_session();
+       ~registry_session() override;
 
-       virtual const lttng::sessiond::trace::type *packet_header() const noexcept override;
+       const lttng::sessiond::trace::type *packet_header() const noexcept override;
 
        /*
         * With multiple writers and readers, use this lock to access
@@ -104,7 +104,7 @@ protected:
                        uid_t euid,
                        gid_t egid,
                        uint64_t tracing_id);
-       virtual void accept(
+       void accept(
                        trace::trace_class_environment_visitor& environment_visitor) const override;
        void _generate_metadata();
 
@@ -117,12 +117,12 @@ private:
        registry_enum *_lookup_enum(const registry_enum *target_enum) const;
        lttng::sessiond::trace::type::cuptr _create_packet_header() const;
 
-       virtual void _accept_on_clock_classes(
+       void _accept_on_clock_classes(
                        lttng::sessiond::trace::trace_class_visitor& trace_class_visitor)
-                       const override final;
-       virtual void _accept_on_stream_classes(
+                       const final;
+       void _accept_on_stream_classes(
                        lttng::sessiond::trace::trace_class_visitor& trace_class_visitor)
-                       const override final;
+                       const final;
 
        /* Next channel ID available for a newly registered channel. */
        uint32_t _next_channel_id = 0;
index 2095cdda3ab3f15c8b04f7794971b784d241b0f7..29872a20fc5ddc192f0cdb8b0012a8ead3b175a7 100644 (file)
@@ -121,7 +121,7 @@ public:
                        _mappings;
 
 protected:
-       virtual bool _is_equal(const registry_enum& base_other) const noexcept
+       bool _is_equal(const registry_enum& base_other) const noexcept override
        {
                const auto &other = static_cast<decltype(*this)&>(base_other);
 
index 7285b5b75f7711879f02e1993bd1032c8d8b840b..cc5e487df3b8b0d8398c32a7c229af07f061f4c9 100644 (file)
@@ -168,17 +168,17 @@ enum perf_hw_cache_op_result_id {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0 },
-       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
-       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
-       { "jul", 'j', POPT_ARG_NONE, 0, OPT_JUL, 0, 0 },
-       { "log4j", 'l', POPT_ARG_NONE, 0, OPT_LOG4J, 0, 0 },
-       { "type", 't', POPT_ARG_STRING, &opt_type, OPT_TYPE, 0, 0 },
-       { "list", 0, POPT_ARG_NONE, NULL, OPT_LIST, NULL, NULL },
-       { "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 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, nullptr, nullptr },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, nullptr, nullptr },
+       { "userspace", 'u', POPT_ARG_NONE, nullptr, OPT_USERSPACE, nullptr, nullptr },
+       { "jul", 'j', POPT_ARG_NONE, nullptr, OPT_JUL, nullptr, nullptr },
+       { "log4j", 'l', POPT_ARG_NONE, nullptr, OPT_LOG4J, nullptr, nullptr },
+       { "type", 't', POPT_ARG_STRING, &opt_type, OPT_TYPE, nullptr, nullptr },
+       { "list", 0, POPT_ARG_NONE, nullptr, OPT_LIST, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -491,7 +491,7 @@ static int find_ctx_type_idx(const char *opt)
 {
        int ret, i = 0;
 
-       while (ctx_opts[i].symbol != NULL) {
+       while (ctx_opts[i].symbol != nullptr) {
                if (strcmp(opt, ctx_opts[i].symbol) == 0) {
                        ret = i;
                        goto end;
@@ -504,7 +504,7 @@ end:
        return ret;
 }
 
-static enum lttng_domain_type get_domain(void)
+static enum lttng_domain_type get_domain()
 {
        if (opt_kernel) {
                return LTTNG_DOMAIN_KERNEL;
@@ -519,7 +519,7 @@ static enum lttng_domain_type get_domain(void)
        }
 }
 
-static int mi_open(void)
+static int mi_open()
 {
        int ret;
 
@@ -607,10 +607,10 @@ static void populate_context(struct lttng_event_context *context, const struct c
                strncpy(context->u.perf_counter.name, opt->symbol, LTTNG_SYMBOL_NAME_LEN);
                context->u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                /* Replace : and - by _ */
-               while ((ptr = strchr(context->u.perf_counter.name, '-')) != NULL) {
+               while ((ptr = strchr(context->u.perf_counter.name, '-')) != nullptr) {
                        *ptr = '_';
                }
-               while ((ptr = strchr(context->u.perf_counter.name, ':')) != NULL) {
+               while ((ptr = strchr(context->u.perf_counter.name, ':')) != nullptr) {
                        *ptr = '_';
                }
                break;
@@ -626,7 +626,7 @@ static void populate_context(struct lttng_event_context *context, const struct c
 /*
  * Pretty print context type.
  */
-static int print_ctx_type(void)
+static int print_ctx_type()
 {
        FILE *ofp = stdout;
        int i = 0;
@@ -650,7 +650,7 @@ static int print_ctx_type(void)
                }
        }
 
-       while (ctx_opts[i].symbol != NULL) {
+       while (ctx_opts[i].symbol != nullptr) {
                if (!ctx_opts[i].hide_help) {
                        if (lttng_opt_mi) {
                                populate_context(&context, &ctx_opts[i]);
@@ -712,7 +712,7 @@ static int add_context(char *session_name)
 
        dom.type = get_domain();
        handle = lttng_create_handle(session_name, &dom);
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = CMD_ERROR;
                goto error;
        }
@@ -747,7 +747,7 @@ static int add_context(char *session_name)
                        }
                }
 
-               ret = lttng_add_context(handle, &context, NULL, opt_channel_name);
+               ret = lttng_add_context(handle, &context, nullptr, opt_channel_name);
                if (ret < 0) {
                        ERR("%s: %s", type->opt->symbol, lttng_strerror(ret));
                        warn = 1;
@@ -819,7 +819,7 @@ static void destroy_ctx_type(struct ctx_type *type)
        free(type);
 }
 
-static struct ctx_type *create_ctx_type(void)
+static struct ctx_type *create_ctx_type()
 {
        struct ctx_type *type = zmalloc<ctx_type>();
 
@@ -832,7 +832,7 @@ static struct ctx_type *create_ctx_type(void)
        if (!type->opt) {
                PERROR("malloc ctx_type options");
                destroy_ctx_type(type);
-               type = NULL;
+               type = nullptr;
                goto end;
        }
 end:
@@ -860,7 +860,7 @@ static int find_ctx_type_perf_raw(const char *ctx, struct ctx_type *type)
                if (!next) {
                        break;
                }
-               cur_list = NULL;
+               cur_list = nullptr;
                switch (field_pos) {
                case 0:
                        if (strncmp(next, "perf", 4) != 0) {
@@ -932,9 +932,9 @@ end:
 static struct ctx_type *get_context_type(const char *ctx)
 {
        int opt_index, ret;
-       struct ctx_type *type = NULL;
+       struct ctx_type *type = nullptr;
        const char app_ctx_prefix[] = "$app.";
-       char *provider_name = NULL, *ctx_name = NULL;
+       char *provider_name = nullptr, *ctx_name = nullptr;
        size_t i, len, colon_pos = 0, provider_name_len, ctx_name_len;
 
        if (!ctx) {
@@ -1024,7 +1024,7 @@ not_found:
        free(provider_name);
        free(ctx_name);
        destroy_ctx_type(type);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1035,15 +1035,15 @@ int cmd_add_context(int argc, const char **argv)
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS;
        static poptContext pc;
        struct ctx_type *type, *tmptype;
-       char *session_name = NULL;
-       const char *leftover = NULL;
+       char *session_name = nullptr;
+       const char *leftover = nullptr;
 
        if (argc < 2) {
                ret = CMD_ERROR;
                goto end;
        }
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -1105,7 +1105,7 @@ int cmd_add_context(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        ret = CMD_ERROR;
                        goto end;
                }
index b0da1988947f4452b2bd970edc2619b033294fe4..54f41f28bd0344fd29c5ad69b5be7e024a8d42cd 100644 (file)
@@ -321,7 +321,7 @@ static int parse_kernel_probe_opts(const char *source,
        int match;
        char s_hex[19];
        char name[LTTNG_SYMBOL_NAME_LEN];
-       char *symbol_name = NULL;
+       char *symbol_name = nullptr;
        uint64_t offset;
 
        /* Check for symbol+offset. */
@@ -338,7 +338,7 @@ static int parse_kernel_probe_opts(const char *source,
                        PERROR("Failed to copy kernel probe location symbol name.");
                        goto error;
                }
-               offset = strtoull(s_hex, NULL, 0);
+               offset = strtoull(s_hex, nullptr, 0);
 
                *location = lttng_kernel_probe_location_symbol_create(symbol_name, offset);
                if (!*location) {
@@ -379,7 +379,7 @@ static int parse_kernel_probe_opts(const char *source,
                        goto error;
                }
 
-               address = strtoull(s_hex, NULL, 0);
+               address = strtoull(s_hex, nullptr, 0);
                *location = lttng_kernel_probe_location_address_create(address);
                if (!*location) {
                        ERR("Failed to create symbol kernel probe location.");
@@ -392,7 +392,7 @@ static int parse_kernel_probe_opts(const char *source,
 error:
        /* No match */
        ret = -1;
-       *location = NULL;
+       *location = nullptr;
 
 end:
        free(symbol_name);
@@ -402,8 +402,8 @@ end:
 static struct lttng_event_expr *
 ir_op_load_expr_to_event_expr(const struct ir_load_expression *load_expr, const char *capture_str)
 {
-       char *provider_name = NULL;
-       struct lttng_event_expr *event_expr = NULL;
+       char *provider_name = nullptr;
+       struct lttng_event_expr *event_expr = nullptr;
        const struct ir_load_expression_op *load_expr_op = load_expr->child;
        const enum ir_load_expression_type load_expr_child_type = load_expr_op->type;
 
@@ -525,7 +525,7 @@ ir_op_load_expr_to_event_expr(const struct ir_load_expression *load_expr, const
 
 error:
        lttng_event_expr_destroy(event_expr);
-       event_expr = NULL;
+       event_expr = nullptr;
 
 end:
        free(provider_name);
@@ -536,7 +536,7 @@ end:
 static struct lttng_event_expr *ir_op_load_to_event_expr(const struct ir_op *ir,
                                                         const char *capture_str)
 {
-       struct lttng_event_expr *event_expr = NULL;
+       struct lttng_event_expr *event_expr = nullptr;
 
        LTTNG_ASSERT(ir->op == IR_OP_LOAD);
 
@@ -580,7 +580,7 @@ static const char *ir_operator_type_human_str(enum ir_op_type op)
 static struct lttng_event_expr *ir_op_root_to_event_expr(const struct ir_op *ir,
                                                         const char *capture_str)
 {
-       struct lttng_event_expr *event_expr = NULL;
+       struct lttng_event_expr *event_expr = nullptr;
 
        LTTNG_ASSERT(ir->op == IR_OP_ROOT);
        ir = ir->u.root.child;
@@ -622,33 +622,33 @@ struct parse_event_rule_res {
 static struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv, int argc_offset)
 {
        enum lttng_event_rule_type event_rule_type = LTTNG_EVENT_RULE_TYPE_UNKNOWN;
-       struct argpar_iter *argpar_iter = NULL;
-       const struct argpar_item *argpar_item = NULL;
+       struct argpar_iter *argpar_iter = nullptr;
+       const struct argpar_item *argpar_item = nullptr;
        int consumed_args = -1;
-       struct lttng_kernel_probe_location *kernel_probe_location = NULL;
-       struct lttng_userspace_probe_location *userspace_probe_location = NULL;
+       struct lttng_kernel_probe_location *kernel_probe_location = nullptr;
+       struct lttng_userspace_probe_location *userspace_probe_location = nullptr;
        struct parse_event_rule_res res = {};
-       struct lttng_event_expr *event_expr = NULL;
-       struct filter_parser_ctx *parser_ctx = NULL;
-       struct lttng_log_level_rule *log_level_rule = NULL;
+       struct lttng_event_expr *event_expr = nullptr;
+       struct filter_parser_ctx *parser_ctx = nullptr;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
 
        /* Event rule type option */
-       char *event_rule_type_str = NULL;
+       char *event_rule_type_str = nullptr;
 
        /* Tracepoint and syscall options. */
-       char *name = NULL;
+       char *name = nullptr;
        /* Array of strings. */
        struct lttng_dynamic_pointer_array exclude_names;
 
        /* For userspace / kernel probe and function. */
-       char *location = NULL;
-       char *event_name = NULL;
+       char *location = nullptr;
+       char *event_name = nullptr;
 
        /* Filter. */
-       char *filter = NULL;
+       char *filter = nullptr;
 
        /* Log level. */
-       char *log_level_str = NULL;
+       char *log_level_str = nullptr;
 
        lttng_dynamic_pointer_array_init(&res.capture_descriptors, destroy_event_expr);
 
@@ -664,7 +664,7 @@ static struct parse_event_rule_res parse_event_rule(int *argc, const char ***arg
                enum parse_next_item_status status;
 
                status = parse_next_item(
-                       argpar_iter, &argpar_item, argc_offset, *argv, false, NULL, NULL);
+                       argpar_iter, &argpar_item, argc_offset, *argv, false, nullptr, nullptr);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
                    status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
@@ -765,7 +765,7 @@ static struct parse_event_rule_res parse_event_rule(int *argc, const char ***arg
                                 * The ownership of event expression was
                                 * transferred to the dynamic array.
                                 */
-                               event_expr = NULL;
+                               event_expr = nullptr;
 
                                break;
                        }
@@ -934,7 +934,7 @@ static struct parse_event_rule_res parse_event_rule(int *argc, const char ***arg
                                        log_level);
                        }
 
-                       if (log_level_rule == NULL) {
+                       if (log_level_rule == nullptr) {
                                ERR("Failed to create log level rule object.");
                                goto error;
                        }
@@ -1252,7 +1252,7 @@ static struct parse_event_rule_res parse_event_rule(int *argc, const char ***arg
 
 error:
        lttng_event_rule_destroy(res.er);
-       res.er = NULL;
+       res.er = nullptr;
        lttng_dynamic_pointer_array_reset(&res.capture_descriptors);
 
 end:
@@ -1286,13 +1286,13 @@ handle_condition_event(int *argc, const char ***argv, int argc_offset)
 
        res = parse_event_rule(argc, argv, argc_offset);
        if (!res.er) {
-               c = NULL;
+               c = nullptr;
                goto error;
        }
 
        c = lttng_condition_event_rule_matches_create(res.er);
        lttng_event_rule_destroy(res.er);
-       res.er = NULL;
+       res.er = nullptr;
        if (!c) {
                goto error;
        }
@@ -1315,14 +1315,14 @@ handle_condition_event(int *argc, const char ***argv, int argc_offset)
                }
 
                /* Ownership of event expression moved to `c` */
-               *expr = NULL;
+               *expr = nullptr;
        }
 
        goto end;
 
 error:
        lttng_condition_destroy(c);
-       c = NULL;
+       c = nullptr;
 
 end:
        lttng_dynamic_pointer_array_reset(&res.capture_descriptors);
@@ -1341,7 +1341,7 @@ static const struct condition_descr condition_descrs[] = {
        { "event-rule-matches", handle_condition_event },
 };
 
-static void print_valid_condition_names(void)
+static void print_valid_condition_names()
 {
        unsigned int i;
 
@@ -1361,7 +1361,7 @@ static struct lttng_condition *parse_condition(const char *condition_name,
 {
        int i;
        struct lttng_condition *cond;
-       const struct condition_descr *descr = NULL;
+       const struct condition_descr *descr = nullptr;
 
        for (i = 0; i < ARRAY_SIZE(condition_descrs); i++) {
                if (strcmp(condition_name, condition_descrs[i].name) == 0) {
@@ -1387,7 +1387,7 @@ static struct lttng_condition *parse_condition(const char *condition_name,
 
        goto end;
 error:
-       cond = NULL;
+       cond = nullptr;
 end:
        return cond;
 }
@@ -1397,17 +1397,17 @@ static struct lttng_rate_policy *parse_rate_policy(const char *policy_str)
        int ret;
        size_t num_token = 0;
        struct lttng_dynamic_pointer_array tokens;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_rate_policy *policy = nullptr;
        enum lttng_rate_policy_type policy_type;
        unsigned long long value;
        char *policy_type_str;
        char *policy_value_str;
 
        LTTNG_ASSERT(policy_str);
-       lttng_dynamic_pointer_array_init(&tokens, NULL);
+       lttng_dynamic_pointer_array_init(&tokens, nullptr);
 
        /* Rate policy fields are separated by ':'. */
-       ret = strutils_split(policy_str, ':', 1, &tokens);
+       ret = strutils_split(policy_str, ':', true, &tokens);
        if (ret == 0) {
                num_token = lttng_dynamic_pointer_array_get_count(&tokens);
        }
@@ -1456,7 +1456,7 @@ static struct lttng_rate_policy *parse_rate_policy(const char *policy_str)
                abort();
        }
 
-       if (policy == NULL) {
+       if (policy == nullptr) {
                ERR("Failed to create rate policy `%s`.", policy_str);
        }
 
@@ -1471,10 +1471,10 @@ static const struct argpar_opt_descr notify_action_opt_descrs[] = {
 
 static struct lttng_action *handle_action_notify(int *argc, const char ***argv, int argc_offset)
 {
-       struct lttng_action *action = NULL;
-       struct argpar_iter *argpar_iter = NULL;
-       const struct argpar_item *argpar_item = NULL;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_action *action = nullptr;
+       struct argpar_iter *argpar_iter = nullptr;
+       const struct argpar_item *argpar_item = nullptr;
+       struct lttng_rate_policy *policy = nullptr;
 
        argpar_iter = argpar_iter_create(*argc, *argv, notify_action_opt_descrs);
        if (!argpar_iter) {
@@ -1490,7 +1490,7 @@ static struct lttng_action *handle_action_notify(int *argc, const char ***argv,
                                         argc_offset,
                                         *argv,
                                         false,
-                                        NULL,
+                                        nullptr,
                                         "While parsing `notify` action:");
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
                    status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
@@ -1547,7 +1547,7 @@ static struct lttng_action *handle_action_notify(int *argc, const char ***argv,
 
 error:
        lttng_action_destroy(action);
-       action = NULL;
+       action = nullptr;
 end:
        lttng_rate_policy_destroy(policy);
        argpar_item_destroy(argpar_item);
@@ -1564,18 +1564,18 @@ static struct lttng_action *handle_action_simple_session_with_policy(
        int *argc,
        const char ***argv,
        int argc_offset,
-       struct lttng_action *(*create_action_cb)(void),
+       struct lttng_action *(*create_action_cb)(),
        enum lttng_action_status (*set_session_name_cb)(struct lttng_action *, const char *),
        enum lttng_action_status (*set_rate_policy_cb)(struct lttng_action *,
                                                       const struct lttng_rate_policy *),
        const char *action_name)
 {
-       struct lttng_action *action = NULL;
-       struct argpar_iter *argpar_iter = NULL;
-       const struct argpar_item *argpar_item = NULL;
-       const char *session_name_arg = NULL;
+       struct lttng_action *action = nullptr;
+       struct argpar_iter *argpar_iter = nullptr;
+       const struct argpar_item *argpar_item = nullptr;
+       const char *session_name_arg = nullptr;
        enum lttng_action_status action_status;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_rate_policy *policy = nullptr;
 
        LTTNG_ASSERT(set_session_name_cb);
        LTTNG_ASSERT(set_rate_policy_cb);
@@ -1598,7 +1598,7 @@ static struct lttng_action *handle_action_simple_session_with_policy(
                                         argc_offset,
                                         *argv,
                                         false,
-                                        NULL,
+                                        nullptr,
                                         "While parsing `%s` action:",
                                         action_name);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
@@ -1675,7 +1675,7 @@ static struct lttng_action *handle_action_simple_session_with_policy(
 
 error:
        lttng_action_destroy(action);
-       action = NULL;
+       action = nullptr;
 
 end:
        lttng_rate_policy_destroy(policy);
@@ -1735,20 +1735,20 @@ static const struct argpar_opt_descr snapshot_action_opt_descrs[] = {
 static struct lttng_action *
 handle_action_snapshot_session(int *argc, const char ***argv, int argc_offset)
 {
-       struct lttng_action *action = NULL;
-       struct argpar_iter *argpar_iter = NULL;
-       const struct argpar_item *argpar_item = NULL;
-       const char *session_name_arg = NULL;
-       char *snapshot_name_arg = NULL;
-       char *ctrl_url_arg = NULL;
-       char *data_url_arg = NULL;
-       char *max_size_arg = NULL;
-       char *url_arg = NULL;
-       char *path_arg = NULL;
-       char *error = NULL;
+       struct lttng_action *action = nullptr;
+       struct argpar_iter *argpar_iter = nullptr;
+       const struct argpar_item *argpar_item = nullptr;
+       const char *session_name_arg = nullptr;
+       char *snapshot_name_arg = nullptr;
+       char *ctrl_url_arg = nullptr;
+       char *data_url_arg = nullptr;
+       char *max_size_arg = nullptr;
+       char *url_arg = nullptr;
+       char *path_arg = nullptr;
+       char *error = nullptr;
        enum lttng_action_status action_status;
-       struct lttng_snapshot_output *snapshot_output = NULL;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_snapshot_output *snapshot_output = nullptr;
+       struct lttng_rate_policy *policy = nullptr;
        int ret;
        unsigned int locations_specified = 0;
 
@@ -1766,7 +1766,7 @@ handle_action_snapshot_session(int *argc, const char ***argv, int argc_offset)
                                         argc_offset,
                                         *argv,
                                         false,
-                                        NULL,
+                                        nullptr,
                                         "While parsing `snapshot` action:");
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
                    status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
@@ -1942,7 +1942,7 @@ handle_action_snapshot_session(int *argc, const char ***argv, int argc_offset)
                        goto error;
                }
 
-               num_uris = uri_parse_str_urls(url_arg, NULL, &uris);
+               num_uris = uri_parse_str_urls(url_arg, nullptr, &uris);
                if (num_uris < 1) {
                        ERR("Failed to parse '%s' as an URL.", url_arg);
                        goto error;
@@ -1997,7 +1997,7 @@ handle_action_snapshot_session(int *argc, const char ***argv, int argc_offset)
                }
 
                /* Ownership of `snapshot_output` has been transferred to the action. */
-               snapshot_output = NULL;
+               snapshot_output = nullptr;
        }
 
        if (policy) {
@@ -2013,7 +2013,7 @@ handle_action_snapshot_session(int *argc, const char ***argv, int argc_offset)
 
 error:
        lttng_action_destroy(action);
-       action = NULL;
+       action = nullptr;
        free(error);
 end:
        free(snapshot_name_arg);
@@ -2044,7 +2044,7 @@ static const struct action_descr action_descrs[] = {
        { "snapshot-session", handle_action_snapshot_session },
 };
 
-static void print_valid_action_names(void)
+static void print_valid_action_names()
 {
        unsigned int i;
 
@@ -2064,7 +2064,7 @@ static struct lttng_action *parse_action(const char *action_name,
 {
        int i;
        struct lttng_action *action;
-       const struct action_descr *descr = NULL;
+       const struct action_descr *descr = nullptr;
 
        for (i = 0; i < ARRAY_SIZE(action_descrs); i++) {
                if (strcmp(action_name, action_descrs[i].name) == 0) {
@@ -2090,7 +2090,7 @@ static struct lttng_action *parse_action(const char *action_name,
 
        goto end;
 error:
-       action = NULL;
+       action = nullptr;
 end:
        return action;
 }
@@ -2117,19 +2117,19 @@ int cmd_add_trigger(int argc, const char **argv)
        int ret;
        int my_argc = argc - 1;
        const char **my_argv = argv + 1;
-       struct lttng_condition *condition = NULL;
+       struct lttng_condition *condition = nullptr;
        struct lttng_dynamic_pointer_array actions;
-       struct argpar_iter *argpar_iter = NULL;
-       const struct argpar_item *argpar_item = NULL;
-       const struct argpar_error *argpar_error = NULL;
-       struct lttng_action *action_list = NULL;
-       struct lttng_action *action = NULL;
-       struct lttng_trigger *trigger = NULL;
-       char *name = NULL;
+       struct argpar_iter *argpar_iter = nullptr;
+       const struct argpar_item *argpar_item = nullptr;
+       const struct argpar_error *argpar_error = nullptr;
+       struct lttng_action *action_list = nullptr;
+       struct lttng_action *action = nullptr;
+       struct lttng_trigger *trigger = nullptr;
+       char *name = nullptr;
        int i;
-       char *owner_uid = NULL;
+       char *owner_uid = nullptr;
        enum lttng_error_code ret_code;
-       struct mi_writer *mi_writer = NULL;
+       struct mi_writer *mi_writer = nullptr;
 
        lttng_dynamic_pointer_array_init(&actions, lttng_actions_destructor);
 
@@ -2174,10 +2174,10 @@ int cmd_add_trigger(int argc, const char **argv)
                                         my_argv,
                                         true,
                                         &argpar_error,
-                                        NULL);
+                                        nullptr);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
                        if (argpar_error_type(argpar_error) == ARGPAR_ERROR_TYPE_MISSING_OPT_ARG) {
-                               int opt_id = argpar_error_opt_descr(argpar_error, NULL)->id;
+                               int opt_id = argpar_error_opt_descr(argpar_error, nullptr)->id;
 
                                if (opt_id == OPT_CONDITION) {
                                        print_valid_condition_names();
@@ -2263,7 +2263,7 @@ int cmd_add_trigger(int argc, const char **argv)
                        }
 
                        /* Ownership of the action was transferred to the list. */
-                       action = NULL;
+                       action = nullptr;
 
                        break;
                }
@@ -2318,7 +2318,7 @@ int cmd_add_trigger(int argc, const char **argv)
                 * the action. We can destroy ours.
                 */
                lttng_action_destroy(action);
-               action = NULL;
+               action = nullptr;
        }
 
        trigger = lttng_trigger_create(condition, action_list);
@@ -2357,7 +2357,7 @@ int cmd_add_trigger(int argc, const char **argv)
        }
 
        if (lttng_opt_mi) {
-               ret_code = lttng_trigger_mi_serialize(trigger, mi_writer, NULL);
+               ret_code = lttng_trigger_mi_serialize(trigger, mi_writer, nullptr);
                if (ret_code != LTTNG_OK) {
                        goto error;
                }
index b3829c499dfd4186aeb5fe62454f5888ddc50a72..f26e6e5b998445a0c973a60dc3eb5eed2f5997f1 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;
 
-       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;
index 985dde992b1e5a7ef3edc090bd762121641044bc..dce13866f6dea7d2948149de093e49af65935bde 100644 (file)
@@ -63,18 +63,24 @@ enum output_type {
 static struct mi_writer *writer;
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
-       { "output", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "set-url", 'U', POPT_ARG_STRING, &opt_url, 0, 0, 0 },
-       { "ctrl-url", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0 },
-       { "data-url", 'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0 },
-       { "no-output", 0, POPT_ARG_VAL, &opt_no_output, 1, 0, 0 },
-       { "no-consumer", 0, POPT_ARG_VAL, &opt_no_consumer, 1, 0, 0 },
-       { "snapshot", 0, POPT_ARG_VAL, &opt_snapshot, 1, 0, 0 },
-       { "live", 0, POPT_ARG_INT | POPT_ARGFLAG_OPTIONAL, 0, OPT_LIVE_TIMER, 0, 0 },
-       { "shm-path", 0, POPT_ARG_STRING, &opt_shm_path, 0, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "output", 'o', POPT_ARG_STRING, &opt_output_path, 0, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "set-url", 'U', POPT_ARG_STRING, &opt_url, 0, nullptr, nullptr },
+       { "ctrl-url", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, nullptr, nullptr },
+       { "data-url", 'D', POPT_ARG_STRING, &opt_data_url, 0, nullptr, nullptr },
+       { "no-output", 0, POPT_ARG_VAL, &opt_no_output, 1, nullptr, nullptr },
+       { "no-consumer", 0, POPT_ARG_VAL, &opt_no_consumer, 1, nullptr, nullptr },
+       { "snapshot", 0, POPT_ARG_VAL, &opt_snapshot, 1, nullptr, nullptr },
+       { "live",
+         0,
+         POPT_ARG_INT | POPT_ARGFLAG_OPTIONAL,
+         nullptr,
+         OPT_LIVE_TIMER,
+         nullptr,
+         nullptr },
+       { "shm-path", 0, POPT_ARG_STRING, &opt_shm_path, 0, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -132,9 +138,9 @@ static struct lttng_session_descriptor *create_session_descriptor(const char *se
 {
        ssize_t uri_count;
        enum output_type output_type;
-       struct lttng_uri *uris = NULL;
-       struct lttng_session_descriptor *descriptor = NULL;
-       const char *uri_str1 = NULL, *uri_str2 = NULL;
+       struct lttng_uri *uris = nullptr;
+       struct lttng_session_descriptor *descriptor = nullptr;
+       const char *uri_str1 = nullptr, *uri_str2 = nullptr;
        char local_output_path[LTTNG_PATH_MAX] = {};
 
        if (opt_no_output) {
@@ -201,7 +207,7 @@ static struct lttng_session_descriptor *create_session_descriptor(const char *se
                case OUTPUT_LOCAL:
                        descriptor = lttng_session_descriptor_snapshot_local_create(
                                session_name,
-                               output_type == OUTPUT_LOCAL ? local_output_path : NULL);
+                               output_type == OUTPUT_LOCAL ? local_output_path : nullptr);
                        break;
                case OUTPUT_NONE:
                        descriptor = lttng_session_descriptor_snapshot_create(session_name);
@@ -228,7 +234,7 @@ static struct lttng_session_descriptor *create_session_descriptor(const char *se
                case OUTPUT_LOCAL:
                        descriptor = lttng_session_descriptor_local_create(
                                session_name,
-                               output_type == OUTPUT_LOCAL ? local_output_path : NULL);
+                               output_type == OUTPUT_LOCAL ? local_output_path : nullptr);
                        break;
                case OUTPUT_NONE:
                        descriptor = lttng_session_descriptor_create(session_name);
@@ -256,7 +262,7 @@ static struct lttng_session_descriptor *create_session_descriptor(const char *se
                        ret = spawn_relayd(pathname, 0);
                        if (ret < 0) {
                                lttng_session_descriptor_destroy(descriptor);
-                               descriptor = NULL;
+                               descriptor = nullptr;
                        }
                }
        }
@@ -275,11 +281,11 @@ static int create_session(const char *session_name)
 {
        int ret, i;
        char shm_path[LTTNG_PATH_MAX] = {};
-       struct lttng_session_descriptor *session_descriptor = NULL;
+       struct lttng_session_descriptor *session_descriptor = nullptr;
        enum lttng_session_descriptor_status descriptor_status;
        enum lttng_error_code ret_code;
-       struct lttng_session *sessions = NULL;
-       const struct lttng_session *created_session = NULL;
+       struct lttng_session *sessions = nullptr;
+       const struct lttng_session *created_session = nullptr;
        const char *created_session_name;
 
        /* Validate options. */
@@ -440,7 +446,7 @@ static int create_session(const char *session_name)
                }
 
                while ((iter = lttng_snapshot_output_list_get_next(list))) {
-                       const char *url = NULL;
+                       const char *url = nullptr;
 
                        url = lttng_snapshot_output_get_ctrl_url(iter);
                        ret = lttng_strncpy(snapshot_url, url, sizeof(snapshot_url));
@@ -563,10 +569,10 @@ end:
  *  the liblttngctl API for the check. If not, try to
  *  spawn a daemon.
  */
-static int launch_sessiond(void)
+static int launch_sessiond()
 {
        int ret;
-       const char *pathname = NULL;
+       const char *pathname = nullptr;
 
        ret = lttng_session_daemon_alive();
        if (ret) {
@@ -579,19 +585,19 @@ static int launch_sessiond(void)
        pathname = opt_sessiond_path;
 
        /* Try LTTNG_SESSIOND_PATH env variable */
-       if (pathname == NULL) {
+       if (pathname == nullptr) {
                pathname = getenv(DEFAULT_SESSIOND_PATH_ENV);
        }
 
        /* Try with configured path */
-       if (pathname == NULL) {
+       if (pathname == nullptr) {
                if (CONFIG_SESSIOND_BIN[0] != '\0') {
                        pathname = CONFIG_SESSIOND_BIN;
                }
        }
 
        /* Try the default path */
-       if (pathname == NULL) {
+       if (pathname == nullptr) {
                pathname = INSTALL_BIN_PATH "/lttng-sessiond";
        }
 
@@ -612,7 +618,7 @@ end:
        return ret;
 }
 
-static int validate_url_option_combination(void)
+static int validate_url_option_combination()
 {
        int ret = 0;
        int used_count = 0;
@@ -636,12 +642,12 @@ static int validate_url_option_combination(void)
 int cmd_create(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
-       char *opt_arg = NULL;
-       const char *arg_session_name = NULL;
-       const char *leftover = NULL;
+       char *opt_arg = nullptr;
+       const char *arg_session_name = nullptr;
+       const char *leftover = nullptr;
        static poptContext pc;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
index 6291dd36f1c0af7971e90793ddc8efdc3f70a0f1..270cefffcbcc3688e045da692894e863c8accf60 100644 (file)
@@ -42,11 +42,11 @@ 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_destroy_all, 1, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "all", 'a', POPT_ARG_VAL, &opt_destroy_all, 1, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -58,14 +58,14 @@ static struct poptOption long_options[] = {
 static int destroy_session(struct lttng_session *session)
 {
        int ret;
-       char *session_name = NULL;
+       char *session_name = nullptr;
        bool session_was_already_stopped;
        enum lttng_error_code ret_code;
-       struct lttng_destruction_handle *handle = NULL;
+       struct lttng_destruction_handle *handle = nullptr;
        enum lttng_destruction_handle_status status;
        bool newline_needed = false, printed_destroy_msg = false;
        enum lttng_rotation_state rotation_state;
-       char *stats_str = NULL;
+       char *stats_str = nullptr;
 
        ret = lttng_stop_tracing_no_wait(session->name);
        if (ret < 0 && ret != -LTTNG_ERR_TRACE_ALREADY_STOPPED) {
@@ -263,15 +263,15 @@ int cmd_destroy(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;
+       char *session_name = nullptr;
+       const char *arg_session_name = nullptr;
+       const char *leftover = nullptr;
 
-       struct lttng_session *sessions = NULL;
+       struct lttng_session *sessions = nullptr;
        int count;
        int 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) {
@@ -342,12 +342,12 @@ int cmd_destroy(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;
index 8bc9861f93a4a2fcd495887e4b173b8eedd983c4..3b188b8d3a98da250441669f5f04a96c6613b91f 100644 (file)
@@ -41,12 +41,12 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
-       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 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 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, nullptr, nullptr },
+       { "userspace", 'u', POPT_ARG_NONE, nullptr, OPT_USERSPACE, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static int mi_partial_channel_print(char *channel_name, unsigned int enabled, int success)
@@ -112,7 +112,7 @@ static int disable_channels(char *session_name, char *channel_list)
        }
 
        handle = lttng_create_handle(session_name, &dom);
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = -1;
                goto error;
        }
@@ -129,7 +129,7 @@ static int disable_channels(char *session_name, char *channel_list)
 
        /* Strip channel list */
        channel_name = strtok(channel_list, ",");
-       while (channel_name != NULL) {
+       while (channel_name != nullptr) {
                DBG("Disabling channel %s", channel_name);
 
                ret = lttng_disable_channel(handle, channel_name);
@@ -169,7 +169,7 @@ static int disable_channels(char *session_name, char *channel_list)
                }
 
                /* Next channel */
-               channel_name = strtok(NULL, ",");
+               channel_name = strtok(nullptr, ",");
        }
 
        ret = CMD_SUCCESS;
@@ -204,12 +204,12 @@ int cmd_disable_channels(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       char *session_name = NULL;
-       char *channel_list = NULL;
-       const char *arg_channel_list = NULL;
-       const char *leftover = NULL;
+       char *session_name = nullptr;
+       char *channel_list = nullptr;
+       const char *arg_channel_list = nullptr;
+       const char *leftover = nullptr;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -236,14 +236,14 @@ int cmd_disable_channels(int argc, const char **argv)
        }
 
        arg_channel_list = poptGetArg(pc);
-       if (arg_channel_list == NULL) {
+       if (arg_channel_list == nullptr) {
                ERR("Missing channel name(s).");
                ret = CMD_ERROR;
                goto end;
        }
 
        channel_list = strdup(arg_channel_list);
-       if (channel_list == NULL) {
+       if (channel_list == nullptr) {
                PERROR("Failed to copy channel name");
                ret = CMD_ERROR;
                goto end;
@@ -258,7 +258,7 @@ int cmd_disable_channels(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        ret = CMD_ERROR;
                        goto end;
                }
index 6d9e09d046d4f05345df35aec6c8bea7c8065ef8..6cf5119c2e446448138416ac268e87b7915bb11e 100644 (file)
@@ -51,22 +51,22 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "all-events", 'a', POPT_ARG_VAL, &opt_disable_all, 1, 0, 0 },
-       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0 },
-       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0 },
-       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0 },
-       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0 },
-       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
-       { "userspace", 'u', POPT_ARG_VAL, &opt_userspace, 1, 0, 0 },
-       { "syscall", 0, POPT_ARG_NONE, 0, OPT_TYPE_SYSCALL, 0, 0 },
-       { "probe", 0, POPT_ARG_NONE, 0, OPT_TYPE_PROBE, 0, 0 },
-       { "tracepoint", 0, POPT_ARG_NONE, 0, OPT_TYPE_TRACEPOINT, 0, 0 },
-       { "function", 0, POPT_ARG_NONE, 0, OPT_TYPE_FUNCTION, 0, 0 },
-       { "all", 0, POPT_ARG_NONE, 0, OPT_TYPE_ALL, 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 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "all-events", 'a', POPT_ARG_VAL, &opt_disable_all, 1, nullptr, nullptr },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, nullptr, nullptr },
+       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, nullptr, nullptr },
+       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, nullptr, nullptr },
+       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, nullptr, nullptr },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, nullptr, nullptr },
+       { "userspace", 'u', POPT_ARG_VAL, &opt_userspace, 1, nullptr, nullptr },
+       { "syscall", 0, POPT_ARG_NONE, nullptr, OPT_TYPE_SYSCALL, nullptr, nullptr },
+       { "probe", 0, POPT_ARG_NONE, nullptr, OPT_TYPE_PROBE, nullptr, nullptr },
+       { "tracepoint", 0, POPT_ARG_NONE, nullptr, OPT_TYPE_TRACEPOINT, nullptr, nullptr },
+       { "function", 0, POPT_ARG_NONE, nullptr, OPT_TYPE_FUNCTION, nullptr, nullptr },
+       { "all", 0, POPT_ARG_NONE, nullptr, OPT_TYPE_ALL, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static const char *print_channel_name(const char *name)
@@ -149,7 +149,7 @@ static int disable_events(char *session_name, char *event_list)
 {
        int ret = CMD_SUCCESS, warn = 0, command_ret = CMD_SUCCESS;
        int enabled = 1, success = 1;
-       char *event_name, *channel_name = NULL;
+       char *event_name, *channel_name = nullptr;
        struct lttng_domain dom;
        struct lttng_event event;
 
@@ -174,7 +174,7 @@ static int disable_events(char *session_name, char *event_list)
        channel_name = opt_channel_name;
 
        handle = lttng_create_handle(session_name, &dom);
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = -1;
                goto error;
        }
@@ -210,7 +210,7 @@ static int disable_events(char *session_name, char *event_list)
        event.type = (lttng_event_type) opt_event_type;
 
        if (opt_disable_all) {
-               command_ret = lttng_disable_event_ext(handle, &event, channel_name, NULL);
+               command_ret = lttng_disable_event_ext(handle, &event, channel_name, nullptr);
                if (command_ret < 0) {
                        ERR("%s", lttng_strerror(command_ret));
                        enabled = 1;
@@ -235,12 +235,13 @@ static int disable_events(char *session_name, char *event_list)
        } else {
                /* Strip event list */
                event_name = strtok(event_list, ",");
-               while (event_name != NULL) {
+               while (event_name != nullptr) {
                        DBG("Disabling event %s", event_name);
 
                        strncpy(event.name, event_name, sizeof(event.name));
                        event.name[sizeof(event.name) - 1] = '\0';
-                       command_ret = lttng_disable_event_ext(handle, &event, channel_name, NULL);
+                       command_ret =
+                               lttng_disable_event_ext(handle, &event, channel_name, nullptr);
                        if (command_ret < 0) {
                                ERR("%s of type %s : %s (channel %s, session %s)",
                                    event_name,
@@ -277,7 +278,7 @@ static int disable_events(char *session_name, char *event_list)
                        }
 
                        /* Next event */
-                       event_name = strtok(NULL, ",");
+                       event_name = strtok(nullptr, ",");
                }
        }
 
@@ -311,13 +312,13 @@ int cmd_disable_events(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       char *session_name = NULL;
-       char *event_list = NULL;
-       const char *arg_event_list = NULL;
-       const char *leftover = NULL;
+       char *session_name = nullptr;
+       char *event_list = nullptr;
+       const char *arg_event_list = nullptr;
+       const char *leftover = nullptr;
        int event_type = -1;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        /* Default event type */
@@ -379,7 +380,7 @@ int cmd_disable_events(int argc, const char **argv)
        }
 
        arg_event_list = poptGetArg(pc);
-       if (arg_event_list == NULL && opt_disable_all == 0) {
+       if (arg_event_list == nullptr && opt_disable_all == 0) {
                ERR("Missing event name(s).\n");
                ret = CMD_ERROR;
                goto end;
@@ -387,7 +388,7 @@ int cmd_disable_events(int argc, const char **argv)
 
        if (opt_disable_all == 0) {
                event_list = strdup(arg_event_list);
-               if (event_list == NULL) {
+               if (event_list == nullptr) {
                        PERROR("Failed to copy event name(s)");
                        ret = CMD_ERROR;
                        goto end;
@@ -403,7 +404,7 @@ int cmd_disable_events(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        ret = CMD_ERROR;
                        goto end;
                }
index 162cec17c8640633982346d6438402a2d91f0801..a75af66ba347026a359aa325d3a575207161fd3c 100644 (file)
@@ -41,12 +41,12 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "timer", 0, POPT_ARG_NONE, 0, OPT_TIMER, 0, 0 },
-       { "size", 0, POPT_ARG_NONE, 0, OPT_SIZE, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "timer", 0, POPT_ARG_NONE, nullptr, OPT_TIMER, nullptr, nullptr },
+       { "size", 0, POPT_ARG_NONE, nullptr, OPT_SIZE, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static const char *schedule_type_str[] = {
@@ -61,7 +61,7 @@ get_schedule(const char *session_name,
 {
        unsigned int count, i;
        enum lttng_rotation_status status;
-       const struct lttng_rotation_schedule *ret = NULL;
+       const struct lttng_rotation_schedule *ret = nullptr;
 
        status = lttng_rotation_schedules_get_count(schedules, &count);
        if (status != LTTNG_ROTATION_STATUS_OK) {
@@ -71,7 +71,7 @@ get_schedule(const char *session_name,
        }
 
        for (i = 0; i < count; i++) {
-               const struct lttng_rotation_schedule *schedule = NULL;
+               const struct lttng_rotation_schedule *schedule = nullptr;
 
                schedule = lttng_rotation_schedules_get_at_index(schedules, i);
                if (!schedule) {
@@ -96,7 +96,7 @@ end:
 
 static struct lttng_rotation_schedule *create_empty_schedule(enum lttng_rotation_schedule_type type)
 {
-       struct lttng_rotation_schedule *schedule = NULL;
+       struct lttng_rotation_schedule *schedule = nullptr;
 
        switch (type) {
        case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
@@ -116,11 +116,11 @@ static enum cmd_error_code remove_schedule(const char *session_name,
 {
        enum cmd_error_code cmd_ret;
        int ret;
-       const struct lttng_rotation_schedule *schedule = NULL;
-       struct lttng_rotation_schedules *schedules = NULL;
+       const struct lttng_rotation_schedule *schedule = nullptr;
+       struct lttng_rotation_schedules *schedules = nullptr;
        enum lttng_rotation_status status;
        const char *schedule_type_name;
-       struct lttng_rotation_schedule *empty_schedule = NULL;
+       struct lttng_rotation_schedule *empty_schedule = nullptr;
 
        switch (schedule_type) {
        case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
@@ -203,11 +203,11 @@ int cmd_disable_rotation(int argc, const char **argv)
        int popt_ret, opt, ret = 0;
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
        static poptContext pc;
-       char *session_name = NULL;
+       char *session_name = nullptr;
        bool free_session_name = false;
        bool periodic_rotation = false, size_rotation = false;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        popt_ret = poptReadDefaultConfig(pc, 0);
        if (popt_ret) {
                cmd_ret = CMD_ERROR;
@@ -235,9 +235,9 @@ int cmd_disable_rotation(int argc, const char **argv)
                }
        }
 
-       if (opt_session_name == NULL) {
+       if (opt_session_name == nullptr) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        goto error;
                }
                free_session_name = true;
index c0a35d05dbd7f37584a5765e82763ff20a0b1ada..c302132fbca258e4e5234c679ef4073a38612092 100644 (file)
@@ -73,26 +73,26 @@ const char *output_splice = "splice";
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
-       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
-       { "discard", 0, POPT_ARG_NONE, 0, OPT_DISCARD, 0, 0 },
-       { "overwrite", 0, POPT_ARG_NONE, 0, OPT_OVERWRITE, 0, 0 },
-       { "subbuf-size", 0, POPT_ARG_STRING, 0, OPT_SUBBUF_SIZE, 0, 0 },
-       { "num-subbuf", 0, POPT_ARG_INT, 0, OPT_NUM_SUBBUF, 0, 0 },
-       { "switch-timer", 0, POPT_ARG_INT, 0, OPT_SWITCH_TIMER, 0, 0 },
-       { "monitor-timer", 0, POPT_ARG_INT, 0, OPT_MONITOR_TIMER, 0, 0 },
-       { "read-timer", 0, POPT_ARG_INT, 0, OPT_READ_TIMER, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "output", 0, POPT_ARG_STRING, &opt_output, 0, 0, 0 },
-       { "buffers-uid", 0, POPT_ARG_VAL, &opt_buffer_uid, 1, 0, 0 },
-       { "buffers-pid", 0, POPT_ARG_VAL, &opt_buffer_pid, 1, 0, 0 },
-       { "buffers-global", 0, POPT_ARG_VAL, &opt_buffer_global, 1, 0, 0 },
-       { "tracefile-size", 'C', POPT_ARG_INT, 0, OPT_TRACEFILE_SIZE, 0, 0 },
-       { "tracefile-count", 'W', POPT_ARG_INT, 0, OPT_TRACEFILE_COUNT, 0, 0 },
-       { "blocking-timeout", 0, POPT_ARG_INT, 0, OPT_BLOCKING_TIMEOUT, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, nullptr, nullptr },
+       { "userspace", 'u', POPT_ARG_NONE, nullptr, OPT_USERSPACE, nullptr, nullptr },
+       { "discard", 0, POPT_ARG_NONE, nullptr, OPT_DISCARD, nullptr, nullptr },
+       { "overwrite", 0, POPT_ARG_NONE, nullptr, OPT_OVERWRITE, nullptr, nullptr },
+       { "subbuf-size", 0, POPT_ARG_STRING, nullptr, OPT_SUBBUF_SIZE, nullptr, nullptr },
+       { "num-subbuf", 0, POPT_ARG_INT, nullptr, OPT_NUM_SUBBUF, nullptr, nullptr },
+       { "switch-timer", 0, POPT_ARG_INT, nullptr, OPT_SWITCH_TIMER, nullptr, nullptr },
+       { "monitor-timer", 0, POPT_ARG_INT, nullptr, OPT_MONITOR_TIMER, nullptr, nullptr },
+       { "read-timer", 0, POPT_ARG_INT, nullptr, OPT_READ_TIMER, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "output", 0, POPT_ARG_STRING, &opt_output, 0, nullptr, nullptr },
+       { "buffers-uid", 0, POPT_ARG_VAL, &opt_buffer_uid, 1, nullptr, nullptr },
+       { "buffers-pid", 0, POPT_ARG_VAL, &opt_buffer_pid, 1, nullptr, nullptr },
+       { "buffers-global", 0, POPT_ARG_VAL, &opt_buffer_global, 1, nullptr, nullptr },
+       { "tracefile-size", 'C', POPT_ARG_INT, nullptr, OPT_TRACEFILE_SIZE, nullptr, nullptr },
+       { "tracefile-count", 'W', POPT_ARG_INT, nullptr, OPT_TRACEFILE_COUNT, nullptr, nullptr },
+       { "blocking-timeout", 0, POPT_ARG_INT, nullptr, OPT_BLOCKING_TIMEOUT, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -139,7 +139,7 @@ static void set_default_attr(struct lttng_domain *dom)
  */
 static int enable_channel(char *session_name, char *channel_list)
 {
-       struct lttng_channel *channel = NULL;
+       struct lttng_channel *channel = nullptr;
        int ret = CMD_SUCCESS, warn = 0, error = 0, success = 0;
        char *channel_name;
        struct lttng_domain dom;
@@ -215,7 +215,7 @@ static int enable_channel(char *session_name, char *channel_list)
        }
 
        handle = lttng_create_handle(session_name, &dom);
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = -1;
                goto error;
        }
@@ -232,7 +232,7 @@ static int enable_channel(char *session_name, char *channel_list)
 
        /* Strip channel list (format: chan1,chan2,...) */
        channel_name = strtok(channel_list, ",");
-       while (channel_name != NULL) {
+       while (channel_name != nullptr) {
                void *extended_ptr;
 
                /* Validate channel name's length */
@@ -343,9 +343,9 @@ static int enable_channel(char *session_name, char *channel_list)
                }
 
                /* Next channel */
-               channel_name = strtok(NULL, ",");
+               channel_name = strtok(nullptr, ",");
                lttng_channel_destroy(channel);
-               channel = NULL;
+               channel = nullptr;
        }
 
        if (lttng_opt_mi) {
@@ -380,14 +380,14 @@ error:
 /*
  * Default value for channel configuration.
  */
-static void init_channel_config(void)
+static void init_channel_config()
 {
        /*
         * Put -1 everywhere so we can identify those set by the command line and
         * those needed to be set by the default values.
         */
        memset(&chan_opts.attr, -1, sizeof(chan_opts.attr));
-       chan_opts.attr.extended.ptr = NULL;
+       chan_opts.attr.extended.ptr = nullptr;
 }
 
 /*
@@ -397,15 +397,15 @@ int cmd_enable_channels(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       char *session_name = NULL;
-       char *channel_list = NULL;
-       char *opt_arg = NULL;
-       const char *arg_channel_list = NULL;
-       const char *leftover = NULL;
+       char *session_name = nullptr;
+       char *channel_list = nullptr;
+       char *opt_arg = nullptr;
+       const char *arg_channel_list = nullptr;
+       const char *leftover = nullptr;
 
        init_channel_config();
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -467,7 +467,7 @@ int cmd_enable_channels(int argc, const char **argv)
 
                        errno = 0;
                        opt_arg = poptGetOptArg(pc);
-                       chan_opts.attr.num_subbuf = strtoull(opt_arg, NULL, 0);
+                       chan_opts.attr.num_subbuf = strtoull(opt_arg, nullptr, 0);
                        if (errno != 0 || !chan_opts.attr.num_subbuf || !isdigit(opt_arg[0])) {
                                ERR("Wrong value in --num-subbuf parameter: %s", opt_arg);
                                ret = CMD_ERROR;
@@ -638,7 +638,7 @@ int cmd_enable_channels(int argc, const char **argv)
 
                        errno = 0;
                        opt_arg = poptGetOptArg(pc);
-                       v = strtoul(opt_arg, NULL, 0);
+                       v = strtoul(opt_arg, nullptr, 0);
                        if (errno != 0 || !isdigit(opt_arg[0])) {
                                ERR("Wrong value in --tracefile-count parameter: %s", opt_arg);
                                ret = CMD_ERROR;
@@ -707,7 +707,7 @@ int cmd_enable_channels(int argc, const char **argv)
        }
 
        arg_channel_list = poptGetArg(pc);
-       if (arg_channel_list == NULL) {
+       if (arg_channel_list == nullptr) {
                ERR("Missing channel name.");
                ret = CMD_ERROR;
                success = 0;
@@ -715,7 +715,7 @@ int cmd_enable_channels(int argc, const char **argv)
        }
 
        channel_list = strdup(arg_channel_list);
-       if (channel_list == NULL) {
+       if (channel_list == nullptr) {
                PERROR("Failed to copy channel name");
                ret = CMD_ERROR;
                success = 0;
@@ -732,7 +732,7 @@ int cmd_enable_channels(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        command_ret = CMD_ERROR;
                        success = 0;
                        goto mi_closing;
index 5c655bb4332cc9177e261e1d4b2d38daa18025ec..ef58bfa75ff0f752fc57a63c32168c1ea5faac3f 100644 (file)
@@ -78,26 +78,32 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "all", 'a', POPT_ARG_VAL, &opt_enable_all, 1, 0, 0 },
-       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0 },
-       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
-       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
-       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0 },
-       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0 },
-       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0 },
-       { "tracepoint", 0, POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0 },
-       { "probe", 0, POPT_ARG_STRING, &opt_probe, OPT_PROBE, 0, 0 },
-       { "userspace-probe", 0, POPT_ARG_STRING, &opt_userspace_probe, OPT_USERSPACE_PROBE, 0, 0 },
-       { "function", 0, POPT_ARG_STRING, &opt_function, OPT_FUNCTION, 0, 0 },
-       { "syscall", 0, POPT_ARG_NONE, 0, OPT_SYSCALL, 0, 0 },
-       { "loglevel", 0, POPT_ARG_STRING, 0, OPT_LOGLEVEL, 0, 0 },
-       { "loglevel-only", 0, POPT_ARG_STRING, 0, OPT_LOGLEVEL_ONLY, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "filter", 'f', POPT_ARG_STRING, &opt_filter, OPT_FILTER, 0, 0 },
-       { "exclude", 'x', POPT_ARG_STRING, &opt_exclude, OPT_EXCLUDE, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "all", 'a', POPT_ARG_VAL, &opt_enable_all, 1, nullptr, nullptr },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, nullptr, nullptr },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, nullptr, nullptr },
+       { "userspace", 'u', POPT_ARG_NONE, nullptr, OPT_USERSPACE, nullptr, nullptr },
+       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, nullptr, nullptr },
+       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, nullptr, nullptr },
+       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, nullptr, nullptr },
+       { "tracepoint", 0, POPT_ARG_NONE, nullptr, OPT_TRACEPOINT, nullptr, nullptr },
+       { "probe", 0, POPT_ARG_STRING, &opt_probe, OPT_PROBE, nullptr, nullptr },
+       { "userspace-probe",
+         0,
+         POPT_ARG_STRING,
+         &opt_userspace_probe,
+         OPT_USERSPACE_PROBE,
+         nullptr,
+         nullptr },
+       { "function", 0, POPT_ARG_STRING, &opt_function, OPT_FUNCTION, nullptr, nullptr },
+       { "syscall", 0, POPT_ARG_NONE, nullptr, OPT_SYSCALL, nullptr, nullptr },
+       { "loglevel", 0, POPT_ARG_STRING, nullptr, OPT_LOGLEVEL, nullptr, nullptr },
+       { "loglevel-only", 0, POPT_ARG_STRING, nullptr, OPT_LOGLEVEL_ONLY, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "filter", 'f', POPT_ARG_STRING, &opt_filter, OPT_FILTER, nullptr, nullptr },
+       { "exclude", 'x', POPT_ARG_STRING, &opt_exclude, OPT_EXCLUDE, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -111,7 +117,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt)
 #define S_HEX_LEN_SCANF_IS_A_BROKEN_API "18" /* 18 is (19 - 1) (\0 is extra) */
        char name[LTTNG_SYMBOL_NAME_LEN];
 
-       if (opt == NULL) {
+       if (opt == nullptr) {
                ret = CMD_ERROR;
                goto end;
        }
@@ -131,7 +137,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt)
                        ret = CMD_ERROR;
                        goto end;
                }
-               ev->attr.probe.offset = strtoull(s_hex, NULL, 0);
+               ev->attr.probe.offset = strtoull(s_hex, nullptr, 0);
                DBG("probe offset %" PRIu64, ev->attr.probe.offset);
                ev->attr.probe.addr = 0;
                goto end;
@@ -164,7 +170,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt)
                        ret = CMD_ERROR;
                        goto end;
                }
-               ev->attr.probe.addr = strtoull(s_hex, NULL, 0);
+               ev->attr.probe.addr = strtoull(s_hex, nullptr, 0);
                DBG("probe addr %" PRIu64, ev->attr.probe.addr);
                ev->attr.probe.offset = 0;
                memset(ev->attr.probe.symbol_name, 0, LTTNG_SYMBOL_NAME_LEN);
@@ -253,7 +259,7 @@ static char *print_exclusions(const struct lttng_dynamic_pointer_array *exclusio
        length += sizeof(preamble);
        ret = calloc<char>(length);
        if (!ret) {
-               return NULL;
+               return nullptr;
        }
 
        strncpy(ret, preamble, length);
@@ -432,13 +438,13 @@ static int enable_events(char *session_name, char *event_list)
 {
        int ret = CMD_SUCCESS, command_ret = CMD_SUCCESS;
        int error_holder = CMD_SUCCESS, warn = 0, error = 0, success = 1;
-       char *event_name, *channel_name = NULL;
+       char *event_name, *channel_name = nullptr;
        struct lttng_event *ev;
        struct lttng_domain dom = {};
        struct lttng_dynamic_pointer_array exclusions;
-       struct lttng_userspace_probe_location *uprobe_loc = NULL;
+       struct lttng_userspace_probe_location *uprobe_loc = nullptr;
 
-       lttng_dynamic_pointer_array_init(&exclusions, NULL);
+       lttng_dynamic_pointer_array_init(&exclusions, nullptr);
 
        ev = lttng_event_create();
        if (!ev) {
@@ -522,7 +528,7 @@ static int enable_events(char *session_name, char *event_list)
        channel_name = opt_channel_name;
 
        handle = lttng_create_handle(session_name, &dom);
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = -1;
                goto error;
        }
@@ -614,7 +620,7 @@ static int enable_events(char *session_name, char *event_list)
                                handle,
                                ev,
                                channel_name,
-                               NULL,
+                               nullptr,
                                lttng_dynamic_pointer_array_get_count(&exclusions),
                                (char **) exclusions.array.buffer.data);
                        if (ret < 0) {
@@ -824,7 +830,7 @@ static int enable_events(char *session_name, char *event_list)
 
        /* Strip event list */
        event_name = strtok(event_list, ",");
-       while (event_name != NULL) {
+       while (event_name != nullptr) {
                /* Copy name and type of the event */
                strncpy(ev->name, event_name, LTTNG_SYMBOL_NAME_LEN);
                ev->name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
@@ -882,7 +888,7 @@ static int enable_events(char *session_name, char *event_list)
                                }
 
                                /* Ownership of the uprobe location was transferred to the event. */
-                               uprobe_loc = NULL;
+                               uprobe_loc = nullptr;
                                break;
                        case LTTNG_EVENT_FUNCTION:
                                ret = parse_probe_opts(ev, opt_function);
@@ -1024,7 +1030,7 @@ static int enable_events(char *session_name, char *event_list)
                                handle,
                                ev,
                                channel_name,
-                               NULL,
+                               nullptr,
                                lttng_dynamic_pointer_array_get_count(&exclusions),
                                (char **) exclusions.array.buffer.data);
                        exclusion_string = print_exclusions(&exclusions);
@@ -1212,7 +1218,7 @@ static int enable_events(char *session_name, char *event_list)
                }
 
                /* Next event */
-               event_name = strtok(NULL, ",");
+               event_name = strtok(nullptr, ",");
                /* Reset warn, error and success */
                success = 1;
        }
@@ -1254,13 +1260,13 @@ int cmd_enable_events(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       char *session_name = NULL;
-       char *event_list = NULL;
-       const char *arg_event_list = NULL;
-       const char *leftover = NULL;
+       char *session_name = nullptr;
+       char *event_list = nullptr;
+       const char *arg_event_list = nullptr;
+       const char *leftover = nullptr;
        int event_type = -1;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        /* Default event type */
@@ -1352,7 +1358,7 @@ int cmd_enable_events(int argc, const char **argv)
        }
 
        arg_event_list = poptGetArg(pc);
-       if (arg_event_list == NULL && opt_enable_all == 0) {
+       if (arg_event_list == nullptr && opt_enable_all == 0) {
                ERR("Missing event name(s).");
                ret = CMD_ERROR;
                goto end;
@@ -1360,7 +1366,7 @@ int cmd_enable_events(int argc, const char **argv)
 
        if (opt_enable_all == 0) {
                event_list = strdup(arg_event_list);
-               if (event_list == NULL) {
+               if (event_list == nullptr) {
                        PERROR("Failed to copy event name(s)");
                        ret = CMD_ERROR;
                        goto end;
@@ -1376,7 +1382,7 @@ int cmd_enable_events(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        command_ret = CMD_ERROR;
                        success = 0;
                        goto mi_closing;
@@ -1423,7 +1429,7 @@ end:
                ret = ret ? ret : LTTNG_ERR_MI_IO_FAIL;
        }
 
-       if (opt_session_name == NULL) {
+       if (opt_session_name == nullptr) {
                free(session_name);
        }
 
index d65eecb5e58a097fc221e9d22cbabc112f2a19da..77879d0afb352ca9db42101ff38702b903f0d6d6 100644 (file)
@@ -42,12 +42,12 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "timer", 0, POPT_ARG_INT, 0, OPT_TIMER, 0, 0 },
-       { "size", 0, POPT_ARG_INT, 0, OPT_SIZE, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "timer", 0, POPT_ARG_INT, nullptr, OPT_TIMER, nullptr, nullptr },
+       { "size", 0, POPT_ARG_INT, nullptr, OPT_SIZE, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static const char *schedule_type_str[] = {
@@ -60,7 +60,7 @@ static enum cmd_error_code add_schedule(const char *session_name,
                                        uint64_t value)
 {
        enum cmd_error_code ret = CMD_SUCCESS;
-       struct lttng_rotation_schedule *schedule = NULL;
+       struct lttng_rotation_schedule *schedule = nullptr;
        enum lttng_rotation_status status;
        const char *schedule_type_name;
 
@@ -167,13 +167,13 @@ int cmd_enable_rotation(int argc, const char **argv)
        int popt_ret, opt, ret = 0;
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
        static poptContext pc;
-       char *session_name = NULL;
-       char *opt_arg = NULL;
+       char *session_name = nullptr;
+       char *opt_arg = nullptr;
        bool free_session_name = false;
        uint64_t timer_us = 0, size_bytes = 0;
        bool periodic_rotation = false, size_rotation = false;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        popt_ret = poptReadDefaultConfig(pc, 0);
        if (popt_ret) {
                ERR("poptReadDefaultConfig");
@@ -228,9 +228,9 @@ int cmd_enable_rotation(int argc, const char **argv)
                }
        }
 
-       if (opt_session_name == NULL) {
+       if (opt_session_name == nullptr) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        goto error;
                }
                free_session_name = true;
index 5f6d86685b0892bdaf059140fe5bb27bbf7f50a0..00af516de0129bef113303e0853738e057b06c5f 100644 (file)
@@ -25,7 +25,7 @@ static const char *lttng_help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng.1.h>
 #else
-       NULL
+       nullptr
 #endif
        ;
 
@@ -36,9 +36,9 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 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 },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -53,7 +53,7 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
        int found = 0;
        const char *cmd_argv[2];
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -72,7 +72,7 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
 
        /* Get command name */
        arg_cmd_name = poptGetArg(pc);
-       if (arg_cmd_name == NULL) {
+       if (arg_cmd_name == nullptr) {
                /* Fall back to lttng(1) */
                ret = utils_show_help(1, "lttng", lttng_help_msg);
                if (ret) {
@@ -93,7 +93,7 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
        /* Make sure command name exists */
        cmd = &commands[0];
 
-       while (cmd->name != NULL) {
+       while (cmd->name != nullptr) {
                if (strcmp(cmd->name, arg_cmd_name) == 0) {
                        found = 1;
                        break;
index eacaa6354f045a9b00bb54f588f5bd754639a7cd..c4e52b78fef879d9edf902bf25e4dc63c50d28af 100644 (file)
@@ -57,18 +57,18 @@ static struct lttng_session the_listed_session;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
-       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0 },
-       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0 },
-       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0 },
-       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
-       { "channel", 'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0 },
-       { "domain", 'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0 },
-       { "fields", 'f', POPT_ARG_VAL, &opt_fields, 1, 0, 0 },
-       { "syscall", 'S', POPT_ARG_VAL, &opt_syscall, 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 },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, nullptr, nullptr },
+       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, nullptr, nullptr },
+       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, nullptr, nullptr },
+       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, nullptr, nullptr },
+       { "userspace", 'u', POPT_ARG_NONE, nullptr, OPT_USERSPACE, nullptr, nullptr },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel, 0, nullptr, nullptr },
+       { "domain", 'd', POPT_ARG_VAL, &opt_domain, 1, nullptr, nullptr },
+       { "fields", 'f', POPT_ARG_VAL, &opt_fields, 1, nullptr, nullptr },
+       { "syscall", 'S', POPT_ARG_VAL, &opt_syscall, 1, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -80,14 +80,14 @@ static struct poptOption long_options[] = {
 static char *get_cmdline_by_pid(pid_t pid)
 {
        int ret;
-       FILE *fp = NULL;
-       char *cmdline = NULL;
+       FILE *fp = nullptr;
+       char *cmdline = nullptr;
        /* Can't go bigger than /proc/LTTNG_MAX_PID/cmdline */
        char path[sizeof("/proc//cmdline") + sizeof(LTTNG_MAX_PID_STR) - 1];
 
        snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
        fp = fopen(path, "r");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                goto end;
        }
 
@@ -120,7 +120,7 @@ static const char *active_string(int value)
        case -1:
                return "";
        default:
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -144,7 +144,7 @@ static const char *enabled_string(int value)
        case -1:
                return "";
        default:
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -191,7 +191,7 @@ static char *get_exclusion_names_msg(struct lttng_event *event)
 {
        int ret;
        int exclusion_count;
-       char *exclusion_msg = NULL;
+       char *exclusion_msg = nullptr;
        char *at;
        size_t i;
        const char *const exclusion_fmt = " [exclusions: ";
@@ -283,7 +283,7 @@ static void print_userspace_probe_location(struct lttng_event *event)
                MSG("%sType: Function", indent8);
                function_name = lttng_userspace_probe_location_function_get_function_name(location);
                binary_path = realpath(
-                       lttng_userspace_probe_location_function_get_binary_path(location), NULL);
+                       lttng_userspace_probe_location_function_get_binary_path(location), nullptr);
 
                MSG("%sBinary path:   %s", indent8, binary_path ? binary_path : "NULL");
                MSG("%sFunction:      %s()", indent8, function_name ? function_name : "NULL");
@@ -312,7 +312,8 @@ static void print_userspace_probe_location(struct lttng_event *event)
                provider_name =
                        lttng_userspace_probe_location_tracepoint_get_provider_name(location);
                binary_path = realpath(
-                       lttng_userspace_probe_location_tracepoint_get_binary_path(location), NULL);
+                       lttng_userspace_probe_location_tracepoint_get_binary_path(location),
+                       nullptr);
                MSG("%sBinary path:   %s", indent8, binary_path ? binary_path : "NULL");
                MSG("%sTracepoint:    %s:%s",
                    indent8,
@@ -342,8 +343,8 @@ static void print_events(struct lttng_event *event)
 {
        int ret;
        const char *filter_str;
-       char *filter_msg = NULL;
-       char *exclusion_msg = NULL;
+       char *filter_msg = nullptr;
+       char *exclusion_msg = nullptr;
 
        ret = lttng_event_get_filter_expression(event, &filter_str);
 
@@ -351,7 +352,7 @@ static void print_events(struct lttng_event *event)
                filter_msg = strdup(" [failed to retrieve filter]");
        } else if (filter_str) {
                if (asprintf(&filter_msg, " [filter: '%s']", filter_str) == -1) {
-                       filter_msg = NULL;
+                       filter_msg = nullptr;
                }
        }
 
@@ -488,7 +489,7 @@ mi_list_agent_ust_events(struct lttng_event *events, int count, struct lttng_dom
 {
        int ret, i;
        pid_t cur_pid = 0;
-       char *cmdline = NULL;
+       char *cmdline = nullptr;
        int pid_element_open = 0;
 
        /* Open domains element */
@@ -567,14 +568,14 @@ error:
        return ret;
 }
 
-static int list_agent_events(void)
+static int list_agent_events()
 {
        int i, size, ret = CMD_SUCCESS;
        struct lttng_domain domain;
-       struct lttng_handle *handle = NULL;
-       struct lttng_event *event_list = NULL;
+       struct lttng_handle *handle = nullptr;
+       struct lttng_event *event_list = nullptr;
        pid_t cur_pid = 0;
-       char *cmdline = NULL;
+       char *cmdline = nullptr;
        const char *agent_domain_str;
 
        memset(&domain, 0, sizeof(domain));
@@ -594,8 +595,8 @@ static int list_agent_events(void)
 
        DBG("Getting %s tracing events", agent_domain_str);
 
-       handle = lttng_create_handle(NULL, &domain);
-       if (handle == NULL) {
+       handle = lttng_create_handle(nullptr, &domain);
+       if (handle == nullptr) {
                ret = CMD_ERROR;
                goto end;
        }
@@ -626,7 +627,7 @@ static int list_agent_events(void)
                        if (cur_pid != event_list[i].pid) {
                                cur_pid = event_list[i].pid;
                                cmdline = get_cmdline_by_pid(cur_pid);
-                               if (cmdline == NULL) {
+                               if (cmdline == nullptr) {
                                        ret = CMD_ERROR;
                                        goto error;
                                }
@@ -649,14 +650,14 @@ end:
 /*
  * Ask session daemon for all user space tracepoints available.
  */
-static int list_ust_events(void)
+static int list_ust_events()
 {
        int i, size, ret = CMD_SUCCESS;
        struct lttng_domain domain;
        struct lttng_handle *handle;
-       struct lttng_event *event_list = NULL;
+       struct lttng_event *event_list = nullptr;
        pid_t cur_pid = 0;
-       char *cmdline = NULL;
+       char *cmdline = nullptr;
 
        memset(&domain, 0, sizeof(domain));
 
@@ -664,8 +665,8 @@ static int list_ust_events(void)
 
        domain.type = LTTNG_DOMAIN_UST;
 
-       handle = lttng_create_handle(NULL, &domain);
-       if (handle == NULL) {
+       handle = lttng_create_handle(nullptr, &domain);
+       if (handle == nullptr) {
                ret = CMD_ERROR;
                goto end;
        }
@@ -692,7 +693,7 @@ static int list_ust_events(void)
                        if (cur_pid != event_list[i].pid) {
                                cur_pid = event_list[i].pid;
                                cmdline = get_cmdline_by_pid(cur_pid);
-                               if (cmdline == NULL) {
+                               if (cmdline == nullptr) {
                                        ret = CMD_ERROR;
                                        goto error;
                                }
@@ -721,7 +722,7 @@ mi_list_ust_event_fields(struct lttng_event_field *fields, int count, struct ltt
 {
        int ret, i;
        pid_t cur_pid = 0;
-       char *cmdline = NULL;
+       char *cmdline = nullptr;
        int pid_element_open = 0;
        int event_element_open = 0;
        struct lttng_event cur_event;
@@ -834,14 +835,14 @@ error:
 /*
  * Ask session daemon for all user space tracepoint fields available.
  */
-static int list_ust_event_fields(void)
+static int list_ust_event_fields()
 {
        int i, size, ret = CMD_SUCCESS;
        struct lttng_domain domain;
        struct lttng_handle *handle;
        struct lttng_event_field *event_field_list;
        pid_t cur_pid = 0;
-       char *cmdline = NULL;
+       char *cmdline = nullptr;
 
        struct lttng_event cur_event;
 
@@ -852,8 +853,8 @@ static int list_ust_event_fields(void)
 
        domain.type = LTTNG_DOMAIN_UST;
 
-       handle = lttng_create_handle(NULL, &domain);
-       if (handle == NULL) {
+       handle = lttng_create_handle(nullptr, &domain);
+       if (handle == nullptr) {
                ret = CMD_ERROR;
                goto end;
        }
@@ -884,7 +885,7 @@ static int list_ust_event_fields(void)
                        if (cur_pid != event_field_list[i].event.pid) {
                                cur_pid = event_field_list[i].event.pid;
                                cmdline = get_cmdline_by_pid(cur_pid);
-                               if (cmdline == NULL) {
+                               if (cmdline == nullptr) {
                                        ret = CMD_ERROR;
                                        goto error;
                                }
@@ -956,7 +957,7 @@ end:
 /*
  * Ask for all trace events in the kernel
  */
-static int list_kernel_events(void)
+static int list_kernel_events()
 {
        int i, size, ret = CMD_SUCCESS;
        struct lttng_domain domain;
@@ -969,8 +970,8 @@ static int list_kernel_events(void)
 
        domain.type = LTTNG_DOMAIN_KERNEL;
 
-       handle = lttng_create_handle(NULL, &domain);
-       if (handle == NULL) {
+       handle = lttng_create_handle(nullptr, &domain);
+       if (handle == nullptr) {
                ret = CMD_ERROR;
                goto error;
        }
@@ -1044,7 +1045,7 @@ end:
 /*
  * Ask for kernel system calls.
  */
-static int list_syscalls(void)
+static int list_syscalls()
 {
        int i, size, ret = CMD_SUCCESS;
        struct lttng_event *event_list;
@@ -1116,10 +1117,10 @@ end:
  *
  * Return CMD_SUCCESS on success else a negative value.
  */
-static int list_session_agent_events(void)
+static int list_session_agent_events()
 {
        int ret = CMD_SUCCESS, count, i;
-       struct lttng_event *events = NULL;
+       struct lttng_event *events = nullptr;
 
        count = lttng_list_events(the_handle, "", &events);
        if (count < 0) {
@@ -1145,7 +1146,7 @@ static int list_session_agent_events(void)
 
                for (i = 0; i < count; i++) {
                        const char *filter_str;
-                       char *filter_msg = NULL;
+                       char *filter_msg = nullptr;
                        struct lttng_event *event = &events[i];
 
                        ret = lttng_event_get_filter_expression(event, &filter_str);
@@ -1153,7 +1154,7 @@ static int list_session_agent_events(void)
                                filter_msg = strdup(" [failed to retrieve filter]");
                        } else if (filter_str) {
                                if (asprintf(&filter_msg, " [filter: '%s']", filter_str) == -1) {
-                                       filter_msg = NULL;
+                                       filter_msg = nullptr;
                                }
                        }
 
@@ -1219,7 +1220,7 @@ end:
 static int list_events(const char *channel_name)
 {
        int ret = CMD_SUCCESS, count, i;
-       struct lttng_event *events = NULL;
+       struct lttng_event *events = nullptr;
 
        count = lttng_list_events(the_handle, channel_name, &events);
        if (count < 0) {
@@ -1387,7 +1388,7 @@ static int mi_list_channels(struct lttng_channel *channels, int count, const cha
        }
 
        for (i = 0; i < count; i++) {
-               if (channel_name != NULL) {
+               if (channel_name != nullptr) {
                        if (strncmp(channels[i].name, channel_name, NAME_MAX) == 0) {
                                chan_found = 1;
                        } else {
@@ -1437,7 +1438,7 @@ static int list_channels(const char *channel_name)
 {
        int count, i, ret = CMD_SUCCESS;
        unsigned int chan_found = 0;
-       struct lttng_channel *channels = NULL;
+       struct lttng_channel *channels = nullptr;
 
        DBG("Listing channel(s) (%s)", channel_name ?: "<all>");
 
@@ -1477,7 +1478,7 @@ static int list_channels(const char *channel_name)
                }
 
                for (i = 0; i < count; i++) {
-                       if (channel_name != NULL) {
+                       if (channel_name != nullptr) {
                                if (strncmp(channels[i].name, channel_name, NAME_MAX) == 0) {
                                        chan_found = 1;
                                } else {
@@ -1497,7 +1498,7 @@ static int list_channels(const char *channel_name)
                        }
                }
 
-               if (!chan_found && channel_name != NULL) {
+               if (!chan_found && channel_name != nullptr) {
                        ret = CMD_ERROR;
                        ERR("Channel %s not found", channel_name);
                        goto error;
@@ -1528,7 +1529,7 @@ static const char *get_capitalized_process_attr_str(enum lttng_process_attr proc
        default:
                return "Unknown";
        }
-       return NULL;
+       return nullptr;
 }
 
 static int handle_process_attr_status(enum lttng_process_attr process_attr,
@@ -1594,7 +1595,7 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
        enum lttng_process_attr_tracker_handle_status handle_status;
        enum lttng_process_attr_values_status values_status;
        const struct lttng_process_attr_values *values;
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
 
        ret_code = lttng_session_get_tracker_handle(
                the_handle->session_name, the_handle->domain.type, process_attr, &tracker_handle);
@@ -1916,7 +1917,7 @@ static enum cmd_error_code list_rotate_settings(const char *session_name)
        int ret;
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
        unsigned int count, i;
-       struct lttng_rotation_schedules *schedules = NULL;
+       struct lttng_rotation_schedules *schedules = nullptr;
        enum lttng_rotation_status status;
 
        ret = lttng_session_list_rotation_schedules(session_name, &schedules);
@@ -1998,7 +1999,7 @@ static int mi_list_session(const char *session_name, struct lttng_session *sessi
        int ret, i;
        unsigned int session_found = 0;
 
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                ret = -LTTNG_ERR_SESS_NOT_FOUND;
                goto end;
        }
@@ -2068,7 +2069,7 @@ static int list_sessions(const char *session_name)
        int ret = CMD_SUCCESS;
        int count, i;
        unsigned int session_found = 0;
-       struct lttng_session *sessions = NULL;
+       struct lttng_session *sessions = nullptr;
 
        count = lttng_list_sessions(&sessions);
        DBG("Session count %d", count);
@@ -2080,7 +2081,7 @@ static int list_sessions(const char *session_name)
 
        if (lttng_opt_mi) {
                /* Mi */
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        /* List all sessions */
                        ret = mi_list_sessions(sessions, count);
                } else {
@@ -2098,12 +2099,12 @@ static int list_sessions(const char *session_name)
                        goto end;
                }
 
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        MSG("Available recording sessions:");
                }
 
                for (i = 0; i < count; i++) {
-                       if (session_name != NULL) {
+                       if (session_name != nullptr) {
                                if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) {
                                        session_found = 1;
                                        MSG("Recording session %s: [%s%s]",
@@ -2139,13 +2140,13 @@ static int list_sessions(const char *session_name)
                        }
                }
 
-               if (!session_found && session_name != NULL) {
+               if (!session_found && session_name != nullptr) {
                        ERR("Session '%s' not found", session_name);
                        ret = CMD_ERROR;
                        goto end;
                }
 
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        MSG("\nUse lttng list <session_name> for more details");
                }
        }
@@ -2190,7 +2191,7 @@ end:
 static int list_domains(const char *session_name)
 {
        int i, count, ret = CMD_SUCCESS;
-       struct lttng_domain *domains = NULL;
+       struct lttng_domain *domains = nullptr;
 
        count = lttng_list_domains(session_name, &domains);
        if (count < 0) {
@@ -2250,10 +2251,10 @@ end:
 int cmd_list(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS;
-       const char *arg_session_name, *leftover = NULL;
+       const char *arg_session_name, *leftover = nullptr;
        static poptContext pc;
        struct lttng_domain domain;
-       struct lttng_domain *domains = NULL;
+       struct lttng_domain *domains = nullptr;
 
        memset(&domain, 0, sizeof(domain));
 
@@ -2262,7 +2263,7 @@ int cmd_list(int argc, const char **argv)
                goto end;
        }
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -2338,15 +2339,15 @@ int cmd_list(int argc, const char **argv)
 
        if (opt_kernel || opt_userspace || opt_jul || opt_log4j || opt_python) {
                the_handle = lttng_create_handle(arg_session_name, &domain);
-               if (the_handle == NULL) {
+               if (the_handle == nullptr) {
                        ret = CMD_FATAL;
                        goto end;
                }
        }
 
-       if (arg_session_name == NULL) {
+       if (arg_session_name == nullptr) {
                if (!opt_kernel && !opt_userspace && !opt_jul && !opt_log4j && !opt_python) {
-                       ret = list_sessions(NULL);
+                       ret = list_sessions(nullptr);
                        if (ret) {
                                goto end;
                        }
@@ -2505,7 +2506,7 @@ int cmd_list(int argc, const char **argv)
                                }
 
                                the_handle = lttng_create_handle(arg_session_name, &domains[i]);
-                               if (the_handle == NULL) {
+                               if (the_handle == nullptr) {
                                        ret = CMD_FATAL;
                                        goto end;
                                }
index ea47c51f4ba694e2d596a7f9356343fea83e930b..d3961539083eb1cb908cee896a4ec2f4c2b1d1d4 100644 (file)
@@ -124,7 +124,7 @@ static void print_condition_session_rotation(const struct lttng_condition *condi
 static const char *get_pretty_loglevel_name(enum lttng_event_rule_type event_rule_type,
                                            int loglevel)
 {
-       const char *name = NULL;
+       const char *name = nullptr;
 
        switch (event_rule_type) {
        case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
@@ -152,7 +152,7 @@ static void print_event_rule_user_tracepoint(const struct lttng_event_rule *even
        const char *pattern;
        const char *filter;
        int log_level;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
        unsigned int exclusions_count;
        int i;
 
@@ -252,8 +252,8 @@ static void print_event_rule_logging(const struct lttng_event_rule *event_rule)
        const char *pattern;
        const char *filter;
        int log_level;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
-       const char *type_str = NULL;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
+       const char *type_str = nullptr;
 
        event_rule_logging_get_name_pattern logging_get_name_pattern;
        event_rule_logging_get_filter logging_get_filter;
@@ -573,7 +573,7 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
                enum lttng_event_expr_status status;
 
                parent_expr = lttng_event_expr_array_field_element_get_parent_expr(event_expr);
-               LTTNG_ASSERT(parent_expr != NULL);
+               LTTNG_ASSERT(parent_expr != nullptr);
 
                print_one_event_expr(parent_expr);
 
@@ -692,7 +692,7 @@ static void print_action_errors(const struct lttng_trigger *trigger,
                                size_t action_path_length)
 {
        enum lttng_error_code error_query_ret;
-       struct lttng_error_query_results *results = NULL;
+       struct lttng_error_query_results *results = nullptr;
        const char *trigger_name;
        uid_t trigger_uid;
        enum lttng_trigger_status trigger_status;
@@ -740,7 +740,7 @@ static void print_one_action(const struct lttng_trigger *trigger,
 {
        enum lttng_action_type action_type;
        enum lttng_action_status action_status;
-       const struct lttng_rate_policy *policy = NULL;
+       const struct lttng_rate_policy *policy = nullptr;
        const char *value;
 
        action_type = lttng_action_get_type(action);
@@ -897,7 +897,7 @@ end:
 static void print_trigger_errors(const struct lttng_trigger *trigger)
 {
        enum lttng_error_code error_query_ret;
-       struct lttng_error_query_results *results = NULL;
+       struct lttng_error_query_results *results = nullptr;
        enum lttng_trigger_status trigger_status;
        const char *trigger_name;
        uid_t trigger_uid;
@@ -934,7 +934,7 @@ end:
 static void print_condition_errors(const struct lttng_trigger *trigger)
 {
        enum lttng_error_code error_query_ret;
-       struct lttng_error_query_results *results = NULL;
+       struct lttng_error_query_results *results = nullptr;
        enum lttng_trigger_status trigger_status;
        const char *trigger_name;
        uid_t trigger_uid;
@@ -1040,7 +1040,7 @@ static void print_one_trigger(const struct lttng_trigger *trigger)
                }
        } else {
                _MSG(" action:");
-               print_one_action(trigger, action, NULL, 0);
+               print_one_action(trigger, action, nullptr, 0);
        }
 
        print_trigger_errors(trigger);
@@ -1073,7 +1073,7 @@ static int print_sorted_triggers(const struct lttng_triggers *triggers)
        enum lttng_trigger_status trigger_status;
        unsigned int num_triggers;
 
-       lttng_dynamic_pointer_array_init(&sorted_triggers, NULL);
+       lttng_dynamic_pointer_array_init(&sorted_triggers, nullptr);
 
        trigger_status = lttng_triggers_get_count(triggers, &num_triggers);
        if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
@@ -1228,10 +1228,10 @@ mi_error_query_condition_callback(const struct lttng_trigger *trigger,
 int cmd_list_triggers(int argc, const char **argv)
 {
        int ret;
-       struct argpar_iter *argpar_iter = NULL;
-       const struct argpar_item *argpar_item = NULL;
-       struct lttng_triggers *triggers = NULL;
-       struct mi_writer *mi_writer = NULL;
+       struct argpar_iter *argpar_iter = nullptr;
+       const struct argpar_item *argpar_item = nullptr;
+       struct lttng_triggers *triggers = nullptr;
+       struct mi_writer *mi_writer = nullptr;
 
        argc--;
        argv++;
@@ -1245,7 +1245,8 @@ int cmd_list_triggers(int argc, const char **argv)
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item, 1, argv, true, NULL, NULL);
+               status =
+                       parse_next_item(argpar_iter, &argpar_item, 1, argv, true, nullptr, nullptr);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
                    status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
index 1f962f05a8b781d6cbb70ea2c653f7d2013d65be..4a60db2d1134f7b0c854b5084ba3565c22bae2a3 100644 (file)
@@ -44,14 +44,14 @@ static struct mi_writer *the_writer;
 
 static struct poptOption the_load_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "all", 'a', POPT_ARG_NONE, 0, OPT_ALL, 0, 0 },
-       { "input-path", 'i', POPT_ARG_STRING, &the_opt_input_path, 0, 0, 0 },
-       { "force", 'f', POPT_ARG_NONE, 0, OPT_FORCE, 0, 0 },
-       { "override-url", 0, POPT_ARG_STRING, &the_opt_override_url, 0, 0, 0 },
-       { "override-name", 0, POPT_ARG_STRING, &the_opt_override_session_name, 0, 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_NONE, nullptr, OPT_ALL, nullptr, nullptr },
+       { "input-path", 'i', POPT_ARG_STRING, &the_opt_input_path, 0, nullptr, nullptr },
+       { "force", 'f', POPT_ARG_NONE, nullptr, OPT_FORCE, nullptr, nullptr },
+       { "override-url", 0, POPT_ARG_STRING, &the_opt_override_url, 0, nullptr, nullptr },
+       { "override-name", 0, POPT_ARG_STRING, &the_opt_override_session_name, 0, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static int mi_partial_session(const char *session_name)
@@ -149,11 +149,11 @@ int cmd_load(int argc, const char **argv)
        int ret, success;
        int opt;
        poptContext pc;
-       struct lttng_load_session_attr *session_attr = NULL;
-       char *input_path = NULL;
-       const char *leftover = NULL;
+       struct lttng_load_session_attr *session_attr = nullptr;
+       char *input_path = nullptr;
+       const char *leftover = nullptr;
 
-       pc = poptGetContext(NULL, argc, argv, the_load_opts, 0);
+       pc = poptGetContext(nullptr, argc, argv, the_load_opts, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -239,14 +239,14 @@ int cmd_load(int argc, const char **argv)
         * Use realpath to resolve any relative path.
         * */
        if (the_opt_input_path) {
-               input_path = realpath(the_opt_input_path, NULL);
+               input_path = realpath(the_opt_input_path, nullptr);
                if (!input_path) {
                        PERROR("Invalid input path");
                        ret = CMD_ERROR;
                        goto end;
                }
        } else {
-               input_path = NULL;
+               input_path = nullptr;
        }
 
        ret = lttng_load_session_attr_set_input_url(session_attr, input_path);
index 9dd702ec30cae3b14c90e5a5e0849dd134f9bc82..d9b86f2ffef47cecca1bf08ab53a6292afcdbbf9 100644 (file)
@@ -18,7 +18,7 @@
 #include <unistd.h>
 
 static char *opt_session_name;
-static char *session_name = NULL;
+static char *session_name = nullptr;
 
 static int metadata_regenerate(int argc, const char **argv);
 
@@ -42,35 +42,35 @@ static struct poptOption long_options[] = {
                "help",
                'h',
                POPT_ARG_NONE,
-               0,
+               nullptr,
                OPT_HELP,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
        {
                "list-options",
                0,
                POPT_ARG_NONE,
-               NULL,
+               nullptr,
                OPT_LIST_OPTIONS,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
-       { "list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL },
+       { "list-commands", 0, POPT_ARG_NONE, nullptr, OPT_LIST_COMMANDS, nullptr, nullptr },
        {
+               nullptr,
                0,
                0,
+               nullptr,
                0,
-               0,
-               0,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
 };
 
 static struct cmd_struct actions[] = {
-       { "regenerate", metadata_regenerate }, { NULL, NULL } /* Array closure */
+       { "regenerate", metadata_regenerate }, { nullptr, nullptr } /* Array closure */
 };
 
 /*
@@ -82,7 +82,7 @@ static int count_arguments(const char **argv)
 
        LTTNG_ASSERT(argv);
 
-       while (argv[i] != NULL) {
+       while (argv[i] != nullptr) {
                i++;
        }
 
@@ -113,7 +113,7 @@ static int handle_command(const char **argv)
        struct cmd_struct *cmd;
        int ret = CMD_SUCCESS, i = 0, argc, command_ret = CMD_SUCCESS;
 
-       if (argv == NULL) {
+       if (argv == nullptr) {
                ERR("No action specified for metadata command.");
                ret = CMD_ERROR;
                goto end;
@@ -123,7 +123,7 @@ static int handle_command(const char **argv)
        LTTNG_ASSERT(argc >= 1);
 
        cmd = &actions[i];
-       while (cmd->func != NULL) {
+       while (cmd->func != nullptr) {
                /* Find command */
                if (strcmp(argv[0], cmd->name) == 0) {
                        if (lttng_opt_mi) {
@@ -180,7 +180,7 @@ int cmd_metadata(int argc, const char **argv)
                goto end;
        }
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        if (lttng_opt_mi) {
@@ -224,7 +224,7 @@ int cmd_metadata(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        ret = CMD_ERROR;
                        goto end;
                }
index 728c7310819085bdc7c9355e8da0010f6cdf4e9f..fb415739387ab08a72466341527a10109cc02093 100644 (file)
@@ -18,7 +18,7 @@
 #include <unistd.h>
 
 static char *opt_session_name;
-static char *session_name = NULL;
+static char *session_name = nullptr;
 
 static int regenerate_metadata(int argc, const char **argv);
 static int regenerate_statedump(int argc, const char **argv);
@@ -43,37 +43,37 @@ static struct poptOption long_options[] = {
                "help",
                'h',
                POPT_ARG_NONE,
-               0,
+               nullptr,
                OPT_HELP,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
        {
                "list-options",
                0,
                POPT_ARG_NONE,
-               NULL,
+               nullptr,
                OPT_LIST_OPTIONS,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
-       { "list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL },
+       { "list-commands", 0, POPT_ARG_NONE, nullptr, OPT_LIST_COMMANDS, nullptr, nullptr },
        {
+               nullptr,
                0,
                0,
+               nullptr,
                0,
-               0,
-               0,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
 };
 
 static struct cmd_struct actions[] = {
        { "metadata", regenerate_metadata },
        { "statedump", regenerate_statedump },
-       { NULL, NULL } /* Array closure */
+       { nullptr, nullptr } /* Array closure */
 };
 
 /*
@@ -85,7 +85,7 @@ static int count_arguments(const char **argv)
 
        LTTNG_ASSERT(argv);
 
-       while (argv[i] != NULL) {
+       while (argv[i] != nullptr) {
                i++;
        }
 
@@ -133,7 +133,7 @@ static int handle_command(const char **argv)
        struct cmd_struct *cmd;
        int ret = CMD_SUCCESS, i = 0, argc, command_ret = CMD_SUCCESS;
 
-       if (argv == NULL) {
+       if (argv == nullptr) {
                ERR("No object specified for regenerate command.");
                command_ret = CMD_ERROR;
                goto end;
@@ -143,7 +143,7 @@ static int handle_command(const char **argv)
        LTTNG_ASSERT(argc >= 1);
 
        cmd = &actions[i];
-       while (cmd->func != NULL) {
+       while (cmd->func != nullptr) {
                /* Find command */
                if (strcmp(argv[0], cmd->name) == 0) {
                        if (lttng_opt_mi) {
@@ -200,7 +200,7 @@ int cmd_regenerate(int argc, const char **argv)
                goto end;
        }
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        if (lttng_opt_mi) {
@@ -244,7 +244,7 @@ int cmd_regenerate(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        ret = CMD_ERROR;
                        goto end;
                }
index 53e71c87d94b0b09eca8ae3427996d049a849d6d..0a10e16127c2994588feb235ba66bccbb1e4289a 100644 (file)
@@ -62,17 +62,17 @@ int cmd_remove_trigger(int argc, const char **argv)
 {
        enum lttng_error_code ret_code;
        int ret;
-       struct argpar_iter *argpar_iter = NULL;
-       const struct argpar_item *argpar_item = NULL;
-       const char *name = NULL;
+       struct argpar_iter *argpar_iter = nullptr;
+       const struct argpar_item *argpar_item = nullptr;
+       const char *name = nullptr;
        int i;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int triggers_count;
        enum lttng_trigger_status trigger_status;
-       const struct lttng_trigger *trigger_to_remove = NULL;
-       char *owner_uid = NULL;
+       const struct lttng_trigger *trigger_to_remove = nullptr;
+       char *owner_uid = nullptr;
        long long uid;
-       struct mi_writer *mi_writer = NULL;
+       struct mi_writer *mi_writer = nullptr;
 
        if (lttng_opt_mi) {
                mi_writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
@@ -109,7 +109,8 @@ int cmd_remove_trigger(int argc, const char **argv)
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item, 1, argv, true, NULL, NULL);
+               status =
+                       parse_next_item(argpar_iter, &argpar_item, 1, argv, true, nullptr, nullptr);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
                    status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
@@ -218,7 +219,7 @@ int cmd_remove_trigger(int argc, const char **argv)
        }
 
        if (lttng_opt_mi) {
-               ret_code = lttng_trigger_mi_serialize(trigger_to_remove, mi_writer, NULL);
+               ret_code = lttng_trigger_mi_serialize(trigger_to_remove, mi_writer, nullptr);
                if (ret_code != LTTNG_OK) {
                        goto error;
                }
index 79324cdc533e3867046584aa962e501eef8b4618..9c4347e43191467e3de3b4ecd28b7576e1749dd9 100644 (file)
@@ -39,25 +39,25 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static int rotate_tracing(char *session_name)
 {
        int ret;
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
-       struct lttng_rotation_handle *handle = NULL;
+       struct lttng_rotation_handle *handle = nullptr;
        enum lttng_rotation_status rotation_status;
        enum lttng_rotation_state rotation_state = LTTNG_ROTATION_STATE_ONGOING;
-       const struct lttng_trace_archive_location *location = NULL;
+       const struct lttng_trace_archive_location *location = nullptr;
        bool print_location = true;
 
        DBG("Rotating the output files of session %s", session_name);
 
-       ret = lttng_rotate_session(session_name, NULL, &handle);
+       ret = lttng_rotate_session(session_name, nullptr, &handle);
        if (ret < 0) {
                switch (-ret) {
                case LTTNG_ERR_SESSION_NOT_STARTED:
@@ -159,10 +159,10 @@ int cmd_rotate(int argc, const char **argv)
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
        int popt_ret;
        static poptContext pc;
-       const char *arg_session_name = NULL;
-       char *session_name = NULL;
+       const char *arg_session_name = nullptr;
+       char *session_name = nullptr;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        popt_ret = poptReadDefaultConfig(pc, 0);
        if (popt_ret) {
                ERR("poptReadDefaultConfig");
@@ -185,16 +185,16 @@ int cmd_rotate(int argc, const char **argv)
        }
 
        arg_session_name = poptGetArg(pc);
-       if (arg_session_name == NULL) {
+       if (arg_session_name == nullptr) {
                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) {
                cmd_ret = CMD_ERROR;
                goto end;
        }
index 0a2a370bd1ea5b6ab6acf24a6bc826e98bc688e6..3ee71c08845a84cd80c0a5511be2212ee92c8495 100644 (file)
@@ -38,12 +38,12 @@ enum {
 
 static struct poptOption save_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
-       { "all", 'a', POPT_ARG_NONE, NULL, OPT_ALL, NULL, NULL },
-       { "output-path", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL },
-       { "force", 'f', POPT_ARG_NONE, NULL, OPT_FORCE, NULL, NULL },
-       { "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_NONE, nullptr, OPT_ALL, nullptr, nullptr },
+       { "output-path", 'o', POPT_ARG_STRING, &opt_output_path, 0, nullptr, nullptr },
+       { "force", 'f', POPT_ARG_NONE, nullptr, OPT_FORCE, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static int mi_partial_session(const char *session_name)
@@ -116,11 +116,11 @@ int cmd_save(int argc, const char **argv)
 {
        int ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success;
        int opt;
-       const char *arg_session_name = NULL, *leftover = NULL;
+       const char *arg_session_name = nullptr, *leftover = nullptr;
        poptContext pc;
        struct lttng_save_session_attr *attr;
 
-       pc = poptGetContext(NULL, argc, argv, save_opts, 0);
+       pc = poptGetContext(nullptr, argc, argv, save_opts, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
index 621c8af36c18d1432bec60039f2f02739e624b95..627ba3040819d5340abf22653f57675820a7620d 100644 (file)
@@ -33,9 +33,9 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 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 },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -145,9 +145,9 @@ int cmd_set_session(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       const char *arg_session_name = NULL;
+       const char *arg_session_name = nullptr;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -165,7 +165,7 @@ int cmd_set_session(int argc, const char **argv)
        }
 
        arg_session_name = poptGetArg(pc);
-       if (arg_session_name == NULL) {
+       if (arg_session_name == nullptr) {
                ERR("Missing session name");
                ret = CMD_ERROR;
                goto end;
index 4075b71989e81981b0ea545a4e02af05edfb8b28..93307ca5eaeea8ca388c1d752040acaa380821a1 100644 (file)
@@ -54,15 +54,15 @@ static struct mi_writer *writer;
 
 static struct poptOption snapshot_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
-       { "ctrl-url", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0 },
-       { "data-url", 'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0 },
-       { "name", 'n', POPT_ARG_STRING, &opt_output_name, 0, 0, 0 },
-       { "max-size", 'm', POPT_ARG_STRING, 0, OPT_MAX_SIZE, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, nullptr, nullptr },
+       { "ctrl-url", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, nullptr, nullptr },
+       { "data-url", 'D', POPT_ARG_STRING, &opt_data_url, 0, nullptr, nullptr },
+       { "name", 'n', POPT_ARG_STRING, &opt_output_name, 0, nullptr, nullptr },
+       { "max-size", 'm', POPT_ARG_STRING, nullptr, OPT_MAX_SIZE, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "list-commands", 0, POPT_ARG_NONE, nullptr, OPT_LIST_COMMANDS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static struct cmd_struct actions[] = {
@@ -70,7 +70,7 @@ static struct cmd_struct actions[] = {
        { "del-output", cmd_del_output },
        { "list-output", cmd_list_output },
        { "record", cmd_record },
-       { NULL, NULL } /* Array closure */
+       { nullptr, nullptr } /* Array closure */
 };
 
 /*
@@ -82,7 +82,7 @@ static int count_arguments(const char **argv)
 
        LTTNG_ASSERT(argv);
 
-       while (argv[i] != NULL) {
+       while (argv[i] != nullptr) {
                i++;
        }
 
@@ -97,7 +97,7 @@ static int count_arguments(const char **argv)
 static struct lttng_snapshot_output *create_output_from_args(const char *url)
 {
        int ret = 0;
-       struct lttng_snapshot_output *output = NULL;
+       struct lttng_snapshot_output *output = nullptr;
 
        output = lttng_snapshot_output_create();
        if (!output) {
@@ -142,10 +142,10 @@ static struct lttng_snapshot_output *create_output_from_args(const char *url)
 error:
        lttng_snapshot_output_destroy(output);
 error_create:
-       return NULL;
+       return nullptr;
 }
 
-static int list_output(void)
+static int list_output()
 {
        int ret, output_seen = 0;
        struct lttng_snapshot_output *s_iter;
@@ -166,7 +166,7 @@ static int list_output(void)
                }
        }
 
-       while ((s_iter = lttng_snapshot_output_list_get_next(list)) != NULL) {
+       while ((s_iter = lttng_snapshot_output_list_get_next(list)) != nullptr) {
                if (lttng_snapshot_output_get_maxsize(s_iter)) {
                        MSG("%s[%" PRIu32 "] %s: %s (max size: %" PRIu64 " bytes)",
                            indent4,
@@ -222,7 +222,7 @@ error:
 static int del_output(uint32_t id, const char *name)
 {
        int ret;
-       struct lttng_snapshot_output *output = NULL;
+       struct lttng_snapshot_output *output = nullptr;
 
        output = lttng_snapshot_output_create();
        if (!output) {
@@ -276,7 +276,7 @@ error:
 static int add_output(const char *url)
 {
        int ret;
-       struct lttng_snapshot_output *output = NULL;
+       struct lttng_snapshot_output *output = nullptr;
        char name[NAME_MAX];
        const char *n_ptr;
 
@@ -378,7 +378,7 @@ static int cmd_del_output(int argc, const char **argv)
        if (id == 0 && (errno == 0 || errno == EINVAL)) {
                ret = del_output(UINT32_MAX, name);
        } else if (errno == 0 && *name == '\0') {
-               ret = del_output(id, NULL);
+               ret = del_output(id, nullptr);
        } else {
                ERR("Argument %s not recognized", argv[1]);
                ret = -1;
@@ -405,7 +405,7 @@ static int cmd_list_output(int argc __attribute__((unused)),
 static int record(const char *url)
 {
        int ret;
-       struct lttng_snapshot_output *output = NULL;
+       struct lttng_snapshot_output *output = nullptr;
 
        output = create_output_from_args(url);
        if (!output) {
@@ -448,7 +448,7 @@ static int cmd_record(int argc, const char **argv)
        if (argc == 2) {
                ret = record(argv[1]);
        } else {
-               ret = record(NULL);
+               ret = record(nullptr);
        }
 
        return ret;
@@ -477,7 +477,7 @@ static enum cmd_error_code handle_command(const char **argv)
        LTTNG_ASSERT(argc > 0);
 
        cmd = &actions[i];
-       while (cmd->func != NULL) {
+       while (cmd->func != nullptr) {
                /* Find command */
                if (strcmp(argv[0], cmd->name) == 0) {
                        int result;
@@ -573,10 +573,10 @@ int cmd_snapshot(int argc, const char **argv)
        int opt;
        int mi_ret;
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
-       char *session_name = NULL;
+       char *session_name = nullptr;
        static poptContext pc;
 
-       pc = poptGetContext(NULL, argc, argv, snapshot_opts, 0);
+       pc = poptGetContext(nullptr, argc, argv, snapshot_opts, 0);
        poptReadDefaultConfig(pc, 0);
 
        /* Mi check */
@@ -644,7 +644,7 @@ int cmd_snapshot(int argc, const char **argv)
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        cmd_ret = CMD_ERROR;
                        goto end;
                }
index e00cac4c6ad6d8395a2a224d7ff40ec3ab979fcc..d8e3569760298a1c7850bf8e29a9dff1ee0c2880 100644 (file)
@@ -34,9 +34,9 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 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 },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static int mi_print_session(char *session_name, int enabled)
@@ -77,16 +77,16 @@ static int start_tracing(const char *arg_session_name)
        int ret;
        char *session_name;
 
-       if (arg_session_name == NULL) {
+       if (arg_session_name == nullptr) {
                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) {
                ret = CMD_ERROR;
                goto error;
        }
@@ -132,10 +132,10 @@ int cmd_start(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       const char *arg_session_name = NULL;
-       const char *leftover = NULL;
+       const char *arg_session_name = nullptr;
+       const char *leftover = nullptr;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
index cd05bf313be1915a2f2bfe4851182b4710ea03b0..82a26c5b2752c026fde647eb8184e65d3a4c6604 100644 (file)
@@ -31,16 +31,16 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
-       { "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 },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
-static int status(void)
+static int status()
 {
        const char *argv[2];
        int ret = CMD_SUCCESS;
-       char *session_name = NULL;
+       char *session_name = nullptr;
 
        session_name = get_session_name();
        if (!session_name) {
@@ -64,7 +64,7 @@ int cmd_status(int argc, const char **argv)
        int opt, ret = CMD_SUCCESS;
        static poptContext pc;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -81,7 +81,7 @@ int cmd_status(int argc, const char **argv)
                }
        }
 
-       if (poptPeekArg(pc) != NULL) {
+       if (poptPeekArg(pc) != nullptr) {
                ERR("This command does not accept positional arguments.\n");
                ret = CMD_UNDEFINED;
                goto end;
index 37b00417d40c0a30a1c04ca83bfbc5c4c710110c..a6d3d6711acc9ad083a1ccaa10348cddf0797a1b 100644 (file)
@@ -35,10 +35,10 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -83,16 +83,16 @@ static int stop_tracing(const char *arg_session_name)
        int ret;
        char *session_name;
 
-       if (arg_session_name == NULL) {
+       if (arg_session_name == nullptr) {
                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) {
                ret = CMD_ERROR;
                goto error;
        }
@@ -160,10 +160,10 @@ int cmd_stop(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
-       const char *arg_session_name = NULL;
-       const char *leftover = NULL;
+       const char *arg_session_name = nullptr;
+       const char *leftover = nullptr;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
index b5320f08f1a54dadc9202e8c5f49de1ca80ba19c..99f411afbc49a722506215dc1c86d8c2c5876ddb 100644 (file)
@@ -69,10 +69,10 @@ static struct poptOption long_options[] = {
                "help",
                'h',
                POPT_ARG_NONE,
-               0,
+               nullptr,
                OPT_HELP,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "session",
@@ -80,8 +80,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_STRING,
                &opt_session_name,
                OPT_SESSION,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "kernel",
@@ -89,8 +89,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_VAL,
                &opt_kernel,
                1,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "userspace",
@@ -98,8 +98,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_VAL,
                &opt_userspace,
                1,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "pid",
@@ -107,8 +107,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
                &opt_str_arg,
                OPT_PID,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "vpid",
@@ -116,8 +116,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
                &opt_str_arg,
                OPT_VPID,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "uid",
@@ -125,8 +125,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
                &opt_str_arg,
                OPT_UID,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "vuid",
@@ -134,8 +134,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
                &opt_str_arg,
                OPT_VUID,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "gid",
@@ -143,8 +143,8 @@ static struct poptOption long_options[] = {
                POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
                &opt_str_arg,
                OPT_GID,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "vgid",
@@ -152,35 +152,35 @@ static struct poptOption long_options[] = {
                POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
                &opt_str_arg,
                OPT_VGID,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "all",
                'a',
                POPT_ARG_NONE,
-               0,
+               nullptr,
                OPT_ALL,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
                "list-options",
                0,
                POPT_ARG_NONE,
-               NULL,
+               nullptr,
                OPT_LIST_OPTIONS,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
        {
+               nullptr,
                0,
                0,
+               nullptr,
                0,
-               0,
-               0,
-               0,
-               0,
+               nullptr,
+               nullptr,
        },
 };
 
@@ -218,7 +218,7 @@ static const char *get_capitalized_process_attr_str(enum lttng_process_attr proc
        default:
                return "Unknown";
        }
-       return NULL;
+       return nullptr;
 }
 
 static bool ust_process_attr_supported(enum lttng_process_attr *process_attr)
@@ -261,7 +261,7 @@ static enum cmd_error_code run_command_all(enum cmd_type cmd_type,
                                           enum lttng_process_attr process_attr,
                                           struct mi_writer *writer)
 {
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
        const enum lttng_error_code handle_ret_code = lttng_session_get_tracker_handle(
                session_name, domain_type, process_attr, &tracker_handle);
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
@@ -328,7 +328,7 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                                              const char *_args,
                                              struct mi_writer *writer)
 {
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
        const enum lttng_error_code handle_ret_code = lttng_session_get_tracker_handle(
                session_name, domain_type, process_attr, &tracker_handle);
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
@@ -349,7 +349,7 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                goto end;
        }
 
-       while ((one_value_str = strtok_r(iter, ",", &iter)) != NULL) {
+       while ((one_value_str = strtok_r(iter, ",", &iter)) != nullptr) {
                const bool is_numerical_argument = isdigit(one_value_str[0]);
                enum lttng_process_attr_tracker_handle_status status;
                enum lttng_tracking_policy policy;
@@ -374,7 +374,7 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                }
 
                if (is_numerical_argument) {
-                       const unsigned long one_value_int = strtoul(one_value_str, NULL, 10);
+                       const unsigned long one_value_int = strtoul(one_value_str, nullptr, 10);
 
                        if (writer) {
                                ret = mi_lttng_integral_process_attribute_value(
@@ -637,9 +637,9 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                sizeof(process_attr_commands) / sizeof(struct process_attr_command_args);
        enum cmd_error_code command_ret = CMD_SUCCESS;
        static poptContext pc;
-       char *session_name = NULL;
-       const char *leftover = NULL;
-       struct mi_writer *writer = NULL;
+       char *session_name = nullptr;
+       const char *leftover = nullptr;
+       struct mi_writer *writer = nullptr;
        size_t i;
 
        for (i = 0; i < command_count; i++) {
@@ -651,7 +651,7 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                goto end;
        }
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -740,7 +740,7 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
 
        if (!opt_session_name) {
                session_name = get_session_name();
-               if (session_name == NULL) {
+               if (session_name == nullptr) {
                        command_ret = CMD_ERROR;
                        goto end;
                }
@@ -850,7 +850,7 @@ int cmd_track(int argc, const char **argv)
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-track.1.h>
 #else
-               NULL
+               nullptr
 #endif
                ;
 
@@ -863,7 +863,7 @@ int cmd_untrack(int argc, const char **argv)
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-untrack.1.h>
 #else
-               NULL
+               nullptr
 #endif
                ;
 
index 0e59b8dbfb8af31e7dd5677e4d796146d9ddae28..836e8f489d194c3de9e82a94d871d91d9f05e388 100644 (file)
@@ -34,9 +34,9 @@ static const char *lttng_license = "lttng is free software and under the GPL lic
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 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 },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /*
@@ -56,10 +56,10 @@ static void create_version(struct mi_lttng_version_data *version)
 /*
  * Print the machine interface output of this command.
  */
-static int print_mi(void)
+static int print_mi()
 {
        int ret = CMD_SUCCESS;
-       struct mi_writer *writer = NULL;
+       struct mi_writer *writer = nullptr;
        struct mi_lttng_version_data version;
 
        create_version(&version);
@@ -123,7 +123,7 @@ int cmd_version(int argc, const char **argv)
        int opt, ret = CMD_SUCCESS;
        static poptContext pc;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        while ((opt = poptGetNextOpt(pc)) != -1) {
index d2ac61bb57365f2039188ac12565f88408c8b8cb..9a7557e40dbd07144c557bdd463e4ba537f637be 100644 (file)
@@ -34,11 +34,11 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
-       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
-       { "viewer", 'e', POPT_ARG_STRING, &opt_viewer, 0, 0, 0 },
-       { "trace-path", 't', POPT_ARG_STRING, &opt_trace_path, 0, 0, 0 },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr },
+       { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr },
+       { "viewer", 'e', POPT_ARG_STRING, &opt_viewer, 0, nullptr, nullptr },
+       { "trace-path", 't', POPT_ARG_STRING, &opt_trace_path, 0, nullptr, nullptr },
+       { nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 /* Is the session we are trying to view is in live mode. */
@@ -50,7 +50,7 @@ static int session_live_mode;
 static char *build_live_path(char *session_name)
 {
        int ret;
-       char *path = NULL;
+       char *path = nullptr;
        char hostname[LTTNG_HOST_NAME_MAX];
 
        ret = gethostname(hostname, sizeof(hostname));
@@ -75,8 +75,8 @@ error:
 static int view_trace(const char *arg_session_name)
 {
        int ret;
-       char *session_name, *trace_path = NULL;
-       struct lttng_session *sessions = NULL;
+       char *session_name, *trace_path = nullptr;
+       struct lttng_session *sessions = nullptr;
        bool free_trace_path = false;
 
        /*
@@ -97,18 +97,18 @@ static int view_trace(const char *arg_session_name)
 
        /* User define trace path override the session name */
        if (opt_trace_path) {
-               session_name = NULL;
+               session_name = nullptr;
        } else {
-               if (arg_session_name == NULL) {
+               if (arg_session_name == nullptr) {
                        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) {
                        ret = CMD_ERROR;
                        goto error;
                }
@@ -195,10 +195,10 @@ int cmd_view(int argc, const char **argv)
 {
        int opt, ret = CMD_SUCCESS;
        static poptContext pc;
-       const char *arg_session_name = NULL;
-       const char *leftover = NULL;
+       const char *arg_session_name = nullptr;
+       const char *leftover = nullptr;
 
-       pc = poptGetContext(NULL, argc, argv, long_options, 0);
+       pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
        if (lttng_opt_mi) {
index 44630b681135843eab58022294c89479dc003d19..65be35a158f70518dda1317f78900347ba67b117 100644 (file)
@@ -32,7 +32,7 @@ char *config_get_file_path(const char *path)
        ret = asprintf(&file_path, "%s/%s", path, CONFIG_FILENAME);
        if (ret < 0) {
                ERR("Fail allocating config file path");
-               file_path = NULL;
+               file_path = nullptr;
        }
 
        return file_path;
@@ -44,16 +44,16 @@ char *config_get_file_path(const char *path)
  */
 static FILE *open_config(const char *path, const char *mode)
 {
-       FILE *fp = NULL;
+       FILE *fp = nullptr;
        char *file_path;
 
        file_path = config_get_file_path(path);
-       if (file_path == NULL) {
+       if (file_path == nullptr) {
                goto error;
        }
 
        fp = fopen(file_path, mode);
-       if (fp == NULL) {
+       if (fp == nullptr) {
                goto error;
        }
 
@@ -73,7 +73,7 @@ static int create_config_file(const char *path)
        FILE *fp;
 
        fp = open_config(path, "w+");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                ERR("Unable to create config file");
                ret = -1;
                goto error;
@@ -97,7 +97,7 @@ static int write_config(const char *file_path, size_t size, char *data)
        int ret = 0;
 
        fp = open_config(file_path, "a");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                ret = -1;
                goto end;
        }
@@ -123,7 +123,7 @@ void config_destroy(const char *path)
        char *config_path;
 
        config_path = config_get_file_path(path);
-       if (config_path == NULL) {
+       if (config_path == nullptr) {
                return;
        }
 
@@ -143,10 +143,10 @@ end:
 /*
  * Destroys the default config
  */
-void config_destroy_default(void)
+void config_destroy_default()
 {
        const char *path = utils_get_home_dir();
-       if (path == NULL) {
+       if (path == nullptr) {
                return;
        }
        config_destroy(path);
@@ -178,14 +178,14 @@ static int _config_read_session_name(const char *path, char **name)
 #endif
 
        session_name = calloc<char>(NAME_MAX);
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                ret = -ENOMEM;
                ERR("Out of memory");
                goto error;
        }
 
        fp = open_config(path, "r");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                ret = -ENOENT;
                goto error;
        }
@@ -232,7 +232,7 @@ found:
 char *config_read_session_name(const char *path)
 {
        int ret;
-       char *name = NULL;
+       char *name = nullptr;
 
        ret = _config_read_session_name(path, &name);
        if (ret == -ENOENT) {
@@ -253,7 +253,7 @@ char *config_read_session_name(const char *path)
  */
 char *config_read_session_name_quiet(const char *path)
 {
-       char *name = NULL;
+       char *name = nullptr;
 
        (void) _config_read_session_name(path, &name);
        return name;
@@ -296,7 +296,7 @@ int config_init(const char *session_name)
        const char *path;
 
        path = utils_get_home_dir();
-       if (path == NULL) {
+       if (path == nullptr) {
                ret = -1;
                goto error;
        }
index 4c8619168e995cd528f00f3f62c9085759834668..73940723628b18ba04b410496ddcfd46f04a73ba 100644 (file)
@@ -322,7 +322,7 @@ static const char *
 lookup_name_from_value(const struct loglevel_name_value values[], size_t values_count, int loglevel)
 {
        size_t i;
-       const char *name = NULL;
+       const char *name = nullptr;
 
        for (i = 0; i < values_count; i++) {
                if (values[i].value == loglevel) {
index d02733a09aa18fbdcfa40563fac30b5a26ffaab0..5f6e0f66e73477952472aa034f5f4c77ae759f72 100644 (file)
@@ -29,7 +29,7 @@ static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng.1.h>
 #else
-       NULL
+       nullptr
 #endif
        ;
 
@@ -48,18 +48,18 @@ enum {
 };
 
 /* Getopt options. No first level command. */
-static struct option long_options[] = { { "version", 0, NULL, 'V' },
-                                       { "help", 0, NULL, 'h' },
-                                       { "group", 1, NULL, 'g' },
-                                       { "verbose", 0, NULL, 'v' },
-                                       { "quiet", 0, NULL, 'q' },
-                                       { "mi", 1, NULL, 'm' },
-                                       { "no-sessiond", 0, NULL, 'n' },
-                                       { "sessiond-path", 1, NULL, OPT_SESSION_PATH },
-                                       { "relayd-path", 1, NULL, OPT_RELAYD_PATH },
-                                       { "list-options", 0, NULL, OPT_DUMP_OPTIONS },
-                                       { "list-commands", 0, NULL, OPT_DUMP_COMMANDS },
-                                       { NULL, 0, NULL, 0 } };
+static struct option long_options[] = { { "version", 0, nullptr, 'V' },
+                                       { "help", 0, nullptr, 'h' },
+                                       { "group", 1, nullptr, 'g' },
+                                       { "verbose", 0, nullptr, 'v' },
+                                       { "quiet", 0, nullptr, 'q' },
+                                       { "mi", 1, nullptr, 'm' },
+                                       { "no-sessiond", 0, nullptr, 'n' },
+                                       { "sessiond-path", 1, nullptr, OPT_SESSION_PATH },
+                                       { "relayd-path", 1, nullptr, OPT_RELAYD_PATH },
+                                       { "list-options", 0, nullptr, OPT_DUMP_OPTIONS },
+                                       { "list-commands", 0, nullptr, OPT_DUMP_COMMANDS },
+                                       { nullptr, 0, nullptr, 0 } };
 
 /* First level command */
 static struct cmd_struct commands[] = {
@@ -72,7 +72,7 @@ static struct cmd_struct commands[] = {
        { "disable-event", cmd_disable_events },
        { "enable-channel", cmd_enable_channels },
        { "enable-event", cmd_enable_events },
-       { "help", NULL },
+       { "help", nullptr },
        { "list", cmd_list },
        { "list-triggers", cmd_list_triggers },
        { "load", cmd_load },
@@ -92,7 +92,7 @@ static struct cmd_struct commands[] = {
        { "untrack", cmd_untrack },
        { "version", cmd_version },
        { "view", cmd_view },
-       { NULL, NULL } /* Array closure */
+       { nullptr, nullptr } /* Array closure */
 };
 
 static void version(FILE *ofp)
@@ -132,10 +132,10 @@ static int mi_output_type(const char *output_type)
 static void list_options(FILE *ofp)
 {
        int i = 0;
-       struct option *option = NULL;
+       struct option *option = nullptr;
 
        option = &long_options[i];
-       while (option->name != NULL) {
+       while (option->name != nullptr) {
                fprintf(ofp, "--%s\n", option->name);
 
                if (isprint(option->val)) {
@@ -181,7 +181,7 @@ static void sighandler(int sig)
  *
  *  Setup signal handler for SIGCHLD and SIGTERM.
  */
-static int set_signal_handler(void)
+static int set_signal_handler()
 {
        int ret = 0;
        struct sigaction sa;
@@ -196,7 +196,7 @@ static int set_signal_handler(void)
        sa.sa_mask = sigset;
        sa.sa_flags = 0;
 
-       if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGTERM, &sa, nullptr)) < 0) {
                PERROR("sigaction");
                goto end;
        }
@@ -219,7 +219,7 @@ static int handle_command(int argc, char **argv)
        int i = 0, ret;
        struct cmd_struct *cmd;
 
-       if (*argv == NULL) {
+       if (*argv == nullptr) {
                ret = CMD_SUCCESS;
                goto end;
        }
@@ -231,7 +231,7 @@ static int handle_command(int argc, char **argv)
        }
 
        cmd = &commands[i];
-       while (cmd->name != NULL) {
+       while (cmd->name != nullptr) {
                /* Find command */
                if (strcmp(argv[0], cmd->name) == 0) {
                        ret = cmd->func(argc, (const char **) argv);
@@ -253,7 +253,7 @@ static bool command_exists(const char *command)
        const struct cmd_struct *cmd = commands;
        bool exists = false;
 
-       while (cmd->name != NULL) {
+       while (cmd->name != nullptr) {
                if (!strcmp(command, cmd->name)) {
                        exists = true;
                        goto end;
@@ -265,7 +265,7 @@ end:
        return exists;
 }
 
-static void show_basic_help(void)
+static void show_basic_help()
 {
        puts("Usage: lttng [--group=GROUP] [--mi=TYPE] [--no-sessiond | --sessiond-path=PATH]");
        puts("             [--quiet | -v | -vv | -vvv] COMMAND [COMMAND OPTIONS]");
@@ -344,7 +344,7 @@ static int parse_args(int argc, char **argv)
                clean_exit(EXIT_FAILURE);
        }
 
-       while ((opt = getopt_long(argc, argv, "+Vhnvqg:m:", long_options, NULL)) != -1) {
+       while ((opt = getopt_long(argc, argv, "+Vhnvqg:m:", long_options, nullptr)) != -1) {
                switch (opt) {
                case 'V':
                        version(stdout);
index 1a750d91b09bb8233c7fbe9c318d500242e92dd0..60fd5f619580cc7c5b07aca89b6311275165fe8f 100644 (file)
  */
 static int walk_command_search_path(const char *binary, char *binary_full_path)
 {
-       char *tentative_binary_path = NULL;
-       char *command_search_path = NULL;
-       char *curr_search_dir_end = NULL;
-       char *curr_search_dir = NULL;
+       char *tentative_binary_path = nullptr;
+       char *command_search_path = nullptr;
+       char *curr_search_dir_end = nullptr;
+       char *curr_search_dir = nullptr;
        struct stat stat_output;
        int ret = 0;
 
@@ -68,7 +68,7 @@ static int walk_command_search_path(const char *binary, char *binary_full_path)
                 * matching character.
                 */
                curr_search_dir_end = strchr(curr_search_dir, ':');
-               if (curr_search_dir_end != NULL) {
+               if (curr_search_dir_end != nullptr) {
                        /*
                         * Add a NULL byte to the end of the first token so it
                         * can be used as a string.
@@ -117,7 +117,7 @@ static int walk_command_search_path(const char *binary, char *binary_full_path)
                }
                /* Go to the next entry in the $PATH variable. */
                curr_search_dir = curr_search_dir_end + 1;
-       } while (curr_search_dir_end != NULL);
+       } while (curr_search_dir_end != nullptr);
 
 free_binary_path:
        free(tentative_binary_path);
@@ -196,12 +196,12 @@ int parse_userspace_probe_opts(const char *opt,
 {
        int ret = CMD_SUCCESS;
        size_t num_token = 0;
-       char *target_path = NULL;
-       char *unescaped_target_path = NULL;
-       char *real_target_path = NULL;
-       char *symbol_name = NULL, *probe_name = NULL, *provider_name = NULL;
-       struct lttng_userspace_probe_location *probe_location_local = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+       char *target_path = nullptr;
+       char *unescaped_target_path = nullptr;
+       char *real_target_path = nullptr;
+       char *symbol_name = nullptr, *probe_name = nullptr, *provider_name = nullptr;
+       struct lttng_userspace_probe_location *probe_location_local = nullptr;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
        struct lttng_dynamic_pointer_array tokens;
 
        LTTNG_ASSERT(opt);
@@ -288,7 +288,7 @@ int parse_userspace_probe_opts(const char *opt,
         * If there is not forward slash in the path. Walk the $PATH else
         * expand.
         */
-       if (strchr(unescaped_target_path, '/') == NULL) {
+       if (strchr(unescaped_target_path, '/') == nullptr) {
                /* Walk the $PATH variable to find the targeted binary. */
                real_target_path = calloc<char>(LTTNG_PATH_MAX);
                if (!real_target_path) {
@@ -346,7 +346,7 @@ int parse_userspace_probe_opts(const char *opt,
                }
 
                /* Ownership transferred to probe_location. */
-               lookup_method = NULL;
+               lookup_method = nullptr;
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
                probe_location_local = lttng_userspace_probe_location_tracepoint_create(
@@ -358,7 +358,7 @@ int parse_userspace_probe_opts(const char *opt,
                }
 
                /* Ownership transferred to probe_location. */
-               lookup_method = NULL;
+               lookup_method = nullptr;
                break;
        default:
                ret = CMD_ERROR;
@@ -370,7 +370,7 @@ int parse_userspace_probe_opts(const char *opt,
         * caller.
         */
        *probe_location = probe_location_local;
-       probe_location_local = NULL;
+       probe_location_local = nullptr;
 
 end:
        lttng_userspace_probe_location_destroy(probe_location_local);
index 37327128384c482bdf21859289c77495574d223b..90ca90fdeb3a4892424e62827d01e920d7951ef5 100644 (file)
@@ -35,18 +35,18 @@ static const char *str_function = "Function";
 static char *_get_session_name(int quiet)
 {
        const char *path;
-       char *session_name = NULL;
+       char *session_name = nullptr;
 
        /* Get path to config file */
        path = utils_get_home_dir();
-       if (path == NULL) {
+       if (path == nullptr) {
                goto error;
        }
 
        /* Get session name from config */
        session_name = quiet ? config_read_session_name_quiet(path) :
                               config_read_session_name(path);
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                goto error;
        }
 
@@ -55,7 +55,7 @@ static char *_get_session_name(int quiet)
        return session_name;
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -64,7 +64,7 @@ error:
  *  Return allocated string with the session name found in the config
  *  directory.
  */
-char *get_session_name(void)
+char *get_session_name()
 {
        return _get_session_name(0);
 }
@@ -75,7 +75,7 @@ char *get_session_name(void)
  *  Return allocated string with the session name found in the config
  *  directory.
  */
-char *get_session_name_quiet(void)
+char *get_session_name_quiet()
 {
        return _get_session_name(1);
 }
@@ -89,10 +89,10 @@ char *get_session_name_quiet(void)
 void list_commands(struct cmd_struct *commands, FILE *ofp)
 {
        int i = 0;
-       struct cmd_struct *cmd = NULL;
+       struct cmd_struct *cmd = nullptr;
 
        cmd = &commands[i];
-       while (cmd->name != NULL) {
+       while (cmd->name != nullptr) {
                fprintf(ofp, "%s\n", cmd->name);
                i++;
                cmd = &commands[i];
@@ -108,9 +108,9 @@ void list_commands(struct cmd_struct *commands, FILE *ofp)
 void list_cmd_options(FILE *ofp, struct poptOption *options)
 {
        int i;
-       struct poptOption *option = NULL;
+       struct poptOption *option = nullptr;
 
-       for (i = 0; options[i].longName != NULL; i++) {
+       for (i = 0; options[i].longName != nullptr; i++) {
                option = &options[i];
 
                fprintf(ofp, "--%s\n", option->longName);
@@ -128,7 +128,7 @@ void list_cmd_options_argpar(FILE *ofp, const struct argpar_opt_descr *options)
 {
        int i;
 
-       for (i = 0; options[i].long_name != NULL; i++) {
+       for (i = 0; options[i].long_name != nullptr; i++) {
                const struct argpar_opt_descr *option = &options[i];
 
                fprintf(ofp, "--%s\n", option->long_name);
@@ -370,7 +370,7 @@ end:
  *
  * Return 1 if found else 0 if NOT found. Negative value on error.
  */
-int check_relayd(void)
+int check_relayd()
 {
        int ret, fd;
        struct sockaddr_in sin;
@@ -445,12 +445,12 @@ void print_session_stats(const char *session_name)
 int get_session_stats_str(const char *session_name, char **out_str)
 {
        int count, nb_domains, domain_idx, channel_idx, session_idx, ret;
-       struct lttng_domain *domains = NULL;
-       struct lttng_channel *channels = NULL;
+       struct lttng_domain *domains = nullptr;
+       struct lttng_channel *channels = nullptr;
        uint64_t discarded_events_total = 0, lost_packets_total = 0;
-       struct lttng_session *sessions = NULL;
-       const struct lttng_session *selected_session = NULL;
-       char *stats_str = NULL;
+       struct lttng_session *sessions = nullptr;
+       const struct lttng_session *selected_session = nullptr;
+       char *stats_str = nullptr;
        bool print_discarded_events = false, print_lost_packets = false;
 
        count = lttng_list_sessions(&sessions);
@@ -490,7 +490,7 @@ int get_session_stats_str(const char *session_name, char **out_str)
                }
 
                free(channels);
-               channels = NULL;
+               channels = nullptr;
                count = lttng_list_channels(handle, &channels);
                for (channel_idx = 0; channel_idx < count; channel_idx++) {
                        uint64_t discarded_events = 0, lost_packets = 0;
index 5811ef298601b1c77fee81028bd7fc88542ffba9..af277b3e207c29b9e0aa57c8fed156805314e259 100644 (file)
@@ -251,16 +251,16 @@ void lttng_action_increase_execution_failure_count(struct lttng_action *action)
 
 bool lttng_action_should_execute(const struct lttng_action *action)
 {
-       const struct lttng_rate_policy *policy = NULL;
+       const struct lttng_rate_policy *policy = nullptr;
        bool execute = false;
 
-       if (action->get_rate_policy == NULL) {
+       if (action->get_rate_policy == nullptr) {
                execute = true;
                goto end;
        }
 
        policy = action->get_rate_policy(action);
-       if (policy == NULL) {
+       if (policy == nullptr) {
                execute = true;
                goto end;
        }
@@ -282,7 +282,7 @@ lttng_action_generic_add_error_query_results(const struct lttng_action *action,
                                             struct lttng_error_query_results *results)
 {
        enum lttng_action_status action_status;
-       struct lttng_error_query_result *error_counter = NULL;
+       struct lttng_error_query_result *error_counter = nullptr;
        const uint64_t execution_failure_counter = uatomic_read(&action->execution_failure_counter);
 
        error_counter = lttng_error_query_result_counter_create(
@@ -300,7 +300,7 @@ lttng_action_generic_add_error_query_results(const struct lttng_action *action,
        }
 
        /* Ownership transferred to the results. */
-       error_counter = NULL;
+       error_counter = nullptr;
        action_status = LTTNG_ACTION_STATUS_OK;
 end:
        lttng_error_query_result_destroy(error_counter);
@@ -316,8 +316,8 @@ lttng_action_mi_serialize(const struct lttng_trigger *trigger,
 {
        int ret;
        enum lttng_error_code ret_code;
-       struct lttng_action_path *action_path = NULL;
-       struct lttng_error_query_results *error_query_results = NULL;
+       struct lttng_action_path *action_path = nullptr;
+       struct lttng_error_query_results *error_query_results = nullptr;
 
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(writer);
@@ -351,7 +351,7 @@ lttng_action_mi_serialize(const struct lttng_trigger *trigger,
 
        /* Error query for the action. */
        if (error_query_callbacks && error_query_callbacks->action_cb) {
-               const uint64_t *action_path_indexes_raw_pointer = NULL;
+               const uint64_t *action_path_indexes_raw_pointer = nullptr;
                const size_t action_path_indexes_size =
                        lttng_dynamic_array_get_count(action_path_indexes);
 
index a4b2a02f2b7571f66aa36b6e6a1719434aeb5a11..b56b8eda0025dfda36e528282ef76d1ce7d9b7f1 100644 (file)
@@ -190,7 +190,7 @@ ssize_t lttng_action_list_create_from_payload(struct lttng_payload_view *view,
        ssize_t consumed_len;
        const struct lttng_action_list_comm *comm;
        struct lttng_action *list;
-       struct lttng_action *child_action = NULL;
+       struct lttng_action *child_action = nullptr;
        enum lttng_action_status status;
        size_t i;
 
@@ -228,13 +228,13 @@ ssize_t lttng_action_list_create_from_payload(struct lttng_payload_view *view,
 
                /* Transfer ownership to the action list. */
                lttng_action_put(child_action);
-               child_action = NULL;
+               child_action = nullptr;
 
                consumed_len += consumed_len_child;
        }
 
        *p_action = list;
-       list = NULL;
+       list = nullptr;
 
 end:
        lttng_action_list_destroy(list);
@@ -347,7 +347,7 @@ struct lttng_action *lttng_action_list_create(void)
 
        action_list = zmalloc<lttng_action_list>();
        if (!action_list) {
-               action = NULL;
+               action = nullptr;
                goto end;
        }
 
@@ -363,9 +363,9 @@ struct lttng_action *lttng_action_list_create(void)
                          lttng_action_list_serialize,
                          lttng_action_list_is_equal,
                          lttng_action_list_destroy,
-                         NULL,
+                         nullptr,
                          lttng_action_list_add_error_query_results,
-                         NULL);
+                         nullptr);
 
        lttng_dynamic_pointer_array_init(&action_list->actions, destroy_lttng_action_list_element);
 
@@ -438,7 +438,7 @@ struct lttng_action *lttng_action_list_borrow_mutable_at_index(const struct lttn
 {
        unsigned int count;
        const struct lttng_action_list *action_list;
-       struct lttng_action *action = NULL;
+       struct lttng_action *action = nullptr;
 
        if (lttng_action_list_get_count(list, &count) != LTTNG_ACTION_STATUS_OK) {
                goto end;
index 678e1a09d4517b570a85638a0f0d80d8338338ba..cae5ecdc33a880964b1aa178eca9506646954f01 100644 (file)
@@ -83,7 +83,7 @@ static enum lttng_error_code lttng_action_notify_mi_serialize(const struct lttng
        int ret;
        enum lttng_action_status status;
        enum lttng_error_code ret_code;
-       const struct lttng_rate_policy *policy = NULL;
+       const struct lttng_rate_policy *policy = nullptr;
 
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_NOTIFY_ACTION(action));
@@ -91,7 +91,7 @@ static enum lttng_error_code lttng_action_notify_mi_serialize(const struct lttng
 
        status = lttng_action_notify_get_rate_policy(action, &policy);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(policy != NULL);
+       LTTNG_ASSERT(policy != nullptr);
 
        /* Open action notify. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_notify);
@@ -121,9 +121,9 @@ end:
 
 struct lttng_action *lttng_action_notify_create(void)
 {
-       struct lttng_rate_policy *policy = NULL;
-       struct lttng_action_notify *notify = NULL;
-       struct lttng_action *action = NULL;
+       struct lttng_rate_policy *policy = nullptr;
+       struct lttng_action_notify *notify = nullptr;
+       struct lttng_action *action = nullptr;
 
        notify = zmalloc<lttng_action_notify>();
        if (!notify) {
@@ -138,7 +138,7 @@ struct lttng_action *lttng_action_notify_create(void)
 
        lttng_action_init(&notify->parent,
                          LTTNG_ACTION_TYPE_NOTIFY,
-                         NULL,
+                         nullptr,
                          lttng_action_notify_serialize,
                          lttng_action_notify_is_equal,
                          lttng_action_notify_destroy,
@@ -147,10 +147,10 @@ struct lttng_action *lttng_action_notify_create(void)
                          lttng_action_notify_mi_serialize);
 
        notify->policy = policy;
-       policy = NULL;
+       policy = nullptr;
 
        action = &notify->parent;
-       notify = NULL;
+       notify = nullptr;
 
 end:
        free(notify);
@@ -163,8 +163,8 @@ ssize_t lttng_action_notify_create_from_payload(struct lttng_payload_view *view,
 {
        enum lttng_action_status status;
        ssize_t consumed_length;
-       struct lttng_rate_policy *rate_policy = NULL;
-       struct lttng_action *_action = NULL;
+       struct lttng_rate_policy *rate_policy = nullptr;
+       struct lttng_action *_action = nullptr;
 
        consumed_length = lttng_rate_policy_create_from_payload(view, &rate_policy);
        if (!rate_policy) {
@@ -185,7 +185,7 @@ ssize_t lttng_action_notify_create_from_payload(struct lttng_payload_view *view,
        }
 
        *action = _action;
-       _action = NULL;
+       _action = nullptr;
 
 end:
        lttng_rate_policy_destroy(rate_policy);
@@ -198,7 +198,7 @@ enum lttng_action_status lttng_action_notify_set_rate_policy(struct lttng_action
 {
        enum lttng_action_status status;
        struct lttng_action_notify *notify_action;
-       struct lttng_rate_policy *copy = NULL;
+       struct lttng_rate_policy *copy = nullptr;
 
        if (!action || !policy || !IS_NOTIFY_ACTION(action)) {
                status = LTTNG_ACTION_STATUS_INVALID;
@@ -219,7 +219,7 @@ enum lttng_action_status lttng_action_notify_set_rate_policy(struct lttng_action
        /* Assign the policy. */
        notify_action->policy = copy;
        status = LTTNG_ACTION_STATUS_OK;
-       copy = NULL;
+       copy = nullptr;
 
 end:
        lttng_rate_policy_destroy(copy);
index 0e8d8ec8a8a7b599dda4f3dd9aac80bcb7f475d7..383c64839688b8913fdcd631ee5946c2b1139293 100644 (file)
@@ -18,7 +18,7 @@ struct lttng_action_path *lttng_action_path_create(const uint64_t *indexes, size
 {
        int ret;
        size_t i;
-       struct lttng_action_path *path = NULL;
+       struct lttng_action_path *path = nullptr;
 
        if (!indexes && index_count > 0) {
                goto error;
@@ -29,7 +29,7 @@ struct lttng_action_path *lttng_action_path_create(const uint64_t *indexes, size
                goto error;
        }
 
-       lttng_dynamic_array_init(&path->indexes, sizeof(uint64_t), NULL);
+       lttng_dynamic_array_init(&path->indexes, sizeof(uint64_t), nullptr);
 
        for (i = 0; i < index_count; i++) {
                ret = lttng_dynamic_array_add_element(&path->indexes, &indexes[i]);
@@ -41,7 +41,7 @@ struct lttng_action_path *lttng_action_path_create(const uint64_t *indexes, size
        goto end;
 error:
        lttng_action_path_destroy(path);
-       path = NULL;
+       path = nullptr;
 end:
        return path;
 }
@@ -117,7 +117,7 @@ ssize_t lttng_action_path_create_from_payload(struct lttng_payload_view *view,
 {
        ssize_t consumed_size = 0, ret = -1;
        const struct lttng_action_path_comm *header;
-       struct lttng_action_path *action_path = NULL;
+       struct lttng_action_path *action_path = nullptr;
        const struct lttng_payload_view header_view =
                lttng_payload_view_from_view(view, 0, sizeof(*header));
 
@@ -148,7 +148,7 @@ ssize_t lttng_action_path_create_from_payload(struct lttng_payload_view *view,
                        goto end;
                }
        } else {
-               action_path = lttng_action_path_create(NULL, 0);
+               action_path = lttng_action_path_create(nullptr, 0);
                if (!action_path) {
                        goto end;
                }
index c93ac0474347abed141d26cdcf1f53d262ea0215..60def0d9d45231b45878890543f17447a120e271 100644 (file)
@@ -156,7 +156,7 @@ lttng_rate_policy_once_after_n_create_from_payload(struct lttng_payload_view *vi
                                                   struct lttng_rate_policy **rate_policy)
 {
        ssize_t consumed_len = -1;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_rate_policy *policy = nullptr;
        const struct lttng_rate_policy_once_after_n_comm *comm;
        const struct lttng_payload_view comm_view =
                lttng_payload_view_from_view(view, 0, sizeof(*comm));
@@ -175,7 +175,7 @@ lttng_rate_policy_once_after_n_create_from_payload(struct lttng_payload_view *vi
        comm = (const struct lttng_rate_policy_once_after_n_comm *) comm_view.buffer.data;
 
        policy = lttng_rate_policy_once_after_n_create(comm->threshold);
-       if (policy == NULL) {
+       if (policy == nullptr) {
                consumed_len = -1;
                goto end;
        }
@@ -191,7 +191,7 @@ static ssize_t lttng_rate_policy_every_n_create_from_payload(struct lttng_payloa
                                                             struct lttng_rate_policy **rate_policy)
 {
        ssize_t consumed_len = -1;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_rate_policy *policy = nullptr;
        const struct lttng_rate_policy_every_n_comm *comm;
        const struct lttng_payload_view comm_view =
                lttng_payload_view_from_view(view, 0, sizeof(*comm));
@@ -210,7 +210,7 @@ static ssize_t lttng_rate_policy_every_n_create_from_payload(struct lttng_payloa
        comm = (const struct lttng_rate_policy_every_n_comm *) comm_view.buffer.data;
 
        policy = lttng_rate_policy_every_n_create(comm->interval);
-       if (policy == NULL) {
+       if (policy == nullptr) {
                consumed_len = -1;
                goto end;
        }
@@ -398,7 +398,7 @@ end:
 static struct lttng_rate_policy *
 lttng_rate_policy_every_n_copy(const struct lttng_rate_policy *source)
 {
-       struct lttng_rate_policy *copy = NULL;
+       struct lttng_rate_policy *copy = nullptr;
        const struct lttng_rate_policy_every_n *every_n_policy;
 
        if (!source) {
@@ -418,7 +418,7 @@ lttng_rate_policy_every_n_mi_serialize(const struct lttng_rate_policy *rate_poli
 {
        int ret;
        enum lttng_error_code ret_code;
-       const struct lttng_rate_policy_every_n *every_n_policy = NULL;
+       const struct lttng_rate_policy_every_n *every_n_policy = nullptr;
 
        LTTNG_ASSERT(rate_policy);
        LTTNG_ASSERT(IS_EVERY_N_RATE_POLICY(rate_policy));
@@ -456,8 +456,8 @@ end:
 
 struct lttng_rate_policy *lttng_rate_policy_every_n_create(uint64_t interval)
 {
-       struct lttng_rate_policy_every_n *policy = NULL;
-       struct lttng_rate_policy *_policy = NULL;
+       struct lttng_rate_policy_every_n *policy = nullptr;
+       struct lttng_rate_policy *_policy = nullptr;
 
        if (interval == 0) {
                /*
@@ -482,7 +482,7 @@ struct lttng_rate_policy *lttng_rate_policy_every_n_create(uint64_t interval)
        policy->interval = interval;
 
        _policy = &policy->parent;
-       policy = NULL;
+       policy = nullptr;
 
 end:
        free(policy);
@@ -604,7 +604,7 @@ end:
 static struct lttng_rate_policy *
 lttng_rate_policy_once_after_n_copy(const struct lttng_rate_policy *source)
 {
-       struct lttng_rate_policy *copy = NULL;
+       struct lttng_rate_policy *copy = nullptr;
        const struct lttng_rate_policy_once_after_n *once_after_n_policy;
 
        if (!source) {
@@ -624,7 +624,7 @@ lttng_rate_policy_once_after_n_mi_serialize(const struct lttng_rate_policy *rate
 {
        int ret;
        enum lttng_error_code ret_code;
-       const struct lttng_rate_policy_once_after_n *once_after_n_policy = NULL;
+       const struct lttng_rate_policy_once_after_n *once_after_n_policy = nullptr;
 
        LTTNG_ASSERT(rate_policy);
        LTTNG_ASSERT(IS_ONCE_AFTER_N_RATE_POLICY(rate_policy));
@@ -664,8 +664,8 @@ end:
 
 struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(uint64_t threshold)
 {
-       struct lttng_rate_policy_once_after_n *policy = NULL;
-       struct lttng_rate_policy *_policy = NULL;
+       struct lttng_rate_policy_once_after_n *policy = nullptr;
+       struct lttng_rate_policy *_policy = nullptr;
 
        if (threshold == 0) {
                /* threshold is expected to be > 0 */
@@ -688,7 +688,7 @@ struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(uint64_t thresho
        policy->threshold = threshold;
 
        _policy = &policy->parent;
-       policy = NULL;
+       policy = nullptr;
 
 end:
        free(policy);
index 18b1e9ef24cf71fd57c501a60937983c0b46021d..c2b962ab6d94b893177c39d44226f63891103a92 100644 (file)
@@ -173,7 +173,7 @@ ssize_t lttng_action_rotate_session_create_from_payload(struct lttng_payload_vie
        const char *session_name;
        struct lttng_action *action;
        enum lttng_action_status status;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_rate_policy *policy = nullptr;
 
        action = lttng_action_rotate_session_create();
        if (!action) {
@@ -217,7 +217,7 @@ ssize_t lttng_action_rotate_session_create_from_payload(struct lttng_payload_vie
        }
 
        *p_action = action;
-       action = NULL;
+       action = nullptr;
 
 end:
        lttng_rate_policy_destroy(policy);
@@ -233,19 +233,19 @@ lttng_action_rotate_session_mi_serialize(const struct lttng_action *action,
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_action_status status;
-       const char *session_name = NULL;
-       const struct lttng_rate_policy *policy = NULL;
+       const char *session_name = nullptr;
+       const struct lttng_rate_policy *policy = nullptr;
 
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_ROTATE_SESSION_ACTION(action));
 
        status = lttng_action_rotate_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(session_name != NULL);
+       LTTNG_ASSERT(session_name != nullptr);
 
        status = lttng_action_notify_get_rate_policy(action, &policy);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(policy != NULL);
+       LTTNG_ASSERT(policy != nullptr);
 
        /* Open action rotate session element. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_rotate_session);
@@ -283,8 +283,8 @@ end:
 
 struct lttng_action *lttng_action_rotate_session_create(void)
 {
-       struct lttng_action_rotate_session *action_rotate = NULL;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_action_rotate_session *action_rotate = nullptr;
+       struct lttng_rate_policy *policy = nullptr;
        enum lttng_action_status status;
 
        /* Create a every N = 1 rate policy. */
@@ -311,7 +311,7 @@ struct lttng_action *lttng_action_rotate_session_create(void)
        status = lttng_action_rotate_session_set_rate_policy(&action_rotate->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_rotate->parent);
-               action_rotate = NULL;
+               action_rotate = nullptr;
                goto end;
        }
 
@@ -374,7 +374,7 @@ lttng_action_rotate_session_set_rate_policy(struct lttng_action *action,
 {
        enum lttng_action_status status;
        struct lttng_action_rotate_session *rotate_session_action;
-       struct lttng_rate_policy *copy = NULL;
+       struct lttng_rate_policy *copy = nullptr;
 
        if (!action || !policy || !IS_ROTATE_SESSION_ACTION(action)) {
                status = LTTNG_ACTION_STATUS_INVALID;
@@ -395,7 +395,7 @@ lttng_action_rotate_session_set_rate_policy(struct lttng_action *action,
        /* Assign the policy. */
        rotate_session_action->policy = copy;
        status = LTTNG_ACTION_STATUS_OK;
-       copy = NULL;
+       copy = nullptr;
 
 end:
        lttng_rate_policy_destroy(copy);
index 4456d2cd9e67edbf22479122db21498604a3a769..23d6f8a56db3c1c21539068d5a0d6f784673927b 100644 (file)
@@ -233,8 +233,8 @@ ssize_t lttng_action_snapshot_session_create_from_payload(struct lttng_payload_v
        const char *variable_data;
        struct lttng_action *action;
        enum lttng_action_status status;
-       struct lttng_snapshot_output *snapshot_output = NULL;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_snapshot_output *snapshot_output = nullptr;
+       struct lttng_rate_policy *policy = nullptr;
        const struct lttng_action_snapshot_session_comm *comm;
        const struct lttng_payload_view snapshot_session_comm_view =
                lttng_payload_view_from_view(view, 0, sizeof(*comm));
@@ -295,7 +295,7 @@ ssize_t lttng_action_snapshot_session_create_from_payload(struct lttng_payload_v
                }
 
                /* Ownership has been transferred to the action. */
-               snapshot_output = NULL;
+               snapshot_output = nullptr;
        }
 
        variable_data += comm->snapshot_output_len;
@@ -340,7 +340,7 @@ ssize_t lttng_action_snapshot_session_create_from_payload(struct lttng_payload_v
        consumed_len += comm->rate_policy_len;
 
        *p_action = action;
-       action = NULL;
+       action = nullptr;
 
        goto end;
 
@@ -362,20 +362,20 @@ lttng_action_snapshot_session_mi_serialize(const struct lttng_action *action,
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_action_status status;
-       const char *session_name = NULL;
-       const struct lttng_snapshot_output *output = NULL;
-       const struct lttng_rate_policy *policy = NULL;
+       const char *session_name = nullptr;
+       const struct lttng_snapshot_output *output = nullptr;
+       const struct lttng_rate_policy *policy = nullptr;
 
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_SNAPSHOT_SESSION_ACTION(action));
 
        status = lttng_action_snapshot_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(session_name != NULL);
+       LTTNG_ASSERT(session_name != nullptr);
 
        status = lttng_action_snapshot_session_get_rate_policy(action, &policy);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(policy != NULL);
+       LTTNG_ASSERT(policy != nullptr);
 
        /* Open action snapshot session element. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_snapshot_session);
@@ -393,7 +393,7 @@ lttng_action_snapshot_session_mi_serialize(const struct lttng_action *action,
        /* Output if any. */
        status = lttng_action_snapshot_session_get_output(action, &output);
        if (status == LTTNG_ACTION_STATUS_OK) {
-               LTTNG_ASSERT(output != NULL);
+               LTTNG_ASSERT(output != nullptr);
                ret_code = lttng_snapshot_output_mi_serialize(output, writer);
                if (ret_code != LTTNG_OK) {
                        goto end;
@@ -426,8 +426,8 @@ end:
 
 struct lttng_action *lttng_action_snapshot_session_create(void)
 {
-       struct lttng_action_snapshot_session *action_snapshot = NULL;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_action_snapshot_session *action_snapshot = nullptr;
+       struct lttng_rate_policy *policy = nullptr;
        enum lttng_action_status status;
 
        /* Create a every N = 1 rate policy. */
@@ -454,7 +454,7 @@ struct lttng_action *lttng_action_snapshot_session_create(void)
        status = lttng_action_snapshot_session_set_rate_policy(&action_snapshot->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_snapshot->parent);
-               action_snapshot = NULL;
+               action_snapshot = nullptr;
                goto end;
        }
 
@@ -570,7 +570,7 @@ lttng_action_snapshot_session_set_rate_policy(struct lttng_action *action,
 {
        enum lttng_action_status status;
        struct lttng_action_snapshot_session *snapshot_session_action;
-       struct lttng_rate_policy *copy = NULL;
+       struct lttng_rate_policy *copy = nullptr;
 
        if (!action || !policy || !IS_SNAPSHOT_SESSION_ACTION(action)) {
                status = LTTNG_ACTION_STATUS_INVALID;
@@ -591,7 +591,7 @@ lttng_action_snapshot_session_set_rate_policy(struct lttng_action *action,
        /* Assign the policy. */
        snapshot_session_action->policy = copy;
        status = LTTNG_ACTION_STATUS_OK;
-       copy = NULL;
+       copy = nullptr;
 
 end:
        lttng_rate_policy_destroy(copy);
index 9438b39ed6085e29c2cc3e6d08a521ca9334c3b7..aed2938c6394f3e83f10564421447747a86ff3ef 100644 (file)
@@ -174,9 +174,9 @@ ssize_t lttng_action_start_session_create_from_payload(struct lttng_payload_view
        ssize_t consumed_len, ret;
        const struct lttng_action_start_session_comm *comm;
        const char *session_name;
-       struct lttng_action *action = NULL;
+       struct lttng_action *action = nullptr;
        enum lttng_action_status status;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_rate_policy *policy = nullptr;
 
        comm = (typeof(comm)) view->buffer.data;
        session_name = (const char *) &comm->data;
@@ -221,7 +221,7 @@ ssize_t lttng_action_start_session_create_from_payload(struct lttng_payload_view
        }
 
        *p_action = action;
-       action = NULL;
+       action = nullptr;
 
 end:
        lttng_rate_policy_destroy(policy);
@@ -236,19 +236,19 @@ lttng_action_start_session_mi_serialize(const struct lttng_action *action, struc
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_action_status status;
-       const char *session_name = NULL;
-       const struct lttng_rate_policy *policy = NULL;
+       const char *session_name = nullptr;
+       const struct lttng_rate_policy *policy = nullptr;
 
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_START_SESSION_ACTION(action));
 
        status = lttng_action_start_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(session_name != NULL);
+       LTTNG_ASSERT(session_name != nullptr);
 
        status = lttng_action_start_session_get_rate_policy(action, &policy);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(policy != NULL);
+       LTTNG_ASSERT(policy != nullptr);
 
        /* Open action start session element. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_start_session);
@@ -286,8 +286,8 @@ end:
 
 struct lttng_action *lttng_action_start_session_create(void)
 {
-       struct lttng_action_start_session *action_start = NULL;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_action_start_session *action_start = nullptr;
+       struct lttng_rate_policy *policy = nullptr;
        enum lttng_action_status status;
 
        /* Create a every N = 1 rate policy. */
@@ -314,7 +314,7 @@ struct lttng_action *lttng_action_start_session_create(void)
        status = lttng_action_start_session_set_rate_policy(&action_start->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_start->parent);
-               action_start = NULL;
+               action_start = nullptr;
                goto end;
        }
 
@@ -377,7 +377,7 @@ lttng_action_start_session_set_rate_policy(struct lttng_action *action,
 {
        enum lttng_action_status status;
        struct lttng_action_start_session *start_session_action;
-       struct lttng_rate_policy *copy = NULL;
+       struct lttng_rate_policy *copy = nullptr;
 
        if (!action || !policy || !IS_START_SESSION_ACTION(action)) {
                status = LTTNG_ACTION_STATUS_INVALID;
@@ -398,7 +398,7 @@ lttng_action_start_session_set_rate_policy(struct lttng_action *action,
        /* Assign the policy. */
        start_session_action->policy = copy;
        status = LTTNG_ACTION_STATUS_OK;
-       copy = NULL;
+       copy = nullptr;
 
 end:
        lttng_rate_policy_destroy(copy);
index 1a01f39255d927616ca8f66301f6e35af9c5f14e..9db4a25fc7104cb083fa16836b13fda91d5baa87 100644 (file)
@@ -172,9 +172,9 @@ ssize_t lttng_action_stop_session_create_from_payload(struct lttng_payload_view
        ssize_t consumed_len, ret;
        const struct lttng_action_stop_session_comm *comm;
        const char *session_name;
-       struct lttng_action *action = NULL;
+       struct lttng_action *action = nullptr;
        enum lttng_action_status status;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_rate_policy *policy = nullptr;
 
        comm = (typeof(comm)) view->buffer.data;
        session_name = (const char *) &comm->data;
@@ -219,7 +219,7 @@ ssize_t lttng_action_stop_session_create_from_payload(struct lttng_payload_view
        }
 
        *p_action = action;
-       action = NULL;
+       action = nullptr;
 
 end:
        lttng_rate_policy_destroy(policy);
@@ -234,19 +234,19 @@ lttng_action_stop_session_mi_serialize(const struct lttng_action *action, struct
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_action_status status;
-       const char *session_name = NULL;
-       const struct lttng_rate_policy *policy = NULL;
+       const char *session_name = nullptr;
+       const struct lttng_rate_policy *policy = nullptr;
 
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_STOP_SESSION_ACTION(action));
 
        status = lttng_action_stop_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(session_name != NULL);
+       LTTNG_ASSERT(session_name != nullptr);
 
        status = lttng_action_stop_session_get_rate_policy(action, &policy);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
-       LTTNG_ASSERT(policy != NULL);
+       LTTNG_ASSERT(policy != nullptr);
 
        /* Open action stop session. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_start_session);
@@ -284,8 +284,8 @@ end:
 
 struct lttng_action *lttng_action_stop_session_create(void)
 {
-       struct lttng_action_stop_session *action_stop = NULL;
-       struct lttng_rate_policy *policy = NULL;
+       struct lttng_action_stop_session *action_stop = nullptr;
+       struct lttng_rate_policy *policy = nullptr;
        enum lttng_action_status status;
 
        /* Create a every N = 1 rate policy. */
@@ -312,7 +312,7 @@ struct lttng_action *lttng_action_stop_session_create(void)
        status = lttng_action_stop_session_set_rate_policy(&action_stop->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_stop->parent);
-               action_stop = NULL;
+               action_stop = nullptr;
                goto end;
        }
 
@@ -375,7 +375,7 @@ lttng_action_stop_session_set_rate_policy(struct lttng_action *action,
 {
        enum lttng_action_status status;
        struct lttng_action_stop_session *stop_session_action;
-       struct lttng_rate_policy *copy = NULL;
+       struct lttng_rate_policy *copy = nullptr;
 
        if (!action || !policy || !IS_STOP_SESSION_ACTION(action)) {
                status = LTTNG_ACTION_STATUS_INVALID;
@@ -394,7 +394,7 @@ lttng_action_stop_session_set_rate_policy(struct lttng_action *action,
 
        stop_session_action->policy = copy;
        status = LTTNG_ACTION_STATUS_OK;
-       copy = NULL;
+       copy = nullptr;
 
 end:
        lttng_rate_policy_destroy(copy);
index c244f402944be0f99747f045dac9ef19f1dd63b8..7c8934778a5b478ac1252d937a61f44151e577ea 100644 (file)
@@ -31,8 +31,8 @@ static ATTR_FORMAT_PRINTF(4, 0) char *format_arg_error_v(const struct argpar_err
                                                         const char *context_fmt,
                                                         va_list args)
 {
-       char *str = NULL;
-       char *str_ret = NULL;
+       char *str = nullptr;
+       char *str_ret = nullptr;
        int ret;
 
        if (context_fmt) {
@@ -42,7 +42,7 @@ static ATTR_FORMAT_PRINTF(4, 0) char *format_arg_error_v(const struct argpar_err
                         * If vasprintf fails, the content of str is undefined,
                         * and we shouldn't try to free it.
                         */
-                       str = NULL;
+                       str = nullptr;
                        goto end;
                }
 
@@ -121,7 +121,7 @@ static ATTR_FORMAT_PRINTF(4, 0) char *format_arg_error_v(const struct argpar_err
        }
 
        str_ret = str;
-       str = NULL;
+       str = nullptr;
 
 end:
        free(str);
@@ -138,7 +138,7 @@ enum parse_next_item_status parse_next_item(struct argpar_iter *iter,
                                            ...)
 {
        enum argpar_iter_next_status status;
-       const struct argpar_error *error = NULL;
+       const struct argpar_error *error = nullptr;
        enum parse_next_item_status ret;
 
        ARGPAR_ITEM_DESTROY_AND_RESET(*item);
@@ -187,7 +187,7 @@ enum parse_next_item_status parse_next_item(struct argpar_iter *iter,
        if (error_out) {
                argpar_error_destroy(*error_out);
                *error_out = error;
-               error = NULL;
+               error = nullptr;
        }
 
        argpar_error_destroy(error);
index bb5d9ea340ef47e5fe9214b4690a40a68c61ae1a..0b3de73b0345911831b9eeefd8537ce87c9e7a19 100644 (file)
@@ -23,7 +23,7 @@ bool lttng_buffer_view_is_valid(const struct lttng_buffer_view *view)
 struct lttng_buffer_view
 lttng_buffer_view_from_view(const struct lttng_buffer_view *src, size_t offset, ptrdiff_t len)
 {
-       struct lttng_buffer_view view = { .data = NULL, .size = 0 };
+       struct lttng_buffer_view view = { .data = nullptr, .size = 0 };
 
        LTTNG_ASSERT(src);
 
@@ -52,7 +52,7 @@ end:
 struct lttng_buffer_view lttng_buffer_view_from_dynamic_buffer(
        const struct lttng_dynamic_buffer *src, size_t offset, ptrdiff_t len)
 {
-       struct lttng_buffer_view view = { .data = NULL, .size = 0 };
+       struct lttng_buffer_view view = { .data = nullptr, .size = 0 };
 
        LTTNG_ASSERT(src);
 
index cde53130d3f091245f1bc7e380b0d77834b14ae4..ef2af356d8f2857f7ce2a78b5df5a3f4499c4e5a 100644 (file)
@@ -65,7 +65,7 @@ end:
 /*
  * The channel object is NOT populated.
  */
-struct lttng_channel *lttng_channel_create_internal(void)
+struct lttng_channel *lttng_channel_create_internal()
 {
        struct lttng_channel *local_channel = nullptr, *ret = nullptr;
        struct lttng_channel_extended *extended = nullptr;
index 782c65b133d3ed94c1f138b74b80c4d5464477c1..157e9d4c24e0abd0b656d564d9623a2bad9f2f7f 100644 (file)
@@ -114,7 +114,7 @@ lttng_directory_handle_create_from_handle(const char *path,
                                          const struct lttng_directory_handle *ref_handle)
 {
        int dirfd;
-       struct lttng_directory_handle *handle = NULL;
+       struct lttng_directory_handle *handle = nullptr;
 
        if (!path) {
                handle = lttng_directory_handle_copy(ref_handle);
@@ -141,7 +141,7 @@ error_close:
        if (close(dirfd)) {
                PERROR("Failed to close directory file descriptor");
        }
-       return NULL;
+       return nullptr;
 }
 
 struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(int dirfd)
@@ -159,7 +159,7 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(int dirf
                if (ret) {
                        PERROR("Failed to fstat directory file descriptor %i", dirfd);
                        lttng_directory_handle_release(&handle->ref);
-                       handle = NULL;
+                       handle = nullptr;
                        goto end;
                }
        } else {
@@ -196,7 +196,7 @@ end:
 struct lttng_directory_handle *
 lttng_directory_handle_copy(const struct lttng_directory_handle *handle)
 {
-       struct lttng_directory_handle *new_handle = NULL;
+       struct lttng_directory_handle *new_handle = nullptr;
 
        if (handle->dirfd == AT_FDCWD) {
                new_handle = lttng_directory_handle_create_from_dirfd(AT_FDCWD);
@@ -317,7 +317,7 @@ static int _run_as_rename(const struct lttng_directory_handle *old_handle,
 static DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
                                           const char *path)
 {
-       DIR *dir_stream = NULL;
+       DIR *dir_stream = nullptr;
        int fd = openat(handle->dirfd, path, O_RDONLY);
 
        if (fd < 0) {
@@ -1025,14 +1025,15 @@ int lttng_directory_handle_create_subdirectory(const struct lttng_directory_hand
                                               const char *subdirectory,
                                               mode_t mode)
 {
-       return lttng_directory_handle_create_subdirectory_as_user(handle, subdirectory, mode, NULL);
+       return lttng_directory_handle_create_subdirectory_as_user(
+               handle, subdirectory, mode, nullptr);
 }
 
 int lttng_directory_handle_create_subdirectory_recursive(
        const struct lttng_directory_handle *handle, const char *subdirectory_path, mode_t mode)
 {
        return lttng_directory_handle_create_subdirectory_recursive_as_user(
-               handle, subdirectory_path, mode, NULL);
+               handle, subdirectory_path, mode, nullptr);
 }
 
 int lttng_directory_handle_open_file_as_user(const struct lttng_directory_handle *handle,
@@ -1062,7 +1063,7 @@ int lttng_directory_handle_open_file(const struct lttng_directory_handle *handle
                                     int flags,
                                     mode_t mode)
 {
-       return lttng_directory_handle_open_file_as_user(handle, filename, flags, mode, NULL);
+       return lttng_directory_handle_open_file_as_user(handle, filename, flags, mode, nullptr);
 }
 
 int lttng_directory_handle_unlink_file_as_user(const struct lttng_directory_handle *handle,
@@ -1086,7 +1087,7 @@ int lttng_directory_handle_unlink_file_as_user(const struct lttng_directory_hand
 int lttng_directory_handle_unlink_file(const struct lttng_directory_handle *handle,
                                       const char *filename)
 {
-       return lttng_directory_handle_unlink_file_as_user(handle, filename, NULL);
+       return lttng_directory_handle_unlink_file_as_user(handle, filename, nullptr);
 }
 
 int lttng_directory_handle_rename(const struct lttng_directory_handle *old_handle,
@@ -1095,7 +1096,7 @@ int lttng_directory_handle_rename(const struct lttng_directory_handle *old_handl
                                  const char *new_name)
 {
        return lttng_directory_handle_rename_as_user(
-               old_handle, old_name, new_handle, new_name, NULL);
+               old_handle, old_name, new_handle, new_name, nullptr);
 }
 
 int lttng_directory_handle_rename_as_user(const struct lttng_directory_handle *old_handle,
@@ -1123,7 +1124,7 @@ int lttng_directory_handle_rename_as_user(const struct lttng_directory_handle *o
 int lttng_directory_handle_remove_subdirectory(const struct lttng_directory_handle *handle,
                                               const char *name)
 {
-       return lttng_directory_handle_remove_subdirectory_as_user(handle, name, NULL);
+       return lttng_directory_handle_remove_subdirectory_as_user(handle, name, nullptr);
 }
 
 int lttng_directory_handle_remove_subdirectory_as_user(const struct lttng_directory_handle *handle,
@@ -1341,7 +1342,7 @@ int lttng_directory_handle_remove_subdirectory_recursive(
        const struct lttng_directory_handle *handle, const char *name, int flags)
 {
        return lttng_directory_handle_remove_subdirectory_recursive_as_user(
-               handle, name, NULL, flags);
+               handle, name, nullptr, flags);
 }
 
 int lttng_directory_handle_remove_subdirectory_recursive_as_user(
index 7a31fef9e0c2614481c52e1f5df11349d7fc4f9c..18b5dee97d9ab750f79e0ee0c7f3c26fe1147927 100644 (file)
@@ -14,7 +14,7 @@
 #include <common/error.hpp>
 
 static inline
-int lttng_is_setuid_setgid(void)
+int lttng_is_setuid_setgid()
 {
        return geteuid() != getuid() || getegid() != getgid();
 }
@@ -25,7 +25,7 @@ char *lttng_secure_getenv(const char *name)
        if (lttng_is_setuid_setgid()) {
                WARN("Getting environment variable '%s' from setuid/setgid binary refused for security reasons.",
                        name);
-               return NULL;
+               return nullptr;
        }
        return getenv(name);
 }
index 38720039500903bce7e5134f82cc23b0adb9dcf7..52ff0467681e45c416c028715c379b3397084ee9 100644 (file)
@@ -49,7 +49,7 @@ static int resize_poll_event(struct lttng_poll_event *events, uint32_t new_size)
        LTTNG_ASSERT(events);
 
        ptr = (epoll_event *) realloc(events->events, new_size * sizeof(*ptr));
-       if (ptr == NULL) {
+       if (ptr == nullptr) {
                PERROR("realloc epoll add");
                goto error;
        }
@@ -73,7 +73,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int count, int flags)
 {
        int ret;
 
-       if (events == NULL || count <= 0) {
+       if (events == nullptr || count <= 0) {
                goto error;
        }
 
@@ -99,7 +99,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int count, int flags)
 
        /* This *must* be freed by using lttng_poll_free() */
        events->events = calloc<epoll_event>(count);
-       if (events->events == NULL) {
+       if (events->events == nullptr) {
                PERROR("zmalloc epoll set");
                goto error_close;
        }
@@ -126,7 +126,7 @@ int compat_epoll_add(struct lttng_poll_event *events, int fd, uint32_t req_event
        int ret;
        struct epoll_event ev;
 
-       if (events == NULL || events->events == NULL || fd < 0) {
+       if (events == nullptr || events->events == nullptr || fd < 0) {
                ERR("Bad compat epoll add arguments");
                goto error;
        }
@@ -172,11 +172,11 @@ int compat_epoll_del(struct lttng_poll_event *events, int fd)
 {
        int ret;
 
-       if (events == NULL || fd < 0 || events->nb_fd == 0) {
+       if (events == nullptr || fd < 0 || events->nb_fd == 0) {
                goto error;
        }
 
-       ret = epoll_ctl(events->epfd, EPOLL_CTL_DEL, fd, NULL);
+       ret = epoll_ctl(events->epfd, EPOLL_CTL_DEL, fd, nullptr);
        if (ret < 0) {
                switch (errno) {
                case ENOENT:
@@ -207,7 +207,7 @@ int compat_epoll_mod(struct lttng_poll_event *events, int fd, uint32_t req_event
        int ret;
        struct epoll_event ev;
 
-       if (events == NULL || fd < 0 || events->nb_fd == 0) {
+       if (events == nullptr || fd < 0 || events->nb_fd == 0) {
                goto error;
        }
 
@@ -248,7 +248,7 @@ int compat_epoll_wait(struct lttng_poll_event *events, int timeout, bool interru
        int ret;
        uint32_t new_size;
 
-       if (events == NULL || events->events == NULL) {
+       if (events == nullptr || events->events == nullptr) {
                ERR("Wrong arguments in compat_epoll_wait");
                goto error;
        }
@@ -296,7 +296,7 @@ error:
 /*
  * Setup poll set maximum size.
  */
-int compat_epoll_set_max_size(void)
+int compat_epoll_set_max_size()
 {
        int ret, fd, retval = 0;
        ssize_t size_ret;
index 5b6c2a00b0020b0b9396312c013b49e4d8ad9e5e..e6de51474bfce238d96f50a9c993bf7a1c79784d 100644 (file)
@@ -158,7 +158,7 @@ extern int compat_epoll_mod(struct lttng_poll_event *events,
 /*
  * Set up the poll set limits variable poll_max_size
  */
-extern int compat_epoll_set_max_size(void);
+extern int compat_epoll_set_max_size();
 #define lttng_poll_set_max_size() \
        compat_epoll_set_max_size()
 
index 4a6ff74c2954a2dbb53e842c600cb7c7513f573f..adf048e98fd36174e17063f1d16a43306401c39d 100644 (file)
@@ -15,7 +15,7 @@
 #if defined(__NR_gettid)
 
 #include <unistd.h>
-static inline pid_t lttng_gettid(void)
+static inline pid_t lttng_gettid()
 {
        return syscall(__NR_gettid);
 }
index e1af44b1c2eb0d4de73c28fa5f83b783538fbda1..4574d6242f1659f9f54387535e75f5c936037357 100644 (file)
@@ -187,12 +187,12 @@ lttng_condition_buffer_usage_mi_serialize(const struct lttng_condition *conditio
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_condition_status status;
-       const char *session_name = NULL, *channel_name = NULL;
+       const char *session_name = nullptr, *channel_name = nullptr;
        enum lttng_domain_type domain_type;
        bool is_threshold_bytes = false;
        double threshold_ratio;
        uint64_t threshold_bytes;
-       const char *condition_type_str = NULL;
+       const char *condition_type_str = nullptr;
 
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(IS_USAGE_CONDITION(condition));
@@ -299,7 +299,7 @@ static struct lttng_condition *lttng_condition_buffer_usage_create(enum lttng_co
 
        condition = zmalloc<lttng_condition_buffer_usage>();
        if (!condition) {
-               return NULL;
+               return nullptr;
        }
 
        lttng_condition_init(&condition->parent, type);
@@ -477,7 +477,7 @@ static struct lttng_evaluation *create_evaluation_from_payload(enum lttng_condit
                                                               struct lttng_payload_view *view)
 {
        const struct lttng_evaluation_buffer_usage_comm *comm = (typeof(comm)) view->buffer.data;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
 
        if (view->buffer.size < sizeof(*comm)) {
                goto end;
@@ -493,7 +493,7 @@ ssize_t lttng_evaluation_buffer_usage_low_create_from_payload(struct lttng_paylo
                                                              struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
 
        if (!_evaluation) {
                ret = -1;
@@ -519,7 +519,7 @@ lttng_evaluation_buffer_usage_high_create_from_payload(struct lttng_payload_view
                                                       struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
 
        if (!_evaluation) {
                ret = -1;
index a814330eb817c453ca5a9f085897716d457f6fbc..598a84dc8e96db637caa3eada6aba35a884fb3da 100644 (file)
@@ -125,7 +125,7 @@ ssize_t lttng_condition_create_from_payload(struct lttng_payload_view *view,
                                            struct lttng_condition **condition)
 {
        ssize_t ret, condition_size = 0;
-       condition_create_from_payload_cb create_from_payload = NULL;
+       condition_create_from_payload_cb create_from_payload = nullptr;
        const struct lttng_condition_comm *condition_comm;
        const struct lttng_payload_view condition_comm_view =
                lttng_payload_view_from_view(view, 0, sizeof(*condition_comm));
@@ -234,7 +234,7 @@ lttng_condition_mi_serialize(const struct lttng_trigger *trigger,
 {
        int ret;
        enum lttng_error_code ret_code;
-       struct lttng_error_query_results *error_query_results = NULL;
+       struct lttng_error_query_results *error_query_results = nullptr;
 
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(writer);
index 41743e0e7d0495f87bb7690263c4fdab5b43acbc..d951ccd3c351602262a9c5839f5a4bf8a6cfb5da 100644 (file)
@@ -238,7 +238,7 @@ lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
 {
        const struct lttng_condition_event_rule_matches *event_rule_matches_cond =
                lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
-       struct lttng_capture_descriptor *desc = NULL;
+       struct lttng_capture_descriptor *desc = nullptr;
        unsigned int count;
        enum lttng_condition_status status;
 
@@ -417,7 +417,7 @@ lttng_condition_event_rule_matches_mi_serialize(const struct lttng_condition *co
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_condition_status status;
-       const struct lttng_event_rule *rule = NULL;
+       const struct lttng_event_rule *rule = nullptr;
        unsigned int capture_descriptor_count, i;
 
        LTTNG_ASSERT(condition);
@@ -426,7 +426,7 @@ lttng_condition_event_rule_matches_mi_serialize(const struct lttng_condition *co
 
        status = lttng_condition_event_rule_matches_get_rule(condition, &rule);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
-       LTTNG_ASSERT(rule != NULL);
+       LTTNG_ASSERT(rule != nullptr);
 
        status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
                condition, &capture_descriptor_count);
@@ -451,7 +451,7 @@ lttng_condition_event_rule_matches_mi_serialize(const struct lttng_condition *co
        }
 
        for (i = 0; i < capture_descriptor_count; i++) {
-               const struct lttng_event_expr *descriptor = NULL;
+               const struct lttng_event_expr *descriptor = nullptr;
 
                descriptor = lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
                        condition, i);
@@ -485,8 +485,8 @@ end:
 
 struct lttng_condition *lttng_condition_event_rule_matches_create(struct lttng_event_rule *rule)
 {
-       struct lttng_condition *parent = NULL;
-       struct lttng_condition_event_rule_matches *condition = NULL;
+       struct lttng_condition *parent = nullptr;
+       struct lttng_condition_event_rule_matches *condition = nullptr;
 
        if (!rule) {
                goto end;
@@ -494,7 +494,7 @@ struct lttng_condition *lttng_condition_event_rule_matches_create(struct lttng_e
 
        condition = zmalloc<lttng_condition_event_rule_matches>();
        if (!condition) {
-               return NULL;
+               return nullptr;
        }
 
        lttng_condition_init(&condition->parent, LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
@@ -506,7 +506,7 @@ struct lttng_condition *lttng_condition_event_rule_matches_create(struct lttng_e
 
        lttng_event_rule_get(rule);
        condition->rule = rule;
-       rule = NULL;
+       rule = nullptr;
 
        lttng_dynamic_pointer_array_init(&condition->capture_descriptors,
                                         destroy_capture_descriptor);
@@ -571,7 +571,7 @@ static const char *str_from_buffer(const struct lttng_buffer_view *view, size_t
        goto end;
 
 error:
-       ret = NULL;
+       ret = nullptr;
 
 end:
        return ret;
@@ -580,7 +580,7 @@ end:
 static struct lttng_event_expr *event_expr_from_payload(struct lttng_payload_view *view,
                                                        size_t *offset)
 {
-       struct lttng_event_expr *expr = NULL;
+       struct lttng_event_expr *expr = nullptr;
        const char *str;
        uint64_t type;
 
@@ -659,7 +659,7 @@ static struct lttng_event_expr *event_expr_from_payload(struct lttng_payload_vie
 
 error:
        lttng_event_expr_destroy(expr);
-       expr = NULL;
+       expr = nullptr;
 
 end:
        return expr;
@@ -672,8 +672,8 @@ ssize_t lttng_condition_event_rule_matches_create_from_payload(struct lttng_payl
        size_t offset = 0;
        ssize_t event_rule_length;
        uint32_t i, capture_descr_count;
-       struct lttng_condition *condition = NULL;
-       struct lttng_event_rule *event_rule = NULL;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_event_rule *event_rule = nullptr;
 
        if (!view || !_condition) {
                goto error;
@@ -728,7 +728,7 @@ ssize_t lttng_condition_event_rule_matches_create_from_payload(struct lttng_payl
 
        consumed_length = (ssize_t) offset;
        *_condition = condition;
-       condition = NULL;
+       condition = nullptr;
        goto end;
 
 error:
@@ -768,7 +768,7 @@ enum lttng_condition_status
 lttng_condition_event_rule_matches_get_rule(const struct lttng_condition *condition,
                                            const struct lttng_event_rule **rule)
 {
-       struct lttng_event_rule *mutable_rule = NULL;
+       struct lttng_event_rule *mutable_rule = nullptr;
        const enum lttng_condition_status status =
                lttng_condition_event_rule_matches_borrow_rule_mutable(condition, &mutable_rule);
 
@@ -802,8 +802,8 @@ lttng_condition_event_rule_matches_append_capture_descriptor(struct lttng_condit
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
        struct lttng_condition_event_rule_matches *event_rule_matches_cond =
                lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
-       struct lttng_capture_descriptor *descriptor = NULL;
-       const struct lttng_event_rule *rule = NULL;
+       struct lttng_capture_descriptor *descriptor = nullptr;
+       const struct lttng_event_rule *rule = nullptr;
 
        /* Only accept l-values. */
        if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) || !expr ||
@@ -840,13 +840,13 @@ lttng_condition_event_rule_matches_append_capture_descriptor(struct lttng_condit
        }
 
        descriptor = malloc<lttng_capture_descriptor>();
-       if (descriptor == NULL) {
+       if (descriptor == nullptr) {
                status = LTTNG_CONDITION_STATUS_ERROR;
                goto end;
        }
 
        descriptor->event_expression = expr;
-       descriptor->bytecode = NULL;
+       descriptor->bytecode = nullptr;
 
        ret = lttng_dynamic_pointer_array_add_pointer(&event_rule_matches_cond->capture_descriptors,
                                                      descriptor);
@@ -856,7 +856,7 @@ lttng_condition_event_rule_matches_append_capture_descriptor(struct lttng_condit
        }
 
        /* Ownership is transfered to the internal capture_descriptors array */
-       descriptor = NULL;
+       descriptor = nullptr;
 end:
        free(descriptor);
        return status;
@@ -884,12 +884,12 @@ end:
 const struct lttng_event_expr *lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
        const struct lttng_condition *condition, unsigned int index)
 {
-       const struct lttng_event_expr *expr = NULL;
-       const struct lttng_capture_descriptor *desc = NULL;
+       const struct lttng_event_expr *expr = nullptr;
+       const struct lttng_capture_descriptor *desc = nullptr;
 
        desc = lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
                condition, index);
-       if (desc == NULL) {
+       if (desc == nullptr) {
                goto end;
        }
        expr = desc->event_expression;
@@ -904,9 +904,9 @@ ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
        struct lttng_evaluation **_evaluation)
 {
        ssize_t ret, offset = 0;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
        uint32_t capture_payload_size;
-       const char *capture_payload = NULL;
+       const char *capture_payload = nullptr;
 
        if (!_evaluation) {
                ret = -1;
@@ -949,7 +949,7 @@ ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
 
        offset += capture_payload_size;
        *_evaluation = evaluation;
-       evaluation = NULL;
+       evaluation = nullptr;
        ret = offset;
 
 error:
@@ -1006,7 +1006,7 @@ end:
 static const msgpack_object *get_msgpack_map_obj(const struct msgpack_object *map_obj,
                                                 const char *name)
 {
-       const msgpack_object *ret = NULL;
+       const msgpack_object *ret = nullptr;
        size_t i;
 
        LTTNG_ASSERT(map_obj->type == MSGPACK_OBJECT_MAP);
@@ -1047,7 +1047,7 @@ static int event_field_value_from_obj(const msgpack_object *obj,
        switch (obj->type) {
        case MSGPACK_OBJECT_NIL:
                /* Unavailable. */
-               *field_val = NULL;
+               *field_val = nullptr;
                goto end;
        case MSGPACK_OBJECT_POSITIVE_INTEGER:
                *field_val = lttng_event_field_value_uint_create(obj->via.u64);
@@ -1193,7 +1193,7 @@ static int event_field_value_from_obj(const msgpack_object *obj,
 
 error:
        lttng_event_field_value_destroy(*field_val);
-       *field_val = NULL;
+       *field_val = nullptr;
        ret = -1;
 
 end:
@@ -1205,7 +1205,7 @@ event_field_value_from_capture_payload(const struct lttng_condition_event_rule_m
                                       const char *capture_payload,
                                       size_t capture_payload_size)
 {
-       struct lttng_event_field_value *ret = NULL;
+       struct lttng_event_field_value *ret = nullptr;
        msgpack_unpacked unpacked;
        msgpack_unpack_return unpack_return;
        const msgpack_object *root_obj;
@@ -1220,7 +1220,8 @@ event_field_value_from_capture_payload(const struct lttng_condition_event_rule_m
        msgpack_unpacked_init(&unpacked);
 
        /* Decode. */
-       unpack_return = msgpack_unpack_next(&unpacked, capture_payload, capture_payload_size, NULL);
+       unpack_return =
+               msgpack_unpack_next(&unpacked, capture_payload, capture_payload_size, nullptr);
        if (unpack_return != MSGPACK_UNPACK_SUCCESS) {
                ERR("msgpack_unpack_next() failed to decode the "
                    "MessagePack-encoded capture payload: "
@@ -1292,7 +1293,7 @@ event_field_value_from_capture_payload(const struct lttng_condition_event_rule_m
 
 error:
        lttng_event_field_value_destroy(ret);
-       ret = NULL;
+       ret = nullptr;
 
 end:
        msgpack_unpacked_destroy(&unpacked);
@@ -1306,7 +1307,7 @@ struct lttng_evaluation *lttng_evaluation_event_rule_matches_create(
        bool decode_capture_payload)
 {
        struct lttng_evaluation_event_rule_matches *hit;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
 
        hit = zmalloc<lttng_evaluation_event_rule_matches>();
        if (!hit) {
@@ -1339,7 +1340,7 @@ struct lttng_evaluation *lttng_evaluation_event_rule_matches_create(
        hit->parent.destroy = lttng_evaluation_event_rule_matches_destroy;
 
        evaluation = &hit->parent;
-       hit = NULL;
+       hit = nullptr;
 
 error:
        if (hit) {
@@ -1399,7 +1400,7 @@ enum lttng_error_code lttng_condition_event_rule_matches_generate_capture_descri
                                condition, i);
                int bytecode_ret;
 
-               if (local_capture_desc == NULL) {
+               if (local_capture_desc == nullptr) {
                        ret = LTTNG_ERR_FATAL;
                        goto end;
                }
@@ -1407,7 +1408,7 @@ enum lttng_error_code lttng_condition_event_rule_matches_generate_capture_descri
                /* Generate the bytecode. */
                bytecode_ret = lttng_event_expr_to_bytecode(local_capture_desc->event_expression,
                                                            &local_capture_desc->bytecode);
-               if (bytecode_ret < 0 || local_capture_desc->bytecode == NULL) {
+               if (bytecode_ret < 0 || local_capture_desc->bytecode == nullptr) {
                        ret = LTTNG_ERR_INVALID_CAPTURE_EXPRESSION;
                        goto end;
                }
@@ -1425,8 +1426,8 @@ const struct lttng_bytecode *lttng_condition_event_rule_matches_get_capture_byte
 {
        const struct lttng_condition_event_rule_matches *event_rule_matches_cond =
                lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
-       struct lttng_capture_descriptor *desc = NULL;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_capture_descriptor *desc = nullptr;
+       struct lttng_bytecode *bytecode = nullptr;
        unsigned int count;
        enum lttng_condition_status status;
 
@@ -1445,7 +1446,7 @@ const struct lttng_bytecode *lttng_condition_event_rule_matches_get_capture_byte
 
        desc = (lttng_capture_descriptor *) lttng_dynamic_pointer_array_get_pointer(
                &event_rule_matches_cond->capture_descriptors, index);
-       if (desc == NULL) {
+       if (desc == nullptr) {
                goto end;
        }
 
index 6c6fb60c05fbaf482800d40194fc461d3e225fe7..9a5c96e8723afee12746310e611f9252aef64f60 100644 (file)
@@ -136,7 +136,7 @@ lttng_condition_session_consumed_size_mi_serialize(const struct lttng_condition
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_condition_status status;
-       const char *session_name = NULL;
+       const char *session_name = nullptr;
        uint64_t threshold_bytes;
 
        LTTNG_ASSERT(condition);
@@ -192,7 +192,7 @@ struct lttng_condition *lttng_condition_session_consumed_size_create(void)
 
        condition = zmalloc<lttng_condition_session_consumed_size>();
        if (!condition) {
-               return NULL;
+               return nullptr;
        }
 
        lttng_condition_init(&condition->parent, LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE);
@@ -299,7 +299,7 @@ create_evaluation_from_payload(const struct lttng_payload_view *view)
 {
        const struct lttng_evaluation_session_consumed_size_comm *comm =
                (typeof(comm)) view->buffer.data;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
 
        if (view->buffer.size < sizeof(*comm)) {
                goto end;
@@ -315,7 +315,7 @@ lttng_evaluation_session_consumed_size_create_from_payload(struct lttng_payload_
                                                           struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
 
        if (!_evaluation) {
                ret = -1;
index a60e4fcf2f05a607d6b6effb1b411713af2f78e7..c62b5b38a1274ba25e3b94356f14f316478e475b 100644 (file)
@@ -159,7 +159,7 @@ lttng_condition_session_rotation_create(enum lttng_condition_type type)
 
        condition = zmalloc<lttng_condition_session_rotation>();
        if (!condition) {
-               return NULL;
+               return nullptr;
        }
 
        memcpy(&condition->parent, &rotation_condition_template, sizeof(condition->parent));
@@ -243,7 +243,7 @@ lttng_condition_session_rotation_create_from_payload(struct lttng_payload_view *
                                                     enum lttng_condition_type type)
 {
        ssize_t ret;
-       struct lttng_condition *condition = NULL;
+       struct lttng_condition *condition = nullptr;
 
        switch (type) {
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
@@ -297,7 +297,7 @@ static struct lttng_evaluation *lttng_evaluation_session_rotation_create(
 
        evaluation = zmalloc<lttng_evaluation_session_rotation>();
        if (!evaluation) {
-               return NULL;
+               return nullptr;
        }
 
        memcpy(&evaluation->parent, &rotation_evaluation_template, sizeof(evaluation->parent));
@@ -315,8 +315,8 @@ static ssize_t create_evaluation_from_payload(enum lttng_condition_type type,
                                              struct lttng_evaluation **_evaluation)
 {
        ssize_t ret, size;
-       struct lttng_evaluation *evaluation = NULL;
-       struct lttng_trace_archive_location *location = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
+       struct lttng_trace_archive_location *location = nullptr;
        const struct lttng_evaluation_session_rotation_comm *comm;
        struct lttng_payload_view comm_view = lttng_payload_view_from_view(view, 0, sizeof(*comm));
 
@@ -352,7 +352,7 @@ static ssize_t create_evaluation_from_payload(enum lttng_condition_type type,
        return ret;
 error:
        lttng_trace_archive_location_put(location);
-       evaluation = NULL;
+       evaluation = nullptr;
        return -1;
 }
 
@@ -362,7 +362,7 @@ lttng_evaluation_session_rotation_create_from_payload(enum lttng_condition_type
                                                      struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_evaluation *evaluation = nullptr;
 
        if (!_evaluation) {
                ret = -1;
@@ -399,7 +399,7 @@ ssize_t lttng_evaluation_session_rotation_completed_create_from_payload(
 struct lttng_evaluation *lttng_evaluation_session_rotation_ongoing_create(uint64_t id)
 {
        return lttng_evaluation_session_rotation_create(
-               LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING, id, NULL);
+               LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING, id, nullptr);
 }
 
 struct lttng_evaluation *
@@ -543,8 +543,8 @@ lttng_condition_session_rotation_mi_serialize(const struct lttng_condition *cond
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_condition_status status;
-       const char *session_name = NULL;
-       const char *type_element_str = NULL;
+       const char *session_name = nullptr;
+       const char *type_element_str = nullptr;
 
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(writer);
index 5f3c44dba06a6fd391534c6f9944783523559bb4..95edd7aa42309b31ccd02cdf56956f58b9af5ae3 100644 (file)
@@ -254,7 +254,7 @@ struct consumer_output {
  */
 static xmlChar *encode_string(const char *in_str)
 {
-       xmlChar *out_str = NULL;
+       xmlChar *out_str = nullptr;
        xmlCharEncodingHandlerPtr handler;
        int out_len, ret, in_len;
 
@@ -280,7 +280,7 @@ static xmlChar *encode_string(const char *in_str)
        ret = handler->input(out_str, &out_len, (const xmlChar *) in_str, &in_len);
        if (ret < 0) {
                xmlFree(out_str);
-               out_str = NULL;
+               out_str = nullptr;
                goto end;
        }
 
@@ -302,13 +302,13 @@ struct config_writer *config_writer_create(int fd_output, int indent)
                goto end;
        }
 
-       buffer = xmlOutputBufferCreateFd(fd_output, NULL);
+       buffer = xmlOutputBufferCreateFd(fd_output, nullptr);
        if (!buffer) {
                goto error_destroy;
        }
 
        writer->writer = xmlNewTextWriter(buffer);
-       ret = xmlTextWriterStartDocument(writer->writer, NULL, config_xml_encoding, NULL);
+       ret = xmlTextWriterStartDocument(writer->writer, nullptr, config_xml_encoding, nullptr);
        if (ret < 0) {
                goto error_destroy;
        }
@@ -327,7 +327,7 @@ end:
        return writer;
 error_destroy:
        config_writer_destroy(writer);
-       return NULL;
+       return nullptr;
 }
 
 int config_writer_destroy(struct config_writer *writer)
@@ -378,8 +378,8 @@ end:
 int config_writer_write_attribute(struct config_writer *writer, const char *name, const char *value)
 {
        int ret;
-       xmlChar *encoded_name = NULL;
-       xmlChar *encoded_value = NULL;
+       xmlChar *encoded_name = nullptr;
+       xmlChar *encoded_value = nullptr;
 
        if (!writer || !writer->writer || !name || !name[0]) {
                ret = -1;
@@ -506,8 +506,8 @@ int config_writer_write_element_string(struct config_writer *writer,
                                       const char *value)
 {
        int ret;
-       xmlChar *encoded_element_name = NULL;
-       xmlChar *encoded_value = NULL;
+       xmlChar *encoded_element_name = nullptr;
+       xmlChar *encoded_value = nullptr;
 
        if (!writer || !writer->writer || !element_name || !element_name[0] || !value) {
                ret = -1;
@@ -570,7 +570,7 @@ static void fini_session_config_validation_ctx(struct session_config_validation_
        memset(ctx, 0, sizeof(struct session_config_validation_ctx));
 }
 
-static char *get_session_config_xsd_path(void)
+static char *get_session_config_xsd_path()
 {
        char *xsd_path;
        const char *base_path = lttng_secure_getenv(DEFAULT_SESSION_CONFIG_XSD_PATH_ENV);
@@ -614,7 +614,7 @@ static int init_session_config_validation_ctx(struct session_config_validation_c
                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                goto end;
        }
-       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, NULL);
+       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, nullptr);
 
        ctx->schema = xmlSchemaParse(ctx->parser_ctx);
        if (!ctx->schema) {
@@ -631,7 +631,7 @@ static int init_session_config_validation_ctx(struct session_config_validation_c
        }
 
        xmlSchemaSetValidErrors(
-               ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, NULL);
+               ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, nullptr);
        ret = 0;
 
 end:
@@ -1088,7 +1088,7 @@ static int create_snapshot_session(const char *session_name,
 {
        int ret;
        enum lttng_error_code ret_code;
-       xmlNodePtr node = NULL;
+       xmlNodePtr node = nullptr;
        xmlNodePtr snapshot_output_list_node;
        xmlNodePtr snapshot_output_node;
        struct lttng_session_descriptor *session_descriptor = nullptr;
@@ -1118,13 +1118,13 @@ static int create_snapshot_session(const char *session_name,
        for (snapshot_output_node = xmlFirstElementChild(snapshot_output_list_node);
             snapshot_output_node;
             snapshot_output_node = xmlNextElementSibling(snapshot_output_node)) {
-               char *name = NULL;
+               char *name = nullptr;
                uint64_t max_size = UINT64_MAX;
                struct consumer_output output = {};
-               struct lttng_snapshot_output *snapshot_output = NULL;
-               const char *control_uri = NULL;
-               const char *data_uri = NULL;
-               const char *path = NULL;
+               struct lttng_snapshot_output *snapshot_output = nullptr;
+               const char *control_uri = nullptr;
+               const char *data_uri = nullptr;
+               const char *path = nullptr;
 
                for (node = xmlFirstElementChild(snapshot_output_node); node;
                     node = xmlNextElementSibling(node)) {
@@ -1166,18 +1166,18 @@ static int create_snapshot_session(const char *session_name,
                        if (overrides->path_url) {
                                path = overrides->path_url;
                                /* Control/data_uri are null */
-                               control_uri = NULL;
-                               data_uri = NULL;
+                               control_uri = nullptr;
+                               data_uri = nullptr;
                        } else {
                                if (overrides->ctrl_url) {
                                        control_uri = overrides->ctrl_url;
                                        /* path is null */
-                                       path = NULL;
+                                       path = nullptr;
                                }
                                if (overrides->data_url) {
                                        data_uri = overrides->data_url;
                                        /* path is null */
-                                       path = NULL;
+                                       path = nullptr;
                                }
                        }
                }
@@ -1245,9 +1245,9 @@ static int create_session(const char *name,
        enum lttng_error_code ret_code;
        struct consumer_output output = {};
        xmlNodePtr consumer_output_node;
-       const char *control_uri = NULL;
-       const char *data_uri = NULL;
-       const char *path = NULL;
+       const char *control_uri = nullptr;
+       const char *data_uri = nullptr;
+       const char *path = nullptr;
        struct lttng_session_descriptor *session_descriptor = nullptr;
 
        LTTNG_ASSERT(name);
@@ -1282,18 +1282,18 @@ static int create_session(const char *name,
                if (overrides->path_url) {
                        path = overrides->path_url;
                        /* control/data_uri are null */;
-                       control_uri = NULL;
-                       data_uri = NULL;
+                       control_uri = nullptr;
+                       data_uri = nullptr;
                } else {
                        if (overrides->ctrl_url) {
                                control_uri = overrides->ctrl_url;
                                /* path is null */
-                               path = NULL;
+                               path = nullptr;
                        }
                        if (overrides->data_url) {
                                data_uri = overrides->data_url;
                                /* path is null */
-                               path = NULL;
+                               path = nullptr;
                        }
                }
        }
@@ -1348,9 +1348,9 @@ static struct lttng_userspace_probe_location *
 process_userspace_probe_function_attribute_node(xmlNodePtr attribute_node)
 {
        xmlNodePtr function_attribute_node;
-       char *function_name = NULL, *binary_path = NULL;
-       struct lttng_userspace_probe_location *location = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+       char *function_name = nullptr, *binary_path = nullptr;
+       struct lttng_userspace_probe_location *location = nullptr;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
 
        /*
         * Process userspace probe location function attributes. The order of
@@ -1413,7 +1413,7 @@ process_userspace_probe_function_attribute_node(xmlNodePtr attribute_node)
                        /* Ownership of lookup_method is transferred. */
                        location = lttng_userspace_probe_location_function_create(
                                binary_path, function_name, lookup_method);
-                       lookup_method = NULL;
+                       lookup_method = nullptr;
                        goto error;
                }
        }
@@ -1428,9 +1428,9 @@ static struct lttng_userspace_probe_location *
 process_userspace_probe_tracepoint_attribute_node(xmlNodePtr attribute_node)
 {
        xmlNodePtr tracepoint_attribute_node;
-       char *probe_name = NULL, *provider_name = NULL, *binary_path = NULL;
-       struct lttng_userspace_probe_location *location = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+       char *probe_name = nullptr, *provider_name = nullptr, *binary_path = nullptr;
+       struct lttng_userspace_probe_location *location = nullptr;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
 
        /*
         * Process userspace probe location tracepoint attributes. The order of
@@ -1493,7 +1493,7 @@ process_userspace_probe_tracepoint_attribute_node(xmlNodePtr attribute_node)
                        /* Ownership of lookup_method is transferred. */
                        location = lttng_userspace_probe_location_tracepoint_create(
                                binary_path, provider_name, probe_name, lookup_method);
-                       lookup_method = NULL;
+                       lookup_method = nullptr;
                        goto error;
                }
        }
@@ -1587,9 +1587,9 @@ static int process_event_node(xmlNodePtr event_node,
        int ret = 0, i;
        xmlNodePtr node;
        struct lttng_event *event;
-       char **exclusions = NULL;
+       char **exclusions = nullptr;
        unsigned long exclusion_count = 0;
-       char *filter_expression = NULL;
+       char *filter_expression = nullptr;
 
        LTTNG_ASSERT(event_node);
        LTTNG_ASSERT(handle);
@@ -1923,7 +1923,7 @@ process_events_node(xmlNodePtr events_node, struct lttng_handle *handle, const c
        memset(&event, 0, sizeof(event));
        event.loglevel = -1;
        event.type = LTTNG_EVENT_ALL;
-       ret = lttng_disable_event_ext(handle, &event, channel_name, NULL);
+       ret = lttng_disable_event_ext(handle, &event, channel_name, nullptr);
        if (ret) {
                goto end;
        }
@@ -2365,7 +2365,7 @@ process_context_node(xmlNodePtr context_node, struct lttng_handle *handle, const
                goto end;
        }
 
-       ret = lttng_add_context(handle, &context, NULL, channel_name);
+       ret = lttng_add_context(handle, &context, nullptr, channel_name);
        if (context.ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT) {
                free(context.u.app_ctx.provider_name);
                free(context.u.app_ctx.ctx_name);
@@ -2407,41 +2407,41 @@ static int get_tracker_elements(enum lttng_process_attr process_attr,
                *element_value_type = config_element_process_attr_pid_value;
                *element_value = config_element_process_attr_id;
                *element_value_alias = config_element_process_attr_id;
-               *element_name = NULL;
+               *element_name = nullptr;
                break;
        case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
                *element_id_tracker = config_element_process_attr_tracker_vpid;
                *element_value_type = config_element_process_attr_vpid_value;
                *element_value = config_element_process_attr_id;
-               *element_value_alias = NULL;
-               *element_name = NULL;
+               *element_value_alias = nullptr;
+               *element_name = nullptr;
                break;
        case LTTNG_PROCESS_ATTR_USER_ID:
                *element_id_tracker = config_element_process_attr_tracker_uid;
                *element_value_type = config_element_process_attr_uid_value;
                *element_value = config_element_process_attr_id;
-               *element_value_alias = NULL;
+               *element_value_alias = nullptr;
                *element_name = config_element_name;
                break;
        case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
                *element_id_tracker = config_element_process_attr_tracker_vuid;
                *element_value_type = config_element_process_attr_vuid_value;
                *element_value = config_element_process_attr_id;
-               *element_value_alias = NULL;
+               *element_value_alias = nullptr;
                *element_name = config_element_name;
                break;
        case LTTNG_PROCESS_ATTR_GROUP_ID:
                *element_id_tracker = config_element_process_attr_tracker_gid;
                *element_value_type = config_element_process_attr_gid_value;
                *element_value = config_element_process_attr_id;
-               *element_value_alias = NULL;
+               *element_value_alias = nullptr;
                *element_name = config_element_name;
                break;
        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
                *element_id_tracker = config_element_process_attr_tracker_vgid;
                *element_value_type = config_element_process_attr_vgid_value;
                *element_value = config_element_process_attr_id;
-               *element_value_alias = NULL;
+               *element_value_alias = nullptr;
                *element_name = config_element_name;
                break;
        default:
@@ -2453,7 +2453,7 @@ static int get_tracker_elements(enum lttng_process_attr process_attr,
 static int process_legacy_pid_tracker_node(xmlNodePtr trackers_node, struct lttng_handle *handle)
 {
        int ret = 0, child_count;
-       xmlNodePtr targets_node = NULL;
+       xmlNodePtr targets_node = nullptr;
        xmlNodePtr node;
        const char *element_id_tracker;
        const char *element_target_id;
@@ -2461,7 +2461,7 @@ static int process_legacy_pid_tracker_node(xmlNodePtr trackers_node, struct lttn
        const char *element_id_alias;
        const char *element_name;
        enum lttng_error_code tracker_handle_ret_code;
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
        enum lttng_process_attr_tracker_handle_status status;
        const enum lttng_process_attr process_attr = handle->domain.type == LTTNG_DOMAIN_UST ?
                LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID :
@@ -2581,7 +2581,7 @@ static int process_id_tracker_node(xmlNodePtr id_tracker_node,
                                   enum lttng_process_attr process_attr)
 {
        int ret = 0, child_count;
-       xmlNodePtr values_node = NULL;
+       xmlNodePtr values_node = nullptr;
        xmlNodePtr node;
        const char *element_id_tracker;
        const char *element_target_id;
@@ -2589,7 +2589,7 @@ static int process_id_tracker_node(xmlNodePtr id_tracker_node,
        const char *element_id_alias;
        const char *element_name;
        enum lttng_error_code tracker_handle_ret_code;
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
        enum lttng_process_attr_tracker_handle_status status;
 
        LTTNG_ASSERT(handle);
@@ -2763,16 +2763,16 @@ static int process_domain_node(xmlNodePtr domain_node, const char *session_name)
 {
        int ret;
        struct lttng_domain domain {};
-       struct lttng_handle *handle = NULL;
-       struct lttng_channel *channel = NULL;
-       xmlNodePtr channels_node = NULL;
-       xmlNodePtr trackers_node = NULL;
-       xmlNodePtr pid_tracker_node = NULL;
-       xmlNodePtr vpid_tracker_node = NULL;
-       xmlNodePtr uid_tracker_node = NULL;
-       xmlNodePtr vuid_tracker_node = NULL;
-       xmlNodePtr gid_tracker_node = NULL;
-       xmlNodePtr vgid_tracker_node = NULL;
+       struct lttng_handle *handle = nullptr;
+       struct lttng_channel *channel = nullptr;
+       xmlNodePtr channels_node = nullptr;
+       xmlNodePtr trackers_node = nullptr;
+       xmlNodePtr pid_tracker_node = nullptr;
+       xmlNodePtr vpid_tracker_node = nullptr;
+       xmlNodePtr uid_tracker_node = nullptr;
+       xmlNodePtr vuid_tracker_node = nullptr;
+       xmlNodePtr gid_tracker_node = nullptr;
+       xmlNodePtr vgid_tracker_node = nullptr;
        xmlNodePtr node;
 
        LTTNG_ASSERT(session_name);
@@ -2803,8 +2803,8 @@ static int process_domain_node(xmlNodePtr domain_node, const char *session_name)
        /* create all channels */
        for (node = xmlFirstElementChild(channels_node); node; node = xmlNextElementSibling(node)) {
                const enum lttng_domain_type original_domain = domain.type;
-               xmlNodePtr contexts_node = NULL;
-               xmlNodePtr events_node = NULL;
+               xmlNodePtr contexts_node = nullptr;
+               xmlNodePtr events_node = nullptr;
                xmlNodePtr channel_attr_node;
 
                /*
@@ -2862,7 +2862,7 @@ static int process_domain_node(xmlNodePtr domain_node, const char *session_name)
 
                lttng_channel_destroy(channel);
        }
-       channel = NULL;
+       channel = nullptr;
 
        /* get the trackers node */
        for (node = xmlFirstElementChild(domain_node); node; node = xmlNextElementSibling(node)) {
@@ -3092,17 +3092,17 @@ static int process_session_node(xmlNodePtr session_node,
 {
        int ret, started = -1, snapshot_mode = -1;
        uint64_t live_timer_interval = UINT64_MAX, rotation_timer_interval = 0, rotation_size = 0;
-       xmlChar *name = NULL;
-       xmlChar *shm_path = NULL;
-       xmlNodePtr domains_node = NULL;
-       xmlNodePtr output_node = NULL;
+       xmlChar *name = nullptr;
+       xmlChar *shm_path = nullptr;
+       xmlNodePtr domains_node = nullptr;
+       xmlNodePtr output_node = nullptr;
        xmlNodePtr node;
        xmlNodePtr attributes_child;
-       struct lttng_domain *kernel_domain = NULL;
-       struct lttng_domain *ust_domain = NULL;
-       struct lttng_domain *jul_domain = NULL;
-       struct lttng_domain *log4j_domain = NULL;
-       struct lttng_domain *python_domain = NULL;
+       struct lttng_domain *kernel_domain = nullptr;
+       struct lttng_domain *ust_domain = nullptr;
+       struct lttng_domain *jul_domain = nullptr;
+       struct lttng_domain *log4j_domain = nullptr;
+       struct lttng_domain *python_domain = nullptr;
 
        for (node = xmlFirstElementChild(session_node); node; node = xmlNextElementSibling(node)) {
                if (!name && !strcmp((const char *) node->name, config_element_name)) {
@@ -3396,7 +3396,7 @@ static int load_session_from_file(const char *path,
                                  const struct config_load_session_override_attr *overrides)
 {
        int ret, session_found = !session_name;
-       xmlDocPtr doc = NULL;
+       xmlDocPtr doc = nullptr;
        xmlNodePtr sessions_node;
        xmlNodePtr session_node;
 
@@ -3470,7 +3470,7 @@ static int load_session_from_path(const char *path,
                                  const struct config_load_session_override_attr *overrides)
 {
        int ret, session_found = !session_name;
-       DIR *directory = NULL;
+       DIR *directory = nullptr;
        struct lttng_dynamic_buffer file_path;
        size_t path_len;
 
@@ -3667,7 +3667,7 @@ int config_load_session(const char *path,
 {
        int ret;
        bool session_loaded = false;
-       const char *path_ptr = NULL;
+       const char *path_ptr = nullptr;
        struct session_config_validation_ctx validation_ctx = {};
 
        ret = init_session_config_validation_ctx(&validation_ctx);
@@ -3739,7 +3739,7 @@ int config_load_session(const char *path,
                }
 
                /* Reset path pointer for the system wide dir. */
-               path_ptr = NULL;
+               path_ptr = nullptr;
 
                /* Try system wide configuration directory. */
                if (autoload) {
@@ -3802,7 +3802,7 @@ end:
        return ret;
 }
 
-static void __attribute__((destructor)) session_config_exit(void)
+static void __attribute__((destructor)) session_config_exit()
 {
        xmlCleanupParser();
 }
index 410722d07ff74b6ce83cca86ccfebf9860e5b325..9af9ab0fc67ecb1d16f5f5a6a77c6780550f8d06 100644 (file)
@@ -135,7 +135,7 @@ int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel)
                ret = -1;
                goto end;
        }
-       ret = pthread_mutex_init(&channel->metadata_cache->lock, NULL);
+       ret = pthread_mutex_init(&channel->metadata_cache->lock, nullptr);
        if (ret != 0) {
                PERROR("mutex init");
                goto end_free_cache;
index 2816d1a37cb28a9d544e61fb874dc4e3a2468a9a..161289d2104adbb4e99736f07995d1a5dea083ba 100644 (file)
@@ -362,7 +362,7 @@ end_unlock_mutex:
 int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx, uint64_t session_id)
 {
        int ret;
-       struct lttng_consumer_stream *stream = NULL;
+       struct lttng_consumer_stream *stream = nullptr;
        struct lttng_ht_iter iter;
        struct lttng_ht *ht;
 
@@ -521,7 +521,7 @@ consumer_stream_open_packet(struct lttng_consumer_stream *stream)
                goto end;
        }
 
-       ret = consumer_stream_flush_buffer(stream, 0);
+       ret = consumer_stream_flush_buffer(stream, false);
        if (ret) {
                ERR("Failed to flush an empty packet at rotation point: stream id = %" PRIu64
                    ", channel name = %s, session id = %" PRIu64,
@@ -644,7 +644,7 @@ struct lttng_consumer_stream *consumer_stream_create(struct lttng_consumer_chann
        struct lttng_consumer_stream *stream;
 
        stream = zmalloc<lttng_consumer_stream>();
-       if (stream == NULL) {
+       if (stream == nullptr) {
                PERROR("malloc struct lttng_consumer_stream");
                ret = -ENOMEM;
                goto end;
@@ -669,13 +669,13 @@ struct lttng_consumer_stream *consumer_stream_create(struct lttng_consumer_chann
        stream->session_id = session_id;
        stream->monitor = monitor;
        stream->endpoint_status = CONSUMER_ENDPOINT_ACTIVE;
-       stream->index_file = NULL;
+       stream->index_file = nullptr;
        stream->last_sequence_number = -1ULL;
        stream->rotate_position = -1ULL;
        /* Buffer is created with an open packet. */
        stream->opened_packet_in_current_trace_chunk = true;
-       pthread_mutex_init(&stream->lock, NULL);
-       pthread_mutex_init(&stream->metadata_timer_lock, NULL);
+       pthread_mutex_init(&stream->lock, nullptr);
+       pthread_mutex_init(&stream->metadata_timer_lock, nullptr);
 
        /* If channel is the metadata, flag this stream as metadata. */
        if (type == CONSUMER_CHANNEL_TYPE_METADATA) {
@@ -683,8 +683,8 @@ struct lttng_consumer_stream *consumer_stream_create(struct lttng_consumer_chann
                /* Metadata is flat out. */
                strncpy(stream->name, DEFAULT_METADATA_NAME, sizeof(stream->name));
                /* Live rendez-vous point. */
-               pthread_cond_init(&stream->metadata_rdv, NULL);
-               pthread_mutex_init(&stream->metadata_rdv_lock, NULL);
+               pthread_cond_init(&stream->metadata_rdv, nullptr);
+               pthread_mutex_init(&stream->metadata_rdv_lock, nullptr);
        } else {
                /* Format stream name to <channel_name>_<cpu_number> */
                ret = snprintf(stream->name, sizeof(stream->name), "%s_%d", channel_name, cpu);
@@ -729,7 +729,7 @@ struct lttng_consumer_stream *consumer_stream_create(struct lttng_consumer_chann
        rcu_read_unlock();
 
        lttng_dynamic_array_init(
-               &stream->read_subbuffer_ops.post_consume_cbs, sizeof(post_consume_cb), NULL);
+               &stream->read_subbuffer_ops.post_consume_cbs, sizeof(post_consume_cb), nullptr);
 
        if (type == CONSUMER_CHANNEL_TYPE_METADATA) {
                stream->read_subbuffer_ops.lock = consumer_stream_metadata_lock_all;
@@ -780,7 +780,7 @@ end:
        if (alloc_ret) {
                *alloc_ret = ret;
        }
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -847,16 +847,16 @@ void consumer_stream_close_output(struct lttng_consumer_stream *stream)
 
        if (stream->index_file) {
                lttng_index_file_put(stream->index_file);
-               stream->index_file = NULL;
+               stream->index_file = nullptr;
        }
 
        lttng_trace_chunk_put(stream->trace_chunk);
-       stream->trace_chunk = NULL;
+       stream->trace_chunk = nullptr;
 
        /* Check and cleanup relayd if needed. */
        rcu_read_lock();
        relayd = consumer_find_relayd(stream->net_seq_idx);
-       if (relayd != NULL) {
+       if (relayd != nullptr) {
                consumer_stream_relayd_close(stream, relayd);
                stream->net_seq_idx = -1ULL;
        }
@@ -931,7 +931,7 @@ void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream)
 
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
-               if (stream->mmap_base != NULL) {
+               if (stream->mmap_base != nullptr) {
                        const auto ret = munmap(stream->mmap_base, stream->mmap_len);
 
                        if (ret != 0) {
@@ -1008,7 +1008,7 @@ static void destroy_close_stream(struct lttng_consumer_stream *stream)
  */
 static struct lttng_consumer_channel *unref_channel(struct lttng_consumer_stream *stream)
 {
-       struct lttng_consumer_channel *free_chan = NULL;
+       struct lttng_consumer_channel *free_chan = nullptr;
 
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->chan);
@@ -1038,7 +1038,7 @@ void consumer_stream_destroy(struct lttng_consumer_stream *stream, struct lttng_
 
        /* Stream is in monitor mode. */
        if (stream->monitor) {
-               struct lttng_consumer_channel *free_chan = NULL;
+               struct lttng_consumer_channel *free_chan = nullptr;
 
                /*
                 * This means that the stream was successfully removed from the streams
@@ -1082,7 +1082,7 @@ void consumer_stream_destroy(struct lttng_consumer_stream *stream, struct lttng_
 
        /* Free stream within a RCU call. */
        lttng_trace_chunk_put(stream->trace_chunk);
-       stream->trace_chunk = NULL;
+       stream->trace_chunk = nullptr;
        lttng_dynamic_array_reset(&stream->read_subbuffer_ops.post_consume_cbs);
        consumer_stream_free(stream);
 }
@@ -1158,7 +1158,7 @@ int consumer_stream_create_output_files(struct lttng_consumer_stream *stream, bo
                                     stream->name,
                                     stream->chan->tracefile_size,
                                     stream->tracefile_count_current,
-                                    NULL,
+                                    nullptr,
                                     stream_path,
                                     sizeof(stream_path));
        if (ret < 0) {
@@ -1244,7 +1244,7 @@ static ssize_t metadata_bucket_flush(const struct stream_subbuffer *buffer, void
        ssize_t ret;
        struct lttng_consumer_stream *stream = (lttng_consumer_stream *) data;
 
-       ret = consumer_stream_consume_mmap(NULL, stream, buffer);
+       ret = consumer_stream_consume_mmap(nullptr, stream, buffer);
        if (ret < 0) {
                goto end;
        }
index 864ef6e9f7b57bf0be8cf44df0df1c8d9540c048..7f88a9712825de9151c4d082f6951ad11e81db1a 100644 (file)
@@ -393,7 +393,7 @@ static int consumer_channel_timer_start(timer_t *timer_id,
        its.it_interval.tv_sec = its.it_value.tv_sec;
        its.it_interval.tv_nsec = its.it_value.tv_nsec;
 
-       ret = timer_settime(*timer_id, 0, &its, NULL);
+       ret = timer_settime(*timer_id, 0, &its, nullptr);
        if (ret == -1) {
                PERROR("timer_settime");
                goto error_destroy_timer;
@@ -419,7 +419,7 @@ static int consumer_channel_timer_stop(timer_t *timer_id, int signal)
        }
 
        consumer_timer_signal_thread_qs(signal);
-       *timer_id = 0;
+       *timer_id = nullptr;
 end:
        return ret;
 }
@@ -542,14 +542,14 @@ end:
  * Block the RT signals for the entire process. It must be called from the
  * consumer main before creating the threads
  */
-int consumer_signal_init(void)
+int consumer_signal_init()
 {
        int ret;
        sigset_t mask;
 
        /* Block signal for entire process, so only our thread processes it. */
        setmask(&mask);
-       ret = pthread_sigmask(SIG_BLOCK, &mask, NULL);
+       ret = pthread_sigmask(SIG_BLOCK, &mask, nullptr);
        if (ret) {
                errno = ret;
                PERROR("pthread_sigmask");
@@ -716,7 +716,7 @@ void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel
        }
 }
 
-int consumer_timer_thread_get_channel_monitor_pipe(void)
+int consumer_timer_thread_get_channel_monitor_pipe()
 {
        return uatomic_read(&the_channel_monitor_pipe);
 }
@@ -761,7 +761,7 @@ void *consumer_timer_thread(void *data)
        setmask(&mask);
        CMM_STORE_SHARED(timer_signal.tid, pthread_self());
 
-       while (1) {
+       while (true) {
                health_code_update();
 
                health_poll_entry();
@@ -806,5 +806,5 @@ error_testpoint:
 end:
        health_unregister(health_consumerd);
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
index 3445ed57fd1fd2399824912e36ee135a88c26695..b38460f6021631bc0aca44984388a8c0a2c27302 100644 (file)
@@ -45,12 +45,12 @@ int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
                unsigned int monitor_timer_interval_us);
 int consumer_timer_monitor_stop(struct lttng_consumer_channel *channel);
 void *consumer_timer_thread(void *data);
-int consumer_signal_init(void);
+int consumer_signal_init();
 
 int consumer_flush_kernel_index(struct lttng_consumer_stream *stream);
 int consumer_flush_ust_index(struct lttng_consumer_stream *stream);
 
-int consumer_timer_thread_get_channel_monitor_pipe(void);
+int consumer_timer_thread_get_channel_monitor_pipe();
 int consumer_timer_thread_set_channel_monitor_pipe(int fd);
 
 #endif /* CONSUMER_TIMER_H */
index b059eaf52c58397166b564988136dbd59b1b0036..eb7e6375eed4577736fb303a098ab37a6d7c3ece 100644 (file)
@@ -79,7 +79,7 @@ int data_consumption_paused;
  */
 int consumer_quit;
 
-static const char *get_consumer_domain(void)
+static const char *get_consumer_domain()
 {
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -100,7 +100,7 @@ static const char *get_consumer_domain(void)
  */
 static void notify_thread_lttng_pipe(struct lttng_pipe *pipe)
 {
-       struct lttng_consumer_stream *null_stream = NULL;
+       struct lttng_consumer_stream *null_stream = nullptr;
 
        LTTNG_ASSERT(pipe);
 
@@ -138,7 +138,7 @@ static void notify_channel_pipe(struct lttng_consumer_local_data *ctx,
 
 void notify_thread_del_channel(struct lttng_consumer_local_data *ctx, uint64_t key)
 {
-       notify_channel_pipe(ctx, NULL, key, CONSUMER_CHANNEL_DEL);
+       notify_channel_pipe(ctx, nullptr, key, CONSUMER_CHANNEL_DEL);
 }
 
 static int read_channel_pipe(struct lttng_consumer_local_data *ctx,
@@ -180,7 +180,7 @@ static void clean_channel_stream_list(struct lttng_consumer_channel *channel)
                 * global hash table.
                 */
                stream->monitor = 0;
-               consumer_stream_destroy(stream, NULL);
+               consumer_stream_destroy(stream, nullptr);
        }
 }
 
@@ -192,20 +192,20 @@ static struct lttng_consumer_stream *find_stream(uint64_t key, struct lttng_ht *
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
-       struct lttng_consumer_stream *stream = NULL;
+       struct lttng_consumer_stream *stream = nullptr;
 
        LTTNG_ASSERT(ht);
 
        /* -1ULL keys are lookup failures */
        if (key == (uint64_t) -1ULL) {
-               return NULL;
+               return nullptr;
        }
 
        rcu_read_lock();
 
        lttng_ht_lookup(ht, &key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node != NULL) {
+       if (node != nullptr) {
                stream = lttng::utils::container_of(node, &lttng_consumer_stream::node);
        }
 
@@ -242,18 +242,18 @@ struct lttng_consumer_channel *consumer_find_channel(uint64_t key)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
-       struct lttng_consumer_channel *channel = NULL;
+       struct lttng_consumer_channel *channel = nullptr;
 
        ASSERT_RCU_READ_LOCKED();
 
        /* -1ULL keys are lookup failures */
        if (key == (uint64_t) -1ULL) {
-               return NULL;
+               return nullptr;
        }
 
        lttng_ht_lookup(the_consumer_data.channel_ht, &key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node != NULL) {
+       if (node != nullptr) {
                channel = lttng::utils::container_of(node, &lttng_consumer_channel::node);
        }
 
@@ -338,7 +338,7 @@ void consumer_destroy_relayd(struct consumer_relayd_sock_pair *relayd)
        int ret;
        struct lttng_ht_iter iter;
 
-       if (relayd == NULL) {
+       if (relayd == nullptr) {
                return;
        }
 
@@ -398,7 +398,7 @@ void consumer_del_channel(struct lttng_consumer_channel *channel)
        }
 
        lttng_trace_chunk_put(channel->trace_chunk);
-       channel->trace_chunk = NULL;
+       channel->trace_chunk = nullptr;
 
        if (channel->is_published) {
                int ret;
@@ -425,7 +425,7 @@ end:
  * Iterate over the relayd hash table and destroy each element. Finally,
  * destroy the whole hash table.
  */
-static void cleanup_relayd_ht(void)
+static void cleanup_relayd_ht()
 {
        struct lttng_ht_iter iter;
        struct consumer_relayd_sock_pair *relayd;
@@ -635,7 +635,7 @@ static int add_relayd(struct consumer_relayd_sock_pair *relayd)
 
        lttng_ht_lookup(the_consumer_data.relayd_ht, &relayd->net_seq_idx, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node != NULL) {
+       if (node != nullptr) {
                goto end;
        }
        lttng_ht_add_unique_u64(the_consumer_data.relayd_ht, &relayd->node);
@@ -649,7 +649,7 @@ end:
  */
 static struct consumer_relayd_sock_pair *consumer_allocate_relayd_sock_pair(uint64_t net_seq_idx)
 {
-       struct consumer_relayd_sock_pair *obj = NULL;
+       struct consumer_relayd_sock_pair *obj = nullptr;
 
        /* net sequence index of -1 is a failure */
        if (net_seq_idx == (uint64_t) -1ULL) {
@@ -657,7 +657,7 @@ static struct consumer_relayd_sock_pair *consumer_allocate_relayd_sock_pair(uint
        }
 
        obj = zmalloc<consumer_relayd_sock_pair>();
-       if (obj == NULL) {
+       if (obj == nullptr) {
                PERROR("zmalloc relayd sock");
                goto error;
        }
@@ -668,7 +668,7 @@ static struct consumer_relayd_sock_pair *consumer_allocate_relayd_sock_pair(uint
        obj->control_sock.sock.fd = -1;
        obj->data_sock.sock.fd = -1;
        lttng_ht_node_init_u64(&obj->node, obj->net_seq_idx);
-       pthread_mutex_init(&obj->ctrl_sock_mutex, NULL);
+       pthread_mutex_init(&obj->ctrl_sock_mutex, nullptr);
 
 error:
        return obj;
@@ -685,7 +685,7 @@ struct consumer_relayd_sock_pair *consumer_find_relayd(uint64_t key)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
 
        ASSERT_RCU_READ_LOCKED();
 
@@ -696,7 +696,7 @@ struct consumer_relayd_sock_pair *consumer_find_relayd(uint64_t key)
 
        lttng_ht_lookup(the_consumer_data.relayd_ht, &key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if (node != NULL) {
+       if (node != nullptr) {
                relayd = lttng::utils::container_of(node, &consumer_relayd_sock_pair::node);
        }
 
@@ -721,7 +721,7 @@ int consumer_send_relayd_stream(struct lttng_consumer_stream *stream, char *path
        /* The stream is not metadata. Get relayd reference if exists. */
        rcu_read_lock();
        relayd = consumer_find_relayd(stream->net_seq_idx);
-       if (relayd != NULL) {
+       if (relayd != nullptr) {
                /* Add stream on the relayd */
                pthread_mutex_lock(&relayd->ctrl_sock_mutex);
                ret = relayd_add_stream(&relayd->control_sock,
@@ -775,7 +775,7 @@ int consumer_send_relayd_streams_sent(uint64_t net_seq_idx)
        /* The stream is not metadata. Get relayd reference if exists. */
        rcu_read_lock();
        relayd = consumer_find_relayd(net_seq_idx);
-       if (relayd != NULL) {
+       if (relayd != nullptr) {
                /* Add stream on the relayd */
                pthread_mutex_lock(&relayd->ctrl_sock_mutex);
                ret = relayd_streams_sent(&relayd->control_sock);
@@ -1010,8 +1010,8 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
                                                         const char *root_shm_path,
                                                         const char *shm_path)
 {
-       struct lttng_consumer_channel *channel = NULL;
-       struct lttng_trace_chunk *trace_chunk = NULL;
+       struct lttng_consumer_channel *channel = nullptr;
+       struct lttng_trace_chunk *trace_chunk = nullptr;
 
        if (chunk_id) {
                trace_chunk = lttng_trace_chunk_registry_find_chunk(
@@ -1023,7 +1023,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        }
 
        channel = zmalloc<lttng_consumer_channel>();
-       if (channel == NULL) {
+       if (channel == nullptr) {
                PERROR("malloc struct lttng_consumer_channel");
                goto end;
        }
@@ -1038,8 +1038,8 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        channel->monitor = monitor;
        channel->live_timer_interval = live_timer_interval;
        channel->is_live = is_in_live_session;
-       pthread_mutex_init(&channel->lock, NULL);
-       pthread_mutex_init(&channel->timer_lock, NULL);
+       pthread_mutex_init(&channel->lock, nullptr);
+       pthread_mutex_init(&channel->timer_lock, nullptr);
 
        switch (output) {
        case LTTNG_EVENT_SPLICE:
@@ -1051,7 +1051,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        default:
                abort();
                free(channel);
-               channel = NULL;
+               channel = nullptr;
                goto end;
        }
 
@@ -1103,7 +1103,7 @@ end:
        return channel;
 error:
        consumer_del_channel(channel);
-       channel = NULL;
+       channel = nullptr;
        goto end;
 }
 
@@ -1271,7 +1271,7 @@ int lttng_consumer_send_error(struct lttng_consumer_local_data *ctx, int cmd)
  * Close all the tracefiles and stream fds and MUST be called when all
  * instances are destroyed i.e. when all threads were joined and are ended.
  */
-void lttng_consumer_cleanup(void)
+void lttng_consumer_cleanup()
 {
        struct lttng_ht_iter iter;
        struct lttng_consumer_channel *channel;
@@ -1414,14 +1414,14 @@ lttng_consumer_create(enum lttng_consumer_type type,
        the_consumer_data.type = type;
 
        ctx = zmalloc<lttng_consumer_local_data>();
-       if (ctx == NULL) {
+       if (ctx == nullptr) {
                PERROR("allocating context");
                goto error;
        }
 
        ctx->consumer_error_socket = -1;
        ctx->consumer_metadata_socket = -1;
-       pthread_mutex_init(&ctx->metadata_socket_lock, NULL);
+       pthread_mutex_init(&ctx->metadata_socket_lock, nullptr);
        /* assign the callbacks */
        ctx->on_buffer_ready = buffer_ready;
        ctx->on_recv_channel = recv_channel;
@@ -1470,7 +1470,7 @@ error_wakeup_pipe:
 error_poll_pipe:
        free(ctx);
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1481,7 +1481,7 @@ static void destroy_data_stream_ht(struct lttng_ht *ht)
        struct lttng_ht_iter iter;
        struct lttng_consumer_stream *stream;
 
-       if (ht == NULL) {
+       if (ht == nullptr) {
                return;
        }
 
@@ -1507,7 +1507,7 @@ static void destroy_metadata_stream_ht(struct lttng_ht *ht)
        struct lttng_ht_iter iter;
        struct lttng_consumer_stream *stream;
 
-       if (ht == NULL) {
+       if (ht == nullptr) {
                return;
        }
 
@@ -1615,7 +1615,7 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(struct lttng_consumer_stream *stre
        off_t orig_offset = stream->out_fd_offset;
        /* Default is on the disk */
        int outfd = stream->out_fd;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
        unsigned int relayd_hang_up = 0;
        const size_t subbuf_content_size = buffer->size - padding;
        size_t write_len;
@@ -1627,7 +1627,7 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(struct lttng_consumer_stream *stre
        /* Flag that the current stream if set for network streaming. */
        if (stream->net_seq_idx != (uint64_t) -1ULL) {
                relayd = consumer_find_relayd(stream->net_seq_idx);
-               if (relayd == NULL) {
+               if (relayd == nullptr) {
                        ret = -EPIPE;
                        goto end;
                }
@@ -1783,7 +1783,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data
        int fd = stream->wait_fd;
        /* Default is on the disk */
        int outfd = stream->out_fd;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
        int *splice_pipe;
        unsigned int relayd_hang_up = 0;
 
@@ -1805,7 +1805,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data
        /* Flag that the current stream if set for network streaming. */
        if (stream->net_seq_idx != (uint64_t) -1ULL) {
                relayd = consumer_find_relayd(stream->net_seq_idx);
-               if (relayd == NULL) {
+               if (relayd == nullptr) {
                        written = -ret;
                        goto end;
                }
@@ -1886,7 +1886,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data
                    fd,
                    splice_pipe[1]);
                ret_splice = splice(
-                       fd, &offset, splice_pipe[1], NULL, len, SPLICE_F_MOVE | SPLICE_F_MORE);
+                       fd, &offset, splice_pipe[1], nullptr, len, SPLICE_F_MOVE | SPLICE_F_MORE);
                DBG("splice chan to pipe, ret %zd", ret_splice);
                if (ret_splice < 0) {
                        ret = errno;
@@ -1912,9 +1912,9 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data
 
                /* Splice data out */
                ret_splice = splice(splice_pipe[0],
-                                   NULL,
+                                   nullptr,
                                    outfd,
-                                   NULL,
+                                   nullptr,
                                    ret_splice,
                                    SPLICE_F_MOVE | SPLICE_F_MORE);
                DBG("Consumer splice pipe to file (out_fd: %d), ret %zd", outfd, ret_splice);
@@ -2083,7 +2083,7 @@ int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
 }
 
-static void lttng_consumer_close_all_metadata(void)
+static void lttng_consumer_close_all_metadata()
 {
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -2114,7 +2114,7 @@ static void lttng_consumer_close_all_metadata(void)
  */
 void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht)
 {
-       struct lttng_consumer_channel *channel = NULL;
+       struct lttng_consumer_channel *channel = nullptr;
        bool free_channel = false;
 
        LTTNG_ASSERT(stream);
@@ -2154,14 +2154,14 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, struct l
                /* Go for channel deletion! */
                free_channel = true;
        }
-       stream->chan = NULL;
+       stream->chan = nullptr;
 
        /*
         * Nullify the stream reference so it is not used after deletion. The
         * channel lock MUST be acquired before being able to check for a NULL
         * pointer value.
         */
-       channel->metadata_stream = NULL;
+       channel->metadata_stream = nullptr;
 
        if (channel->metadata_cache) {
                pthread_mutex_unlock(&channel->metadata_cache->lock);
@@ -2175,7 +2175,7 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, struct l
        }
 
        lttng_trace_chunk_put(stream->trace_chunk);
-       stream->trace_chunk = NULL;
+       stream->trace_chunk = nullptr;
        consumer_stream_free(stream);
 }
 
@@ -2249,7 +2249,7 @@ void consumer_add_metadata_stream(struct lttng_consumer_stream *stream)
 /*
  * Delete data stream that are flagged for deletion (endpoint_status).
  */
-static void validate_endpoint_status_data_stream(void)
+static void validate_endpoint_status_data_stream()
 {
        struct lttng_ht_iter iter;
        struct lttng_consumer_stream *stream;
@@ -2306,7 +2306,7 @@ void *consumer_thread_metadata_poll(void *data)
 {
        int ret, i, pollfd, err = -1;
        uint32_t revents, nb_fd;
-       struct lttng_consumer_stream *stream = NULL;
+       struct lttng_consumer_stream *stream = nullptr;
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
        struct lttng_poll_event events;
@@ -2340,7 +2340,7 @@ void *consumer_thread_metadata_poll(void *data)
        /* Main loop */
        DBG("Metadata main loop started");
 
-       while (1) {
+       while (true) {
        restart:
                health_code_update();
                health_poll_entry();
@@ -2393,7 +2393,7 @@ void *consumer_thread_metadata_poll(void *data)
                                        }
 
                                        /* A NULL stream means that the state has changed. */
-                                       if (stream == NULL) {
+                                       if (stream == nullptr) {
                                                /* Check for deleted streams. */
                                                validate_endpoint_status_metadata_stream(&events);
                                                goto restart;
@@ -2513,7 +2513,7 @@ error_testpoint:
        }
        health_unregister(health_consumerd);
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -2523,9 +2523,9 @@ error_testpoint:
 void *consumer_thread_data_poll(void *data)
 {
        int num_rdy, num_hup, high_prio, ret, i, err = -1;
-       struct pollfd *pollfd = NULL;
+       struct pollfd *pollfd = nullptr;
        /* local view of the streams */
-       struct lttng_consumer_stream **local_stream = NULL, *new_stream = NULL;
+       struct lttng_consumer_stream **local_stream = nullptr, *new_stream = nullptr;
        /* local view of consumer_data.fds_count */
        int nb_fd = 0;
        /* 2 for the consumer_data_pipe and wake up pipe */
@@ -2546,12 +2546,12 @@ void *consumer_thread_data_poll(void *data)
        health_code_update();
 
        local_stream = zmalloc<lttng_consumer_stream *>();
-       if (local_stream == NULL) {
+       if (local_stream == nullptr) {
                PERROR("local_stream malloc");
                goto end;
        }
 
-       while (1) {
+       while (true) {
                health_code_update();
 
                high_prio = 0;
@@ -2564,15 +2564,15 @@ void *consumer_thread_data_poll(void *data)
                pthread_mutex_lock(&the_consumer_data.lock);
                if (the_consumer_data.need_update) {
                        free(pollfd);
-                       pollfd = NULL;
+                       pollfd = nullptr;
 
                        free(local_stream);
-                       local_stream = NULL;
+                       local_stream = nullptr;
 
                        /* Allocate for all fds */
                        pollfd =
                                calloc<struct pollfd>(the_consumer_data.stream_count + nb_pipes_fd);
-                       if (pollfd == NULL) {
+                       if (pollfd == nullptr) {
                                PERROR("pollfd malloc");
                                pthread_mutex_unlock(&the_consumer_data.lock);
                                goto end;
@@ -2580,7 +2580,7 @@ void *consumer_thread_data_poll(void *data)
 
                        local_stream = calloc<lttng_consumer_stream *>(
                                the_consumer_data.stream_count + nb_pipes_fd);
-                       if (local_stream == NULL) {
+                       if (local_stream == nullptr) {
                                PERROR("local_stream malloc");
                                pthread_mutex_unlock(&the_consumer_data.lock);
                                goto end;
@@ -2656,7 +2656,7 @@ void *consumer_thread_data_poll(void *data)
                         * the sessiond poll thread changed the consumer_quit state and is
                         * waking us up to test it.
                         */
-                       if (new_stream == NULL) {
+                       if (new_stream == nullptr) {
                                validate_endpoint_status_data_stream();
                                continue;
                        }
@@ -2683,7 +2683,7 @@ void *consumer_thread_data_poll(void *data)
                for (i = 0; i < nb_fd; i++) {
                        health_code_update();
 
-                       if (local_stream[i] == NULL) {
+                       if (local_stream[i] == nullptr) {
                                continue;
                        }
                        if (pollfd[i].revents & POLLPRI) {
@@ -2694,7 +2694,7 @@ void *consumer_thread_data_poll(void *data)
                                if (len < 0 && len != -EAGAIN && len != -ENODATA) {
                                        /* Clean the stream and free it. */
                                        consumer_del_stream(local_stream[i], data_ht);
-                                       local_stream[i] = NULL;
+                                       local_stream[i] = nullptr;
                                } else if (len > 0) {
                                        local_stream[i]->has_data_left_to_be_read_before_teardown =
                                                1;
@@ -2714,7 +2714,7 @@ void *consumer_thread_data_poll(void *data)
                for (i = 0; i < nb_fd; i++) {
                        health_code_update();
 
-                       if (local_stream[i] == NULL) {
+                       if (local_stream[i] == nullptr) {
                                continue;
                        }
                        if ((pollfd[i].revents & POLLIN) || local_stream[i]->hangup_flush_done ||
@@ -2725,7 +2725,7 @@ void *consumer_thread_data_poll(void *data)
                                if (len < 0 && len != -EAGAIN && len != -ENODATA) {
                                        /* Clean the stream and free it. */
                                        consumer_del_stream(local_stream[i], data_ht);
-                                       local_stream[i] = NULL;
+                                       local_stream[i] = nullptr;
                                } else if (len > 0) {
                                        local_stream[i]->has_data_left_to_be_read_before_teardown =
                                                1;
@@ -2737,7 +2737,7 @@ void *consumer_thread_data_poll(void *data)
                for (i = 0; i < nb_fd; i++) {
                        health_code_update();
 
-                       if (local_stream[i] == NULL) {
+                       if (local_stream[i] == nullptr) {
                                continue;
                        }
                        if (!local_stream[i]->hangup_flush_done &&
@@ -2767,25 +2767,25 @@ void *consumer_thread_data_poll(void *data)
                                DBG("Polling fd %d tells it has hung up.", pollfd[i].fd);
                                if (!local_stream[i]->has_data_left_to_be_read_before_teardown) {
                                        consumer_del_stream(local_stream[i], data_ht);
-                                       local_stream[i] = NULL;
+                                       local_stream[i] = nullptr;
                                        num_hup++;
                                }
                        } else if (pollfd[i].revents & POLLERR) {
                                ERR("Error returned in polling fd %d.", pollfd[i].fd);
                                if (!local_stream[i]->has_data_left_to_be_read_before_teardown) {
                                        consumer_del_stream(local_stream[i], data_ht);
-                                       local_stream[i] = NULL;
+                                       local_stream[i] = nullptr;
                                        num_hup++;
                                }
                        } else if (pollfd[i].revents & POLLNVAL) {
                                ERR("Polling fd %d tells fd is not open.", pollfd[i].fd);
                                if (!local_stream[i]->has_data_left_to_be_read_before_teardown) {
                                        consumer_del_stream(local_stream[i], data_ht);
-                                       local_stream[i] = NULL;
+                                       local_stream[i] = nullptr;
                                        num_hup++;
                                }
                        }
-                       if (local_stream[i] != NULL) {
+                       if (local_stream[i] != nullptr) {
                                local_stream[i]->has_data_left_to_be_read_before_teardown = 0;
                        }
                }
@@ -2815,7 +2815,7 @@ error_testpoint:
        health_unregister(health_consumerd);
 
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -2880,7 +2880,7 @@ static void destroy_channel_ht(struct lttng_ht *ht)
        struct lttng_consumer_channel *channel;
        int ret;
 
-       if (ht == NULL) {
+       if (ht == nullptr) {
                return;
        }
 
@@ -2905,7 +2905,7 @@ void *consumer_thread_channel_poll(void *data)
 {
        int ret, i, pollfd, err = -1;
        uint32_t revents, nb_fd;
-       struct lttng_consumer_channel *chan = NULL;
+       struct lttng_consumer_channel *chan = nullptr;
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
        struct lttng_poll_event events;
@@ -2945,7 +2945,7 @@ void *consumer_thread_channel_poll(void *data)
        /* Main loop */
        DBG("Channel main loop started");
 
-       while (1) {
+       while (true) {
        restart:
                health_code_update();
                DBG("Channel poll wait");
@@ -3143,7 +3143,7 @@ error_testpoint:
        }
        health_unregister(health_consumerd);
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static int set_metadata_socket(struct lttng_consumer_local_data *ctx,
@@ -3266,7 +3266,7 @@ void *consumer_thread_sessiond_poll(void *data)
        consumer_sockpoll[1].fd = sock;
        consumer_sockpoll[1].events = POLLIN | POLLPRI;
 
-       while (1) {
+       while (true) {
                health_code_update();
 
                health_poll_entry();
@@ -3323,7 +3323,7 @@ end:
         */
        notify_thread_lttng_pipe(ctx->consumer_data_pipe);
 
-       notify_channel_pipe(ctx, NULL, -1, CONSUMER_CHANNEL_QUIT);
+       notify_channel_pipe(ctx, nullptr, -1, CONSUMER_CHANNEL_QUIT);
 
        notify_health_quit_pipe(health_quit_pipe);
 
@@ -3349,7 +3349,7 @@ error_testpoint:
        health_unregister(health_consumerd);
 
        rcu_unregister_thread();
-       return NULL;
+       return nullptr;
 }
 
 static int post_consume(struct lttng_consumer_stream *stream,
@@ -3503,7 +3503,7 @@ int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream)
 /*
  * Allocate and set consumer data hash tables.
  */
-int lttng_consumer_init(void)
+int lttng_consumer_init()
 {
        the_consumer_data.channel_ht = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        if (!the_consumer_data.channel_ht) {
@@ -3570,7 +3570,7 @@ void consumer_add_relayd_socket(uint64_t net_seq_idx,
 {
        int fd = -1, ret = -1, relayd_created = 0;
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
 
        LTTNG_ASSERT(ctx);
        LTTNG_ASSERT(sock >= 0);
@@ -3580,11 +3580,11 @@ void consumer_add_relayd_socket(uint64_t net_seq_idx,
 
        /* Get relayd reference if exists. */
        relayd = consumer_find_relayd(net_seq_idx);
-       if (relayd == NULL) {
+       if (relayd == nullptr) {
                LTTNG_ASSERT(sock_type == LTTNG_STREAM_CONTROL);
                /* Not found. Allocate one. */
                relayd = consumer_allocate_relayd_sock_pair(net_seq_idx);
-               if (relayd == NULL) {
+               if (relayd == nullptr) {
                        ret_code = LTTCOMM_CONSUMERD_ENOMEM;
                        goto error;
                } else {
@@ -3727,7 +3727,7 @@ error_nosignal:
 static struct consumer_relayd_sock_pair *find_relayd_by_session_id(uint64_t id)
 {
        struct lttng_ht_iter iter;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
 
        ASSERT_RCU_READ_LOCKED();
 
@@ -3743,7 +3743,7 @@ static struct consumer_relayd_sock_pair *find_relayd_by_session_id(uint64_t id)
                }
        }
 
-       return NULL;
+       return nullptr;
 
 found:
        return relayd;
@@ -3761,7 +3761,7 @@ int consumer_data_pending(uint64_t id)
        struct lttng_ht_iter iter;
        struct lttng_ht *ht;
        struct lttng_consumer_stream *stream;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
        int (*data_pending)(struct lttng_consumer_stream *);
 
        DBG("Consumer data pending command on session id %" PRIu64, id);
@@ -3998,7 +3998,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
        uint64_t next_chunk_id, stream_count = 0;
        enum lttng_trace_chunk_status chunk_status;
        const bool is_local_trace = relayd_id == -1ULL;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
        bool rotating_to_new_chunk = true;
        /* Array of `struct lttng_consumer_stream *` */
        struct lttng_dynamic_pointer_array streams_packet_to_open;
@@ -4008,9 +4008,10 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
 
        DBG("Consumer sample rotate position for channel %" PRIu64, key);
 
-       lttng_dynamic_array_init(
-               &stream_rotation_positions, sizeof(struct relayd_stream_rotation_position), NULL);
-       lttng_dynamic_pointer_array_init(&streams_packet_to_open, NULL);
+       lttng_dynamic_array_init(&stream_rotation_positions,
+                                sizeof(struct relayd_stream_rotation_position),
+                                nullptr);
+       lttng_dynamic_pointer_array_init(&streams_packet_to_open, nullptr);
 
        rcu_read_lock();
 
@@ -4107,7 +4108,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                                                chunk_status = lttng_trace_chunk_get_name(
                                                        stream->trace_chunk,
                                                        &trace_chunk_name,
-                                                       NULL);
+                                                       nullptr);
                                                if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_NONE) {
                                                        trace_chunk_name = "none";
                                                }
@@ -4290,7 +4291,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
 
                pthread_mutex_unlock(&stream->lock);
        }
-       stream = NULL;
+       stream = nullptr;
 
        if (!is_local_trace) {
                relayd = consumer_find_relayd(relayd_id);
@@ -4303,7 +4304,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                pthread_mutex_lock(&relayd->ctrl_sock_mutex);
                ret = relayd_rotate_streams(&relayd->control_sock,
                                            stream_count,
-                                           rotating_to_new_chunk ? &next_chunk_id : NULL,
+                                           rotating_to_new_chunk ? &next_chunk_id : nullptr,
                                            (const struct relayd_stream_rotation_position *)
                                                    stream_rotation_positions.buffer.data);
                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
@@ -4427,7 +4428,7 @@ static int consumer_clear_stream(struct lttng_consumer_stream *stream)
 {
        int ret;
 
-       ret = consumer_stream_flush_buffer(stream, 1);
+       ret = consumer_stream_flush_buffer(stream, true);
        if (ret < 0) {
                ERR("Failed to flush stream %" PRIu64 " during channel clear", stream->key);
                ret = LTTCOMM_CONSUMERD_FATAL;
@@ -4561,7 +4562,7 @@ static int rotate_local_stream(struct lttng_consumer_stream *stream)
 
        if (stream->index_file) {
                lttng_index_file_put(stream->index_file);
-               stream->index_file = NULL;
+               stream->index_file = nullptr;
        }
 
        if (!stream->trace_chunk) {
@@ -4599,7 +4600,7 @@ int lttng_consumer_rotate_stream(struct lttng_consumer_stream *stream)
                 * parent channel, becomes part of no chunk and can't output
                 * anything until a new trace chunk is created.
                 */
-               stream->trace_chunk = NULL;
+               stream->trace_chunk = nullptr;
        } else if (stream->chan->trace_chunk && !lttng_trace_chunk_get(stream->chan->trace_chunk)) {
                ERR("Failed to acquire a reference to channel's trace chunk during stream rotation");
                ret = -1;
@@ -4735,7 +4736,7 @@ lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
 {
        int ret;
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
-       struct lttng_trace_chunk *created_chunk = NULL, *published_chunk = NULL;
+       struct lttng_trace_chunk *created_chunk = nullptr, *published_chunk = nullptr;
        enum lttng_trace_chunk_status chunk_status;
        char relayd_id_buffer[MAX_INT_DEC_LEN(*relayd_id)];
        char creation_timestamp_buffer[ISO8601_STR_LEN];
@@ -4784,7 +4785,7 @@ lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
         * the session daemon through the LTTNG_CONSUMER_CREATE_TRACE_CHUNK
         * and LTTNG_CONSUMER_DESTROY_TRACE_CHUNK commands.
         */
-       created_chunk = lttng_trace_chunk_create(chunk_id, chunk_creation_timestamp, NULL);
+       created_chunk = lttng_trace_chunk_create(chunk_id, chunk_creation_timestamp, nullptr);
        if (!created_chunk) {
                ERR("Failed to create trace chunk");
                ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
@@ -4811,7 +4812,7 @@ lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
                 * directory.
                 */
                chunk_status = lttng_trace_chunk_set_as_user(created_chunk, chunk_directory_handle);
-               chunk_directory_handle = NULL;
+               chunk_directory_handle = nullptr;
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ERR("Failed to set trace chunk's directory handle");
                        ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
@@ -4822,7 +4823,7 @@ lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
        published_chunk = lttng_trace_chunk_registry_publish_chunk(
                the_consumer_data.chunk_registry, session_id, created_chunk);
        lttng_trace_chunk_put(created_chunk);
-       created_chunk = NULL;
+       created_chunk = nullptr;
        if (!published_chunk) {
                ERR("Failed to publish trace chunk");
                ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
@@ -4858,7 +4859,7 @@ lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
                                                                     session_id,
                                                                     chunk_id,
                                                                     chunk_creation_timestamp,
-                                                                    NULL,
+                                                                    nullptr,
                                                                     path);
                        if (close_ret != LTTCOMM_CONSUMERD_SUCCESS) {
                                ERR("Failed to roll-back the creation of new chunk: session_id = %" PRIu64
@@ -4892,7 +4893,7 @@ lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
                                                                     session_id,
                                                                     chunk_id,
                                                                     chunk_creation_timestamp,
-                                                                    NULL,
+                                                                    nullptr,
                                                                     path);
                        if (close_ret != LTTCOMM_CONSUMERD_SUCCESS) {
                                ERR("Failed to roll-back the creation of new chunk: session_id = %" PRIu64
@@ -4996,7 +4997,7 @@ lttng_consumer_close_trace_chunk(const uint64_t *relayd_id,
                if (channel->trace_chunk != chunk) {
                        continue;
                }
-               ret = lttng_consumer_channel_set_trace_chunk(channel, NULL);
+               ret = lttng_consumer_channel_set_trace_chunk(channel, nullptr);
                if (ret) {
                        /*
                         * Attempt to close the chunk on as many channels as
@@ -5045,7 +5046,7 @@ lttng_consumer_trace_chunk_exists(const uint64_t *relayd_id, uint64_t session_id
        char relayd_id_buffer[MAX_INT_DEC_LEN(*relayd_id)];
        const char *relayd_id_str = "(none)";
        const bool is_local_trace = !relayd_id;
-       struct consumer_relayd_sock_pair *relayd = NULL;
+       struct consumer_relayd_sock_pair *relayd = nullptr;
        bool chunk_exists_local, chunk_exists_remote;
 
        if (relayd_id) {
index cd8b89457f07bed43b631b544416bb23f3b284a8..a28bc160959277431e8555256e1a0d71c559689a 100644 (file)
@@ -899,7 +899,7 @@ const char *lttng_consumer_type_str(enum lttng_consumer_type type)
 /*
  * Init consumer data structures.
  */
-int lttng_consumer_init(void);
+int lttng_consumer_init();
 
 /*
  * Set the error socket for communication with a session daemon.
@@ -929,7 +929,7 @@ void lttng_consumer_should_exit(struct lttng_consumer_local_data *ctx);
 /*
  * Cleanup the daemon's socket on exit.
  */
-void lttng_consumer_cleanup(void);
+void lttng_consumer_cleanup();
 
 /*
  * Poll on the should_quit pipe and the command socket return -1 on error and
index b85a39abd92f6a19c53ef60e2bb3c7e2d0e77990..60e30ad298d9edc9a9bf7a519dc0bba32cf794d3 100644 (file)
@@ -16,7 +16,7 @@
 int parse_application_context(const char *str, char **out_provider_name, char **out_ctx_name)
 {
        const char app_ctx_prefix[] = "$app.";
-       char *provider_name = NULL, *ctx_name = NULL;
+       char *provider_name = nullptr, *ctx_name = nullptr;
        size_t i, len, colon_pos = 0, provider_name_len, ctx_name_len;
 
        if (!str || !out_provider_name || !out_ctx_name) {
index 05a8b9cfa0baa4febfa5015621bc13a62e9135d7..e5d70b9e6db73e805db1bc8efd9ed2b3fc46c38c 100644 (file)
@@ -20,7 +20,7 @@
 static int pthread_attr_init_done;
 static pthread_attr_t tattr;
 
-static size_t get_page_size(void)
+static size_t get_page_size()
 {
        const long ret = sysconf(_SC_PAGE_SIZE);
 
@@ -35,42 +35,42 @@ static size_t get_page_size(void)
        return (size_t) ret;
 }
 
-size_t default_get_channel_subbuf_size(void)
+size_t default_get_channel_subbuf_size()
 {
        return std::max<size_t>(_DEFAULT_CHANNEL_SUBBUF_SIZE, get_page_size());
 }
 
-size_t default_get_metadata_subbuf_size(void)
+size_t default_get_metadata_subbuf_size()
 {
        return std::max<size_t>(DEFAULT_METADATA_SUBBUF_SIZE, get_page_size());
 }
 
-size_t default_get_kernel_channel_subbuf_size(void)
+size_t default_get_kernel_channel_subbuf_size()
 {
        return std::max<size_t>(DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE, get_page_size());
 }
 
-size_t default_get_ust_pid_channel_subbuf_size(void)
+size_t default_get_ust_pid_channel_subbuf_size()
 {
        return std::max<size_t>(DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE, get_page_size());
 }
 
-size_t default_get_ust_uid_channel_subbuf_size(void)
+size_t default_get_ust_uid_channel_subbuf_size()
 {
        return std::max<size_t>(DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE, get_page_size());
 }
 
-pthread_attr_t *default_pthread_attr(void)
+pthread_attr_t *default_pthread_attr()
 {
        if (pthread_attr_init_done) {
                return &tattr;
        }
 
        WARN("Uninitialized pthread attributes, using libc defaults.");
-       return NULL;
+       return nullptr;
 }
 
-static void __attribute__((constructor)) init_default_pthread_attr(void)
+static void __attribute__((constructor)) init_default_pthread_attr()
 {
        int ret;
        struct rlimit rlim;
@@ -138,7 +138,7 @@ error_destroy:
        }
 }
 
-static void __attribute__((destructor)) fini_default_pthread_attr(void)
+static void __attribute__((destructor)) fini_default_pthread_attr()
 {
        int ret;
 
index 61e2891a1e9acd9552cb221c793202f30b951902..4588fe768e1536549e3a872ea6c51ebe2f83c2fc 100644 (file)
  * This function depends on a value that is set at constructor time, so it is
  * unsafe to call it from another constructor.
  */
-size_t default_get_channel_subbuf_size(void);
+size_t default_get_channel_subbuf_size();
 
 /*
  * Returns the default metadata subbuf size.
@@ -387,7 +387,7 @@ size_t default_get_channel_subbuf_size(void);
  * This function depends on a value that is set at constructor time, so it is
  * unsafe to call it from another constructor.
  */
-size_t default_get_metadata_subbuf_size(void);
+size_t default_get_metadata_subbuf_size();
 
 /*
  * Returns the default subbuf size for the kernel domain.
@@ -395,7 +395,7 @@ size_t default_get_metadata_subbuf_size(void);
  * This function depends on a value that is set at constructor time, so it is
  * unsafe to call it from another constructor.
  */
-size_t default_get_kernel_channel_subbuf_size(void);
+size_t default_get_kernel_channel_subbuf_size();
 
 /*
  * Returns the default subbuf size for the UST domain per PID.
@@ -403,7 +403,7 @@ size_t default_get_kernel_channel_subbuf_size(void);
  * This function depends on a value that is set at constructor time, so it is
  * unsafe to call it from another constructor.
  */
-size_t default_get_ust_pid_channel_subbuf_size(void);
+size_t default_get_ust_pid_channel_subbuf_size();
 
 /*
  * Returns the default subbuf size for the UST domain per UID.
@@ -411,7 +411,7 @@ size_t default_get_ust_pid_channel_subbuf_size(void);
  * This function depends on a value that is set at constructor time, so it is
  * unsafe to call it from another constructor.
  */
-size_t default_get_ust_uid_channel_subbuf_size(void);
+size_t default_get_ust_uid_channel_subbuf_size();
 
 /*
  * Get the default pthread_attr to use on thread creation.
@@ -422,6 +422,6 @@ size_t default_get_ust_uid_channel_subbuf_size(void);
  * pthread_attr_t pointer where the thread stack size is set to the soft stack
  * size limit.
  */
-pthread_attr_t *default_pthread_attr(void);
+pthread_attr_t *default_pthread_attr();
 
 #endif /* _DEFAULTS_H */
index 030dd459d5dcaea729217b89f0aaad880d5e4b89..c18a484711038cc782945283b2c9c192d3359758 100644 (file)
@@ -124,7 +124,7 @@ int lttng_dynamic_pointer_array_remove_pointer(struct lttng_dynamic_pointer_arra
         * Prevent the destructor from being used by the underlying
         * dynamic array.
         */
-       array->array.destructor = NULL;
+       array->array.destructor = nullptr;
        if (destructor) {
                destructor(lttng_dynamic_pointer_array_get_pointer(array, index));
        }
@@ -147,7 +147,7 @@ void lttng_dynamic_pointer_array_reset(struct lttng_dynamic_pointer_array *array
                 * Prevent the destructor from being used by the underlying
                 * dynamic array.
                 */
-               array->array.destructor = NULL;
+               array->array.destructor = nullptr;
        }
        lttng_dynamic_array_reset(&array->array);
 }
@@ -160,7 +160,7 @@ void lttng_dynamic_pointer_array_clear(struct lttng_dynamic_pointer_array *array
         * Prevent the destructor from being used by the underlying
         * dynamic array.
         */
-       array->array.destructor = NULL;
+       array->array.destructor = nullptr;
        if (destructor) {
                size_t i, count = lttng_dynamic_pointer_array_get_count(array);
 
index 91ad060c41d9e6a0e84c7ef16cb86705d8caeb91..2a1f22943d6a4393b858aa61066d73c1b831035a 100644 (file)
@@ -144,7 +144,7 @@ void *lttng_dynamic_pointer_array_steal_pointer(
        void **p_element = (void **) lttng_dynamic_array_get_element(&array->array, index);
        void *element = *p_element;
 
-       *p_element = NULL;
+       *p_element = nullptr;
 
        return element;
 }
index be6257720c882f6782a46760272f705da12e594c..b64e9676ad3e9eb3d01428ce8a9731eb73333feb 100644 (file)
@@ -170,7 +170,7 @@ void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer)
        buffer->size = 0;
        buffer->_capacity = 0;
        free(buffer->data);
-       buffer->data = NULL;
+       buffer->data = nullptr;
 }
 
 size_t lttng_dynamic_buffer_get_capacity_left(struct lttng_dynamic_buffer *buffer)
index ca9eb6dd28b70f6b831c4b851dbcaf6278f07223..b93fede89f459f2af5c43e38c84c7f8165156a66 100644 (file)
@@ -100,8 +100,8 @@ lttng_error_query_result_counter_mi_serialize(const struct lttng_error_query_res
 
 struct lttng_error_query *lttng_error_query_trigger_create(const struct lttng_trigger *trigger)
 {
-       struct lttng_error_query_trigger *query = NULL;
-       struct lttng_trigger *trigger_copy = NULL;
+       struct lttng_error_query_trigger *query = nullptr;
+       struct lttng_trigger *trigger_copy = nullptr;
 
        if (!trigger) {
                goto end;
@@ -120,18 +120,18 @@ struct lttng_error_query *lttng_error_query_trigger_create(const struct lttng_tr
 
        query->parent.target_type = LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER;
        query->trigger = trigger_copy;
-       trigger_copy = NULL;
+       trigger_copy = nullptr;
 
 error:
        lttng_trigger_put(trigger_copy);
 end:
-       return query ? &query->parent : NULL;
+       return query ? &query->parent : nullptr;
 }
 
 struct lttng_error_query *lttng_error_query_condition_create(const struct lttng_trigger *trigger)
 {
-       struct lttng_error_query_condition *query = NULL;
-       struct lttng_trigger *trigger_copy = NULL;
+       struct lttng_error_query_condition *query = nullptr;
+       struct lttng_trigger *trigger_copy = nullptr;
 
        if (!trigger) {
                goto end;
@@ -150,12 +150,12 @@ struct lttng_error_query *lttng_error_query_condition_create(const struct lttng_
 
        query->parent.target_type = LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION;
        query->trigger = trigger_copy;
-       trigger_copy = NULL;
+       trigger_copy = nullptr;
 
 error:
        lttng_trigger_put(trigger_copy);
 end:
-       return query ? &query->parent : NULL;
+       return query ? &query->parent : nullptr;
 }
 
 static struct lttng_action *
@@ -164,7 +164,7 @@ get_trigger_action_from_path(struct lttng_trigger *trigger,
 {
        size_t index_count, i;
        enum lttng_action_path_status path_status;
-       struct lttng_action *current_action = NULL;
+       struct lttng_action *current_action = nullptr;
 
        path_status = lttng_action_path_get_index_count(action_path, &index_count);
        if (path_status != LTTNG_ACTION_PATH_STATUS_OK) {
@@ -202,8 +202,8 @@ struct lttng_error_query *
 lttng_error_query_action_create(const struct lttng_trigger *trigger,
                                const struct lttng_action_path *action_path)
 {
-       struct lttng_error_query_action *query = NULL;
-       struct lttng_trigger *trigger_copy = NULL;
+       struct lttng_error_query_action *query = nullptr;
+       struct lttng_trigger *trigger_copy = nullptr;
        int ret_copy;
 
        if (!trigger || !action_path || !is_valid_action_path(trigger, action_path)) {
@@ -228,14 +228,14 @@ lttng_error_query_action_create(const struct lttng_trigger *trigger,
 
        query->parent.target_type = LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION;
        query->trigger = trigger_copy;
-       trigger_copy = NULL;
+       trigger_copy = nullptr;
        goto end;
 
 error:
        lttng_trigger_put(trigger_copy);
-       lttng_error_query_destroy(query ? &query->parent : NULL);
+       lttng_error_query_destroy(query ? &query->parent : nullptr);
 end:
-       return query ? &query->parent : NULL;
+       return query ? &query->parent : nullptr;
 }
 
 void lttng_error_query_destroy(struct lttng_error_query *query)
@@ -417,7 +417,7 @@ lttng_error_query_result_counter_create(const char *name, const char *descriptio
 error:
        lttng_error_query_result_destroy(&counter->parent);
 end:
-       return counter ? &counter->parent : NULL;
+       return counter ? &counter->parent : nullptr;
 }
 
 static void destroy_result(void *ptr)
@@ -427,7 +427,7 @@ static void destroy_result(void *ptr)
        lttng_error_query_result_destroy(result);
 }
 
-struct lttng_error_query_results *lttng_error_query_results_create(void)
+struct lttng_error_query_results *lttng_error_query_results_create()
 {
        struct lttng_error_query_results *set = zmalloc<lttng_error_query_results>();
 
@@ -569,7 +569,7 @@ ssize_t lttng_error_query_results_create_from_payload(struct lttng_payload_view
        struct lttng_error_query_results_comm *header;
        struct lttng_payload_view header_view =
                lttng_payload_view_from_view(view, 0, sizeof(*header));
-       struct lttng_error_query_results *results = NULL;
+       struct lttng_error_query_results *results = nullptr;
 
        if (!lttng_payload_view_is_valid(&header_view)) {
                ERR("Failed to map view to error query result set header");
@@ -612,7 +612,7 @@ ssize_t lttng_error_query_results_create_from_payload(struct lttng_payload_view
        }
 
        *_results = results;
-       results = NULL;
+       results = nullptr;
 end:
        lttng_error_query_results_destroy(results);
        return total_used_size;
@@ -777,7 +777,7 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
 {
        ssize_t used_size = 0;
        struct lttng_error_query_comm *header;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_trigger *trigger = nullptr;
        struct lttng_payload_view header_view =
                lttng_payload_view_from_view(view, 0, sizeof(*header));
 
@@ -847,7 +847,7 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
        }
        case LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION:
        {
-               struct lttng_action_path *action_path = NULL;
+               struct lttng_action_path *action_path = nullptr;
 
                {
                        ssize_t trigger_used_size;
@@ -1077,8 +1077,8 @@ lttng_error_query_result_mi_serialize(const struct lttng_error_query_result *res
        enum lttng_error_code ret_code;
        enum lttng_error_query_result_status result_status;
        enum lttng_error_query_result_type type;
-       const char *name = NULL;
-       const char *description = NULL;
+       const char *name = nullptr;
+       const char *description = nullptr;
 
        LTTNG_ASSERT(result);
        LTTNG_ASSERT(writer);
index ab09053ccfb1465179139187069e73954a0b6f97..1bf9491c27d8c8295716722c63e3e9ccd59e86dd 100644 (file)
@@ -30,7 +30,7 @@ static int lttng_opt_abort_on_error = -1;
 DEFINE_URCU_TLS(struct log_time, error_log_time);
 DEFINE_URCU_TLS(const char *, logger_thread_name);
 
-const char *log_add_time(void)
+const char *log_add_time()
 {
        int ret;
        struct tm tm, *res;
index fdae1e72c293bb0aefc16b008621dfb772993033..8b8e4364530bfcaccc7113697eaed0ff9d8a3bac 100644 (file)
@@ -259,7 +259,7 @@ const char *error_get_str(int32_t code);
  * the caller. On error, an empty string is returned thus no time will be
  * printed in the log.
  */
-const char *log_add_time(void);
+const char *log_add_time();
 
 /* Name must be a statically-allocated string. */
 void logger_set_thread_name(const char *name, bool set_pthread_name);
index 3218503165130c9a3edfbb33e9b82622439007a0..221d8e6cbf9518290026dd57b213b302b887c495 100644 (file)
@@ -71,7 +71,7 @@ error:
        if (expr) {
                lttng_event_expr_destroy(&expr->parent);
        }
-       expr = NULL;
+       expr = nullptr;
 
 end:
        return expr;
@@ -79,7 +79,7 @@ end:
 
 struct lttng_event_expr *lttng_event_expr_event_payload_field_create(const char *field_name)
 {
-       struct lttng_event_expr *expr = NULL;
+       struct lttng_event_expr *expr = nullptr;
 
        if (!field_name) {
                goto end;
@@ -94,7 +94,7 @@ end:
 
 struct lttng_event_expr *lttng_event_expr_channel_context_field_create(const char *field_name)
 {
-       struct lttng_event_expr *expr = NULL;
+       struct lttng_event_expr *expr = nullptr;
 
        if (!field_name) {
                goto end;
@@ -110,7 +110,7 @@ end:
 struct lttng_event_expr *
 lttng_event_expr_app_specific_context_field_create(const char *provider_name, const char *type_name)
 {
-       struct lttng_event_expr_app_specific_context_field *expr = NULL;
+       struct lttng_event_expr_app_specific_context_field *expr = nullptr;
        struct lttng_event_expr *ret_parent_expr;
 
        if (!type_name || !provider_name) {
@@ -141,7 +141,7 @@ error:
        if (expr) {
                lttng_event_expr_destroy(&expr->parent);
        }
-       ret_parent_expr = NULL;
+       ret_parent_expr = nullptr;
 
 end:
        return ret_parent_expr;
@@ -151,7 +151,7 @@ struct lttng_event_expr *
 lttng_event_expr_array_field_element_create(struct lttng_event_expr *array_field_expr,
                                            unsigned int index)
 {
-       struct lttng_event_expr_array_field_element *expr = NULL;
+       struct lttng_event_expr_array_field_element *expr = nullptr;
        struct lttng_event_expr *ret_parent_expr;
 
        /* The parent array field expression must be an l-value */
@@ -172,7 +172,7 @@ lttng_event_expr_array_field_element_create(struct lttng_event_expr *array_field
        goto end;
 
 error:
-       ret_parent_expr = NULL;
+       ret_parent_expr = nullptr;
 
 end:
        return ret_parent_expr;
@@ -180,7 +180,7 @@ end:
 
 const char *lttng_event_expr_event_payload_field_get_name(const struct lttng_event_expr *expr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD) {
                goto end;
@@ -194,7 +194,7 @@ end:
 
 const char *lttng_event_expr_channel_context_field_get_name(const struct lttng_event_expr *expr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD) {
                goto end;
@@ -209,7 +209,7 @@ end:
 const char *
 lttng_event_expr_app_specific_context_field_get_provider_name(const struct lttng_event_expr *expr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD) {
                goto end;
@@ -225,7 +225,7 @@ end:
 const char *
 lttng_event_expr_app_specific_context_field_get_type_name(const struct lttng_event_expr *expr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD) {
                goto end;
@@ -241,7 +241,7 @@ end:
 const struct lttng_event_expr *
 lttng_event_expr_array_field_element_get_parent_expr(const struct lttng_event_expr *expr)
 {
-       const struct lttng_event_expr *ret = NULL;
+       const struct lttng_event_expr *ret = nullptr;
 
        if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT) {
                goto end;
@@ -464,7 +464,7 @@ static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
        case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
        {
                int ret;
-               char *name = NULL;
+               char *name = nullptr;
                const char *provider_name, *type_name;
 
                status = bytecode_push_get_app_context_root(bytecode);
@@ -556,8 +556,8 @@ int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
 {
        int status;
        struct return_op ret_insn;
-       struct lttng_bytecode_alloc *bytecode = NULL;
-       struct lttng_bytecode_alloc *bytecode_reloc = NULL;
+       struct lttng_bytecode_alloc *bytecode = nullptr;
+       struct lttng_bytecode_alloc *bytecode_reloc = nullptr;
 
        status = bytecode_init(&bytecode);
        if (status) {
@@ -614,7 +614,7 @@ lttng_event_expr_event_payload_field_mi_serialize(const struct lttng_event_expr
 {
        int ret;
        enum lttng_error_code ret_code;
-       const char *name = NULL;
+       const char *name = nullptr;
 
        LTTNG_ASSERT(expression);
        LTTNG_ASSERT(writer);
@@ -656,7 +656,7 @@ lttng_event_expr_channel_context_field_mi_serialize(const struct lttng_event_exp
 {
        int ret;
        enum lttng_error_code ret_code;
-       const char *name = NULL;
+       const char *name = nullptr;
 
        LTTNG_ASSERT(expression);
        LTTNG_ASSERT(writer);
@@ -699,8 +699,8 @@ lttng_event_expr_app_specific_context_field_mi_serialize(const struct lttng_even
 {
        int ret;
        enum lttng_error_code ret_code;
-       const char *provider_name = NULL;
-       const char *type_name = NULL;
+       const char *provider_name = nullptr;
+       const char *type_name = nullptr;
 
        LTTNG_ASSERT(expression);
        LTTNG_ASSERT(writer);
@@ -755,7 +755,7 @@ lttng_event_expr_array_field_element_mi_serialize(const struct lttng_event_expr
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_event_expr_status status;
-       const struct lttng_event_expr *parent_expr = NULL;
+       const struct lttng_event_expr *parent_expr = nullptr;
        unsigned int index;
 
        LTTNG_ASSERT(expression);
@@ -766,7 +766,7 @@ lttng_event_expr_array_field_element_mi_serialize(const struct lttng_event_expr
        LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
 
        parent_expr = lttng_event_expr_array_field_element_get_parent_expr(expression);
-       LTTNG_ASSERT(parent_expr != NULL);
+       LTTNG_ASSERT(parent_expr != nullptr);
 
        /* Open event expr array field element. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_expr_array_field_element);
index 3d3d55ab75cf4e115830283610151f6335e99f28..a52f192684093bf7ab996313e0546a27a346594d 100644 (file)
@@ -206,7 +206,7 @@ static void destroy_field_val(void *field_val)
        lttng_event_field_value_destroy((lttng_event_field_value *) field_val);
 }
 
-struct lttng_event_field_value *lttng_event_field_value_array_create(void)
+struct lttng_event_field_value *lttng_event_field_value_array_create()
 {
        struct lttng_event_field_value_array *field_val = lttng::utils::container_of(
                create_empty_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY, sizeof(*field_val)),
@@ -288,7 +288,7 @@ int lttng_event_field_value_enum_append_label_with_size(struct lttng_event_field
                         ->labels,
                new_label);
        if (ret == 0) {
-               new_label = NULL;
+               new_label = nullptr;
        }
 
 end:
@@ -320,7 +320,7 @@ int lttng_event_field_value_array_append_unavailable(struct lttng_event_field_va
        return lttng_dynamic_pointer_array_add_pointer(
                &lttng::utils::container_of(array_field_val, &lttng_event_field_value_array::parent)
                         ->elems,
-               NULL);
+               nullptr);
 }
 
 enum lttng_event_field_value_type
@@ -466,7 +466,7 @@ lttng_event_field_value_enum_get_label_at_index(const struct lttng_event_field_v
        const struct lttng_event_field_value_enum *enum_field_val;
 
        if (!field_val || !is_enum_field_val(field_val)) {
-               ret = NULL;
+               ret = nullptr;
                goto end;
        }
 
@@ -474,7 +474,7 @@ lttng_event_field_value_enum_get_label_at_index(const struct lttng_event_field_v
                lttng::utils::container_of(field_val, &lttng_event_field_value_enum::parent);
 
        if (index >= lttng_dynamic_pointer_array_get_count(&enum_field_val->labels)) {
-               ret = NULL;
+               ret = nullptr;
                goto end;
        }
 
index 5ac475f3eafd1a1283b377bb290e5fe586940ec1..3e862b2464cd54e35ea4569b9103fc27971c2011 100644 (file)
@@ -149,7 +149,7 @@ ssize_t lttng_event_rule_create_from_payload(struct lttng_payload_view *view,
                                             struct lttng_event_rule **event_rule)
 {
        ssize_t ret, consumed = 0;
-       event_rule_create_from_payload_cb create_from_payload = NULL;
+       event_rule_create_from_payload_cb create_from_payload = nullptr;
        const struct lttng_event_rule_comm *event_rule_comm;
        const struct lttng_payload_view event_rule_comm_view =
                lttng_payload_view_from_view(view, 0, sizeof(*event_rule_comm));
index 5c836f857abdec19f5c7d93194cb236cdf456502..bff0aa6b6896533e3314948b84e3de45167a86f9 100644 (file)
@@ -29,7 +29,7 @@ static void lttng_event_rule_jul_logging_destroy(struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_jul_logging *jul_logging;
 
-       if (rule == NULL) {
+       if (rule == nullptr) {
                return;
        }
 
@@ -87,7 +87,7 @@ static int lttng_event_rule_jul_logging_serialize(const struct lttng_event_rule
 
        pattern_len = strlen(jul_logging->pattern) + 1;
 
-       if (jul_logging->filter_expression != NULL) {
+       if (jul_logging->filter_expression != nullptr) {
                filter_expression_len = strlen(jul_logging->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
@@ -178,10 +178,10 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
 {
        int err;
        int ret = 0;
-       char *agent_filter = NULL;
+       char *agent_filter = nullptr;
        const char *pattern;
        const char *filter;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
        enum lttng_event_rule_status status;
 
        LTTNG_ASSERT(rule);
@@ -195,7 +195,7 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
 
        status = lttng_event_rule_jul_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret = -1;
                goto end;
@@ -266,7 +266,7 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
        }
 
        *_agent_filter = agent_filter;
-       agent_filter = NULL;
+       agent_filter = nullptr;
 
 end:
        free(agent_filter);
@@ -282,7 +282,7 @@ lttng_event_rule_jul_logging_generate_filter_bytecode(struct lttng_event_rule *r
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status;
        const char *filter;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
        char *agent_filter;
 
        LTTNG_ASSERT(rule);
@@ -291,7 +291,7 @@ lttng_event_rule_jul_logging_generate_filter_bytecode(struct lttng_event_rule *r
 
        status = lttng_event_rule_jul_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -310,7 +310,7 @@ lttng_event_rule_jul_logging_generate_filter_bytecode(struct lttng_event_rule *r
 
        jul_logging->internal_filter.filter = agent_filter;
 
-       if (jul_logging->internal_filter.filter == NULL) {
+       if (jul_logging->internal_filter.filter == nullptr) {
                ret_code = LTTNG_OK;
                goto end;
        }
@@ -323,7 +323,7 @@ lttng_event_rule_jul_logging_generate_filter_bytecode(struct lttng_event_rule *r
        }
 
        jul_logging->internal_filter.bytecode = bytecode;
-       bytecode = NULL;
+       bytecode = nullptr;
        ret_code = LTTNG_OK;
 
 error:
@@ -358,7 +358,7 @@ lttng_event_rule_jul_logging_generate_exclusions(const struct lttng_event_rule *
                                                 struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
-       *_exclusions = NULL;
+       *_exclusions = nullptr;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
@@ -387,8 +387,8 @@ lttng_event_rule_jul_logging_generate_lttng_event(const struct lttng_event_rule
 {
        int ret;
        const struct lttng_event_rule_jul_logging *jul_logging;
-       struct lttng_event *local_event = NULL;
-       struct lttng_event *event = NULL;
+       struct lttng_event *local_event = nullptr;
+       struct lttng_event *event = nullptr;
        enum lttng_loglevel_type loglevel_type;
        int loglevel_value = 0;
        enum lttng_event_rule_status status;
@@ -444,7 +444,7 @@ lttng_event_rule_jul_logging_generate_lttng_event(const struct lttng_event_rule
        local_event->loglevel = loglevel_value;
 
        event = local_event;
-       local_event = NULL;
+       local_event = nullptr;
 error:
        free(local_event);
        return event;
@@ -458,9 +458,9 @@ lttng_event_rule_jul_logging_mi_serialize(const struct lttng_event_rule *rule,
        enum lttng_error_code ret_code;
        enum lttng_event_rule_status status;
 
-       const char *filter = NULL;
-       const char *name_pattern = NULL;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const char *filter = nullptr;
+       const char *name_pattern = nullptr;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(writer);
@@ -492,7 +492,7 @@ lttng_event_rule_jul_logging_mi_serialize(const struct lttng_event_rule *rule,
        }
 
        /* Filter expression. */
-       if (filter != NULL) {
+       if (filter != nullptr) {
                ret = mi_lttng_writer_write_element_string(
                        writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
@@ -525,7 +525,7 @@ end:
 
 struct lttng_event_rule *lttng_event_rule_jul_logging_create(void)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_jul_logging *tp_rule;
        enum lttng_event_rule_status status;
 
@@ -550,13 +550,13 @@ struct lttng_event_rule *lttng_event_rule_jul_logging_create(void)
        tp_rule->parent.generate_lttng_event = lttng_event_rule_jul_logging_generate_lttng_event;
        tp_rule->parent.mi_serialize = lttng_event_rule_jul_logging_mi_serialize;
 
-       tp_rule->log_level_rule = NULL;
+       tp_rule->log_level_rule = nullptr;
 
        /* Default pattern is '*'. */
        status = lttng_event_rule_jul_logging_set_name_pattern(rule, "*");
        if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
 end:
@@ -570,10 +570,10 @@ ssize_t lttng_event_rule_jul_logging_create_from_payload(struct lttng_payload_vi
        enum lttng_event_rule_status status;
        const struct lttng_event_rule_jul_logging_comm *jul_logging_comm;
        const char *pattern;
-       const char *filter_expression = NULL;
+       const char *filter_expression = nullptr;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_log_level_rule *log_level_rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
 
        if (!_event_rule) {
                ret = -1;
@@ -693,7 +693,7 @@ skip_log_level_rule:
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        lttng_log_level_rule_destroy(log_level_rule);
@@ -704,7 +704,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_jul_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
-       char *pattern_copy = NULL;
+       char *pattern_copy = nullptr;
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -726,7 +726,7 @@ lttng_event_rule_jul_logging_set_name_pattern(struct lttng_event_rule *rule, con
        free(jul_logging->pattern);
 
        jul_logging->pattern = pattern_copy;
-       pattern_copy = NULL;
+       pattern_copy = nullptr;
 end:
        return status;
 }
@@ -757,7 +757,7 @@ end:
 enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter(struct lttng_event_rule *rule,
                                                                     const char *expression)
 {
-       char *expression_copy = NULL;
+       char *expression_copy = nullptr;
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -779,7 +779,7 @@ enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter(struct lttn
        }
 
        jul_logging->filter_expression = expression_copy;
-       expression_copy = NULL;
+       expression_copy = nullptr;
 end:
        return status;
 }
@@ -822,7 +822,7 @@ lttng_event_rule_jul_logging_set_log_level_rule(struct lttng_event_rule *rule,
 {
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-       struct lttng_log_level_rule *copy = NULL;
+       struct lttng_log_level_rule *copy = nullptr;
 
        if (!rule || !IS_JUL_LOGGING_EVENT_RULE(rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -837,7 +837,7 @@ lttng_event_rule_jul_logging_set_log_level_rule(struct lttng_event_rule *rule,
        }
 
        copy = lttng_log_level_rule_copy(log_level_rule);
-       if (copy == NULL) {
+       if (copy == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
                goto end;
        }
@@ -865,7 +865,7 @@ lttng_event_rule_jul_logging_get_log_level_rule(const struct lttng_event_rule *r
        }
 
        jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
-       if (jul_logging->log_level_rule == NULL) {
+       if (jul_logging->log_level_rule == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
        }
index fd4929f327b5b6a750cc4c9ef386a6adfe7777a4..712136ebdbce453a80e02389cd29510732b2882e 100644 (file)
@@ -159,7 +159,7 @@ static const char *lttng_event_rule_kernel_kprobe_get_filter(const struct lttng_
                                                             __attribute__((unused)))
 {
        /* Not supported. */
-       return NULL;
+       return nullptr;
 }
 
 static const struct lttng_bytecode *
@@ -167,7 +167,7 @@ lttng_event_rule_kernel_kprobe_get_filter_bytecode(const struct lttng_event_rule
                                                   __attribute__((unused)))
 {
        /* Not supported. */
-       return NULL;
+       return nullptr;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
@@ -176,7 +176,7 @@ lttng_event_rule_kernel_kprobe_generate_exclusions(const struct lttng_event_rule
                                                   struct lttng_event_exclusion **exclusions)
 {
        /* Not supported. */
-       *exclusions = NULL;
+       *exclusions = nullptr;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
@@ -197,7 +197,7 @@ static int kernel_probe_set_location(struct lttng_event_rule_kernel_kprobe *kpro
                                     const struct lttng_kernel_probe_location *location)
 {
        int ret;
-       struct lttng_kernel_probe_location *location_copy = NULL;
+       struct lttng_kernel_probe_location *location_copy = nullptr;
 
        if (!kprobe || !location || kprobe->location) {
                ret = -1;
@@ -211,7 +211,7 @@ static int kernel_probe_set_location(struct lttng_event_rule_kernel_kprobe *kpro
        }
 
        kprobe->location = location_copy;
-       location_copy = NULL;
+       location_copy = nullptr;
        ret = 0;
 end:
        lttng_kernel_probe_location_destroy(location_copy);
@@ -225,8 +225,8 @@ lttng_event_rule_kernel_kprobe_mi_serialize(const struct lttng_event_rule *rule,
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_event_rule_status status;
-       const char *event_name = NULL;
-       const struct lttng_kernel_probe_location *location = NULL;
+       const char *event_name = nullptr;
+       const struct lttng_kernel_probe_location *location = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(writer);
@@ -277,7 +277,7 @@ end:
 struct lttng_event_rule *
 lttng_event_rule_kernel_kprobe_create(const struct lttng_kernel_probe_location *location)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_kernel_kprobe *krule;
 
        krule = zmalloc<lttng_event_rule_kernel_kprobe>();
@@ -301,7 +301,7 @@ lttng_event_rule_kernel_kprobe_create(const struct lttng_kernel_probe_location *
 
        if (kernel_probe_set_location(krule, location)) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
 end:
@@ -316,8 +316,8 @@ ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(struct lttng_payload_
        const struct lttng_event_rule_kernel_kprobe_comm *kprobe_comm;
        const char *name;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_kernel_probe_location *location = NULL;
+       struct lttng_event_rule *rule = nullptr;
+       struct lttng_kernel_probe_location *location = nullptr;
 
        if (!_event_rule) {
                ret = -1;
@@ -399,7 +399,7 @@ ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(struct lttng_payload_
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        lttng_kernel_probe_location_destroy(location);
@@ -434,7 +434,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_kernel_kprobe_set_event_name(struct lttng_event_rule *rule, const char *name)
 {
-       char *name_copy = NULL;
+       char *name_copy = nullptr;
        struct lttng_event_rule_kernel_kprobe *kprobe;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -453,7 +453,7 @@ lttng_event_rule_kernel_kprobe_set_event_name(struct lttng_event_rule *rule, con
        free(kprobe->name);
 
        kprobe->name = name_copy;
-       name_copy = NULL;
+       name_copy = nullptr;
 end:
        return status;
 }
index a75280454309569772d43b2533e215b6f87384eb..b65729cbb3be34e0e061574d6bf8c4f64b82dc72 100644 (file)
@@ -26,7 +26,7 @@ static void lttng_event_rule_kernel_syscall_destroy(struct lttng_event_rule *rul
 {
        struct lttng_event_rule_kernel_syscall *syscall;
 
-       if (rule == NULL) {
+       if (rule == nullptr) {
                return;
        }
 
@@ -79,7 +79,7 @@ static int lttng_event_rule_kernel_syscall_serialize(const struct lttng_event_ru
 
        pattern_len = strlen(syscall->pattern) + 1;
 
-       if (syscall->filter_expression != NULL) {
+       if (syscall->filter_expression != nullptr) {
                filter_expression_len = strlen(syscall->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
@@ -147,7 +147,7 @@ lttng_event_rule_kernel_syscall_generate_filter_bytecode(struct lttng_event_rule
        struct lttng_event_rule_kernel_syscall *syscall;
        enum lttng_event_rule_status status;
        const char *filter;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
 
        LTTNG_ASSERT(rule);
 
@@ -156,7 +156,7 @@ lttng_event_rule_kernel_syscall_generate_filter_bytecode(struct lttng_event_rule
        /* Generate the filter bytecode. */
        status = lttng_event_rule_kernel_syscall_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -167,14 +167,14 @@ lttng_event_rule_kernel_syscall_generate_filter_bytecode(struct lttng_event_rule
                goto end;
        }
 
-       if (filter == NULL) {
+       if (filter == nullptr) {
                /* Nothing to do. */
                ret = LTTNG_OK;
                goto end;
        }
 
        syscall->internal_filter.filter = strdup(filter);
-       if (syscall->internal_filter.filter == NULL) {
+       if (syscall->internal_filter.filter == nullptr) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
        }
@@ -185,7 +185,7 @@ lttng_event_rule_kernel_syscall_generate_filter_bytecode(struct lttng_event_rule
        }
 
        syscall->internal_filter.bytecode = bytecode;
-       bytecode = NULL;
+       bytecode = nullptr;
 
 end:
        free(bytecode);
@@ -220,7 +220,7 @@ lttng_event_rule_kernel_syscall_generate_exclusions(const struct lttng_event_rul
                                                    struct lttng_event_exclusion **exclusions)
 {
        /* Unsupported. */
-       *exclusions = NULL;
+       *exclusions = nullptr;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
@@ -248,9 +248,9 @@ lttng_event_rule_kernel_syscall_mi_serialize(const struct lttng_event_rule *rule
        enum lttng_event_rule_status status;
 
        enum lttng_event_rule_kernel_syscall_emission_site site_type;
-       const char *filter = NULL;
-       const char *name_pattern = NULL;
-       const char *site_type_str = NULL;
+       const char *filter = nullptr;
+       const char *name_pattern = nullptr;
+       const char *site_type_str = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(writer);
@@ -302,7 +302,7 @@ lttng_event_rule_kernel_syscall_mi_serialize(const struct lttng_event_rule *rule
        }
 
        /* Filter. */
-       if (filter != NULL) {
+       if (filter != nullptr) {
                ret = mi_lttng_writer_write_element_string(
                        writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
@@ -328,7 +328,7 @@ end:
 struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(
        enum lttng_event_rule_kernel_syscall_emission_site emission_site)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_kernel_syscall *syscall_rule;
        enum lttng_event_rule_status status;
 
@@ -368,7 +368,7 @@ struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(
        status = lttng_event_rule_kernel_syscall_set_name_pattern(rule, "*");
        if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
        /* Emission site type */
@@ -385,9 +385,9 @@ ssize_t lttng_event_rule_kernel_syscall_create_from_payload(struct lttng_payload
        enum lttng_event_rule_status status;
        const struct lttng_event_rule_kernel_syscall_comm *syscall_comm;
        const char *pattern;
-       const char *filter_expression = NULL;
+       const char *filter_expression = nullptr;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
 
        if (!_event_rule) {
                ret = -1;
@@ -478,7 +478,7 @@ skip_filter_expression:
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        lttng_event_rule_destroy(rule);
@@ -488,7 +488,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_kernel_syscall_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
-       char *pattern_copy = NULL;
+       char *pattern_copy = nullptr;
        struct lttng_event_rule_kernel_syscall *syscall;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -509,7 +509,7 @@ lttng_event_rule_kernel_syscall_set_name_pattern(struct lttng_event_rule *rule,
        free(syscall->pattern);
 
        syscall->pattern = pattern_copy;
-       pattern_copy = NULL;
+       pattern_copy = nullptr;
 end:
        return status;
 }
@@ -540,7 +540,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_kernel_syscall_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
-       char *expression_copy = NULL;
+       char *expression_copy = nullptr;
        struct lttng_event_rule_kernel_syscall *syscall;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -563,7 +563,7 @@ lttng_event_rule_kernel_syscall_set_filter(struct lttng_event_rule *rule, const
        }
 
        syscall->filter_expression = expression_copy;
-       expression_copy = NULL;
+       expression_copy = nullptr;
 end:
        return status;
 }
index f1bdecb06e9e4968cfb1bdf5fb31377ac1bf84dc..77dd51ed0c26d8540f850ffc4eef5362410cf7a4 100644 (file)
@@ -28,7 +28,7 @@ static void lttng_event_rule_kernel_tracepoint_destroy(struct lttng_event_rule *
 {
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
 
-       if (rule == NULL) {
+       if (rule == nullptr) {
                return;
        }
 
@@ -81,7 +81,7 @@ static int lttng_event_rule_kernel_tracepoint_serialize(const struct lttng_event
 
        pattern_len = strlen(tracepoint->pattern) + 1;
 
-       if (tracepoint->filter_expression != NULL) {
+       if (tracepoint->filter_expression != nullptr) {
                filter_expression_len = strlen(tracepoint->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
@@ -154,7 +154,7 @@ lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(struct lttng_event_r
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
        enum lttng_event_rule_status status;
        const char *filter;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
 
        LTTNG_ASSERT(rule);
 
@@ -162,7 +162,7 @@ lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(struct lttng_event_r
 
        status = lttng_event_rule_kernel_tracepoint_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -175,15 +175,15 @@ lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(struct lttng_event_r
 
        if (filter) {
                tracepoint->internal_filter.filter = strdup(filter);
-               if (tracepoint->internal_filter.filter == NULL) {
+               if (tracepoint->internal_filter.filter == nullptr) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto error;
                }
        } else {
-               tracepoint->internal_filter.filter = NULL;
+               tracepoint->internal_filter.filter = nullptr;
        }
 
-       if (tracepoint->internal_filter.filter == NULL) {
+       if (tracepoint->internal_filter.filter == nullptr) {
                ret_code = LTTNG_OK;
                goto end;
        }
@@ -195,7 +195,7 @@ lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(struct lttng_event_r
        }
 
        tracepoint->internal_filter.bytecode = bytecode;
-       bytecode = NULL;
+       bytecode = nullptr;
        ret_code = LTTNG_OK;
 
 error:
@@ -230,7 +230,7 @@ lttng_event_rule_kernel_tracepoint_generate_exclusions(const struct lttng_event_
                                                       struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
-       *_exclusions = NULL;
+       *_exclusions = nullptr;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
@@ -257,8 +257,8 @@ lttng_event_rule_kernel_tracepoint_mi_serialize(const struct lttng_event_rule *r
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_event_rule_status status;
-       const char *filter = NULL;
-       const char *name_pattern = NULL;
+       const char *filter = nullptr;
+       const char *name_pattern = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(writer);
@@ -286,7 +286,7 @@ lttng_event_rule_kernel_tracepoint_mi_serialize(const struct lttng_event_rule *r
        }
 
        /* Filter. */
-       if (filter != NULL) {
+       if (filter != nullptr) {
                ret = mi_lttng_writer_write_element_string(
                        writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
@@ -311,7 +311,7 @@ end:
 
 struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_kernel_tracepoint *tp_rule;
        enum lttng_event_rule_status status;
 
@@ -337,13 +337,13 @@ struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void)
        tp_rule->parent.mi_serialize = lttng_event_rule_kernel_tracepoint_mi_serialize;
 
        /* Not necessary for now. */
-       tp_rule->parent.generate_lttng_event = NULL;
+       tp_rule->parent.generate_lttng_event = nullptr;
 
        /* Default pattern is '*'. */
        status = lttng_event_rule_kernel_tracepoint_set_name_pattern(rule, "*");
        if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
 end:
@@ -358,9 +358,9 @@ lttng_event_rule_kernel_tracepoint_create_from_payload(struct lttng_payload_view
        enum lttng_event_rule_status status;
        const struct lttng_event_rule_kernel_tracepoint_comm *tracepoint_comm;
        const char *pattern;
-       const char *filter_expression = NULL;
+       const char *filter_expression = nullptr;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
 
        if (!_event_rule) {
                ret = -1;
@@ -448,7 +448,7 @@ skip_filter_expression:
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        lttng_event_rule_destroy(rule);
@@ -459,7 +459,7 @@ enum lttng_event_rule_status
 lttng_event_rule_kernel_tracepoint_set_name_pattern(struct lttng_event_rule *rule,
                                                    const char *pattern)
 {
-       char *pattern_copy = NULL;
+       char *pattern_copy = nullptr;
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -481,7 +481,7 @@ lttng_event_rule_kernel_tracepoint_set_name_pattern(struct lttng_event_rule *rul
        free(tracepoint->pattern);
 
        tracepoint->pattern = pattern_copy;
-       pattern_copy = NULL;
+       pattern_copy = nullptr;
 end:
        return status;
 }
@@ -512,7 +512,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_kernel_tracepoint_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
-       char *expression_copy = NULL;
+       char *expression_copy = nullptr;
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -535,7 +535,7 @@ lttng_event_rule_kernel_tracepoint_set_filter(struct lttng_event_rule *rule, con
        }
 
        tracepoint->filter_expression = expression_copy;
-       expression_copy = NULL;
+       expression_copy = nullptr;
 end:
        return status;
 }
index 63cc6014e5961362e0f78a3d79d858c57c7f3a36..9c4078982a2c9d66de55ec89163747e7ebe62569 100644 (file)
@@ -146,7 +146,7 @@ static const char *lttng_event_rule_kernel_uprobe_get_filter(const struct lttng_
                                                             __attribute__((unused)))
 {
        /* Unsupported. */
-       return NULL;
+       return nullptr;
 }
 
 static const struct lttng_bytecode *
@@ -154,7 +154,7 @@ lttng_event_rule_kernel_uprobe_get_filter_bytecode(const struct lttng_event_rule
                                                   __attribute__((unused)))
 {
        /* Unsupported. */
-       return NULL;
+       return nullptr;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
@@ -163,7 +163,7 @@ lttng_event_rule_kernel_uprobe_generate_exclusions(const struct lttng_event_rule
                                                   struct lttng_event_exclusion **exclusions)
 {
        /* Unsupported. */
-       *exclusions = NULL;
+       *exclusions = nullptr;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
@@ -184,7 +184,7 @@ static int userspace_probe_set_location(struct lttng_event_rule_kernel_uprobe *u
                                        const struct lttng_userspace_probe_location *location)
 {
        int ret;
-       struct lttng_userspace_probe_location *location_copy = NULL;
+       struct lttng_userspace_probe_location *location_copy = nullptr;
 
        if (!uprobe || !location || uprobe->location) {
                ret = -1;
@@ -198,7 +198,7 @@ static int userspace_probe_set_location(struct lttng_event_rule_kernel_uprobe *u
        }
 
        uprobe->location = location_copy;
-       location_copy = NULL;
+       location_copy = nullptr;
        ret = 0;
 end:
        lttng_userspace_probe_location_destroy(location_copy);
@@ -212,8 +212,8 @@ lttng_event_rule_kernel_uprobe_mi_serialize(const struct lttng_event_rule *rule,
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_event_rule_status status;
-       const char *event_name = NULL;
-       const struct lttng_userspace_probe_location *location = NULL;
+       const char *event_name = nullptr;
+       const struct lttng_userspace_probe_location *location = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(writer);
@@ -264,7 +264,7 @@ end:
 struct lttng_event_rule *
 lttng_event_rule_kernel_uprobe_create(const struct lttng_userspace_probe_location *location)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_kernel_uprobe *urule;
 
        urule = zmalloc<lttng_event_rule_kernel_uprobe>();
@@ -288,7 +288,7 @@ lttng_event_rule_kernel_uprobe_create(const struct lttng_userspace_probe_locatio
 
        if (userspace_probe_set_location(urule, location)) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
 end:
@@ -302,8 +302,8 @@ ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(struct lttng_payload_
        const struct lttng_event_rule_kernel_uprobe_comm *uprobe_comm;
        const char *name;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_userspace_probe_location *location = NULL;
+       struct lttng_event_rule *rule = nullptr;
+       struct lttng_userspace_probe_location *location = nullptr;
        enum lttng_event_rule_status status;
 
        if (!_event_rule) {
@@ -384,7 +384,7 @@ ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(struct lttng_payload_
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        lttng_userspace_probe_location_destroy(location);
@@ -427,7 +427,7 @@ lttng_event_rule_kernel_uprobe_get_location_mutable(const struct lttng_event_rul
 enum lttng_event_rule_status
 lttng_event_rule_kernel_uprobe_set_event_name(struct lttng_event_rule *rule, const char *name)
 {
-       char *name_copy = NULL;
+       char *name_copy = nullptr;
        struct lttng_event_rule_kernel_uprobe *uprobe;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -448,7 +448,7 @@ lttng_event_rule_kernel_uprobe_set_event_name(struct lttng_event_rule *rule, con
        }
 
        uprobe->name = name_copy;
-       name_copy = NULL;
+       name_copy = nullptr;
 end:
        return status;
 }
index 7ca41c124500fcdf4e65ad907f24a64950c47947..fec9589ad89d61c179b922c17e0b6887de04b21e 100644 (file)
@@ -29,7 +29,7 @@ static void lttng_event_rule_log4j_logging_destroy(struct lttng_event_rule *rule
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
 
-       if (rule == NULL) {
+       if (rule == nullptr) {
                return;
        }
 
@@ -87,7 +87,7 @@ static int lttng_event_rule_log4j_logging_serialize(const struct lttng_event_rul
 
        pattern_len = strlen(log4j_logging->pattern) + 1;
 
-       if (log4j_logging->filter_expression != NULL) {
+       if (log4j_logging->filter_expression != nullptr) {
                filter_expression_len = strlen(log4j_logging->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
@@ -178,10 +178,10 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
 {
        int err;
        int ret = 0;
-       char *agent_filter = NULL;
+       char *agent_filter = nullptr;
        const char *pattern;
        const char *filter;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
        enum lttng_event_rule_status status;
 
        LTTNG_ASSERT(rule);
@@ -195,7 +195,7 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
 
        status = lttng_event_rule_log4j_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret = -1;
                goto end;
@@ -266,7 +266,7 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
        }
 
        *_agent_filter = agent_filter;
-       agent_filter = NULL;
+       agent_filter = nullptr;
 
 end:
        free(agent_filter);
@@ -282,7 +282,7 @@ lttng_event_rule_log4j_logging_generate_filter_bytecode(struct lttng_event_rule
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status;
        const char *filter;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
        char *agent_filter;
 
        LTTNG_ASSERT(rule);
@@ -291,7 +291,7 @@ lttng_event_rule_log4j_logging_generate_filter_bytecode(struct lttng_event_rule
 
        status = lttng_event_rule_log4j_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -310,7 +310,7 @@ lttng_event_rule_log4j_logging_generate_filter_bytecode(struct lttng_event_rule
 
        log4j_logging->internal_filter.filter = agent_filter;
 
-       if (log4j_logging->internal_filter.filter == NULL) {
+       if (log4j_logging->internal_filter.filter == nullptr) {
                ret_code = LTTNG_OK;
                goto end;
        }
@@ -323,7 +323,7 @@ lttng_event_rule_log4j_logging_generate_filter_bytecode(struct lttng_event_rule
        }
 
        log4j_logging->internal_filter.bytecode = bytecode;
-       bytecode = NULL;
+       bytecode = nullptr;
        ret_code = LTTNG_OK;
 
 error:
@@ -358,7 +358,7 @@ lttng_event_rule_log4j_logging_generate_exclusions(const struct lttng_event_rule
                                                   struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
-       *_exclusions = NULL;
+       *_exclusions = nullptr;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
@@ -387,8 +387,8 @@ lttng_event_rule_log4j_logging_generate_lttng_event(const struct lttng_event_rul
 {
        int ret;
        const struct lttng_event_rule_log4j_logging *log4j_logging;
-       struct lttng_event *local_event = NULL;
-       struct lttng_event *event = NULL;
+       struct lttng_event *local_event = nullptr;
+       struct lttng_event *event = nullptr;
        enum lttng_loglevel_type loglevel_type;
        int loglevel_value = 0;
        enum lttng_event_rule_status status;
@@ -444,7 +444,7 @@ lttng_event_rule_log4j_logging_generate_lttng_event(const struct lttng_event_rul
        local_event->loglevel = loglevel_value;
 
        event = local_event;
-       local_event = NULL;
+       local_event = nullptr;
 error:
        free(local_event);
        return event;
@@ -457,9 +457,9 @@ lttng_event_rule_log4j_logging_mi_serialize(const struct lttng_event_rule *rule,
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_event_rule_status status;
-       const char *filter = NULL;
-       const char *name_pattern = NULL;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const char *filter = nullptr;
+       const char *name_pattern = nullptr;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(writer);
@@ -491,7 +491,7 @@ lttng_event_rule_log4j_logging_mi_serialize(const struct lttng_event_rule *rule,
        }
 
        /* Filter expression. */
-       if (filter != NULL) {
+       if (filter != nullptr) {
                ret = mi_lttng_writer_write_element_string(
                        writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
@@ -524,7 +524,7 @@ end:
 
 struct lttng_event_rule *lttng_event_rule_log4j_logging_create(void)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_log4j_logging *tp_rule;
        enum lttng_event_rule_status status;
 
@@ -549,13 +549,13 @@ struct lttng_event_rule *lttng_event_rule_log4j_logging_create(void)
        tp_rule->parent.generate_lttng_event = lttng_event_rule_log4j_logging_generate_lttng_event;
        tp_rule->parent.mi_serialize = lttng_event_rule_log4j_logging_mi_serialize;
 
-       tp_rule->log_level_rule = NULL;
+       tp_rule->log_level_rule = nullptr;
 
        /* Default pattern is '*'. */
        status = lttng_event_rule_log4j_logging_set_name_pattern(rule, "*");
        if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
 end:
@@ -569,10 +569,10 @@ ssize_t lttng_event_rule_log4j_logging_create_from_payload(struct lttng_payload_
        enum lttng_event_rule_status status;
        const struct lttng_event_rule_log4j_logging_comm *log4j_logging_comm;
        const char *pattern;
-       const char *filter_expression = NULL;
+       const char *filter_expression = nullptr;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_log_level_rule *log_level_rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
 
        if (!_event_rule) {
                ret = -1;
@@ -692,7 +692,7 @@ skip_log_level_rule:
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        lttng_log_level_rule_destroy(log_level_rule);
@@ -703,7 +703,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_log4j_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
-       char *pattern_copy = NULL;
+       char *pattern_copy = nullptr;
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -725,7 +725,7 @@ lttng_event_rule_log4j_logging_set_name_pattern(struct lttng_event_rule *rule, c
        free(log4j_logging->pattern);
 
        log4j_logging->pattern = pattern_copy;
-       pattern_copy = NULL;
+       pattern_copy = nullptr;
 end:
        return status;
 }
@@ -756,7 +756,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_log4j_logging_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
-       char *expression_copy = NULL;
+       char *expression_copy = nullptr;
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -778,7 +778,7 @@ lttng_event_rule_log4j_logging_set_filter(struct lttng_event_rule *rule, const c
        }
 
        log4j_logging->filter_expression = expression_copy;
-       expression_copy = NULL;
+       expression_copy = nullptr;
 end:
        return status;
 }
@@ -821,7 +821,7 @@ lttng_event_rule_log4j_logging_set_log_level_rule(struct lttng_event_rule *rule,
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-       struct lttng_log_level_rule *copy = NULL;
+       struct lttng_log_level_rule *copy = nullptr;
 
        if (!rule || !IS_LOG4J_LOGGING_EVENT_RULE(rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -836,7 +836,7 @@ lttng_event_rule_log4j_logging_set_log_level_rule(struct lttng_event_rule *rule,
        }
 
        copy = lttng_log_level_rule_copy(log_level_rule);
-       if (copy == NULL) {
+       if (copy == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
                goto end;
        }
@@ -863,7 +863,7 @@ enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_log_level_rule(
        }
 
        log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
-       if (log4j_logging->log_level_rule == NULL) {
+       if (log4j_logging->log_level_rule == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
        }
index 40e4f1f022840d039f1f514e74f21d70d83336a4..2f2187267615cc24c4a2a97da0a823b2b6753cf7 100644 (file)
@@ -29,7 +29,7 @@ static void lttng_event_rule_python_logging_destroy(struct lttng_event_rule *rul
 {
        struct lttng_event_rule_python_logging *python_logging;
 
-       if (rule == NULL) {
+       if (rule == nullptr) {
                return;
        }
 
@@ -87,7 +87,7 @@ static int lttng_event_rule_python_logging_serialize(const struct lttng_event_ru
 
        pattern_len = strlen(python_logging->pattern) + 1;
 
-       if (python_logging->filter_expression != NULL) {
+       if (python_logging->filter_expression != nullptr) {
                filter_expression_len = strlen(python_logging->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
@@ -178,10 +178,10 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
 {
        int err;
        int ret = 0;
-       char *agent_filter = NULL;
+       char *agent_filter = nullptr;
        const char *pattern;
        const char *filter;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
        enum lttng_event_rule_status status;
 
        LTTNG_ASSERT(rule);
@@ -195,7 +195,7 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
 
        status = lttng_event_rule_python_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret = -1;
                goto end;
@@ -266,7 +266,7 @@ static int generate_agent_filter(const struct lttng_event_rule *rule, char **_ag
        }
 
        *_agent_filter = agent_filter;
-       agent_filter = NULL;
+       agent_filter = nullptr;
 
 end:
        free(agent_filter);
@@ -282,7 +282,7 @@ lttng_event_rule_python_logging_generate_filter_bytecode(struct lttng_event_rule
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status;
        const char *filter;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
        char *agent_filter;
 
        LTTNG_ASSERT(rule);
@@ -291,7 +291,7 @@ lttng_event_rule_python_logging_generate_filter_bytecode(struct lttng_event_rule
 
        status = lttng_event_rule_python_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -310,7 +310,7 @@ lttng_event_rule_python_logging_generate_filter_bytecode(struct lttng_event_rule
 
        python_logging->internal_filter.filter = agent_filter;
 
-       if (python_logging->internal_filter.filter == NULL) {
+       if (python_logging->internal_filter.filter == nullptr) {
                ret_code = LTTNG_OK;
                goto end;
        }
@@ -323,7 +323,7 @@ lttng_event_rule_python_logging_generate_filter_bytecode(struct lttng_event_rule
        }
 
        python_logging->internal_filter.bytecode = bytecode;
-       bytecode = NULL;
+       bytecode = nullptr;
        ret_code = LTTNG_OK;
 
 error:
@@ -358,7 +358,7 @@ lttng_event_rule_python_logging_generate_exclusions(const struct lttng_event_rul
                                                    struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
-       *_exclusions = NULL;
+       *_exclusions = nullptr;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
@@ -387,8 +387,8 @@ lttng_event_rule_python_logging_generate_lttng_event(const struct lttng_event_ru
 {
        int ret;
        const struct lttng_event_rule_python_logging *python_logging;
-       struct lttng_event *local_event = NULL;
-       struct lttng_event *event = NULL;
+       struct lttng_event *local_event = nullptr;
+       struct lttng_event *event = nullptr;
        enum lttng_loglevel_type loglevel_type;
        int loglevel_value = 0;
        enum lttng_event_rule_status status;
@@ -444,7 +444,7 @@ lttng_event_rule_python_logging_generate_lttng_event(const struct lttng_event_ru
        local_event->loglevel = loglevel_value;
 
        event = local_event;
-       local_event = NULL;
+       local_event = nullptr;
 error:
        free(local_event);
        return event;
@@ -457,9 +457,9 @@ lttng_event_rule_python_logging_mi_serialize(const struct lttng_event_rule *rule
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_event_rule_status status;
-       const char *filter = NULL;
-       const char *name_pattern = NULL;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const char *filter = nullptr;
+       const char *name_pattern = nullptr;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
 
        LTTNG_ASSERT(rule);
        LTTNG_ASSERT(writer);
@@ -491,7 +491,7 @@ lttng_event_rule_python_logging_mi_serialize(const struct lttng_event_rule *rule
        }
 
        /* Filter expression. */
-       if (filter != NULL) {
+       if (filter != nullptr) {
                ret = mi_lttng_writer_write_element_string(
                        writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
@@ -524,7 +524,7 @@ end:
 
 struct lttng_event_rule *lttng_event_rule_python_logging_create(void)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_python_logging *tp_rule;
        enum lttng_event_rule_status status;
 
@@ -549,13 +549,13 @@ struct lttng_event_rule *lttng_event_rule_python_logging_create(void)
        tp_rule->parent.generate_lttng_event = lttng_event_rule_python_logging_generate_lttng_event;
        tp_rule->parent.mi_serialize = lttng_event_rule_python_logging_mi_serialize;
 
-       tp_rule->log_level_rule = NULL;
+       tp_rule->log_level_rule = nullptr;
 
        /* Default pattern is '*'. */
        status = lttng_event_rule_python_logging_set_name_pattern(rule, "*");
        if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
 end:
@@ -569,10 +569,10 @@ ssize_t lttng_event_rule_python_logging_create_from_payload(struct lttng_payload
        enum lttng_event_rule_status status;
        const struct lttng_event_rule_python_logging_comm *python_logging_comm;
        const char *pattern;
-       const char *filter_expression = NULL;
+       const char *filter_expression = nullptr;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_log_level_rule *log_level_rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
 
        if (!_event_rule) {
                ret = -1;
@@ -692,7 +692,7 @@ skip_log_level_rule:
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        lttng_log_level_rule_destroy(log_level_rule);
@@ -703,7 +703,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_python_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
-       char *pattern_copy = NULL;
+       char *pattern_copy = nullptr;
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -725,7 +725,7 @@ lttng_event_rule_python_logging_set_name_pattern(struct lttng_event_rule *rule,
        free(python_logging->pattern);
 
        python_logging->pattern = pattern_copy;
-       pattern_copy = NULL;
+       pattern_copy = nullptr;
 end:
        return status;
 }
@@ -756,7 +756,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_python_logging_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
-       char *expression_copy = NULL;
+       char *expression_copy = nullptr;
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -779,7 +779,7 @@ lttng_event_rule_python_logging_set_filter(struct lttng_event_rule *rule, const
        }
 
        python_logging->filter_expression = expression_copy;
-       expression_copy = NULL;
+       expression_copy = nullptr;
 end:
        return status;
 }
@@ -823,7 +823,7 @@ enum lttng_event_rule_status lttng_event_rule_python_logging_set_log_level_rule(
 {
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-       struct lttng_log_level_rule *copy = NULL;
+       struct lttng_log_level_rule *copy = nullptr;
 
        if (!rule || !IS_PYTHON_LOGGING_EVENT_RULE(rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -838,7 +838,7 @@ enum lttng_event_rule_status lttng_event_rule_python_logging_set_log_level_rule(
        }
 
        copy = lttng_log_level_rule_copy(log_level_rule);
-       if (copy == NULL) {
+       if (copy == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
                goto end;
        }
@@ -865,7 +865,7 @@ enum lttng_event_rule_status lttng_event_rule_python_logging_get_log_level_rule(
        }
 
        python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
-       if (python_logging->log_level_rule == NULL) {
+       if (python_logging->log_level_rule == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
        }
index 39018f5a3e9cdaded1a177a02980f54ba3bc4971..20993e12b397b36e1dc41d5feae78e0ab515bfc8 100644 (file)
@@ -29,7 +29,7 @@ static void lttng_event_rule_user_tracepoint_destroy(struct lttng_event_rule *ru
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
 
-       if (rule == NULL) {
+       if (rule == nullptr) {
                return;
        }
 
@@ -95,7 +95,7 @@ static int lttng_event_rule_user_tracepoint_serialize(const struct lttng_event_r
 
        pattern_len = strlen(tracepoint->pattern) + 1;
 
-       if (tracepoint->filter_expression != NULL) {
+       if (tracepoint->filter_expression != nullptr) {
                filter_expression_len = strlen(tracepoint->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
@@ -253,7 +253,7 @@ lttng_event_rule_user_tracepoint_generate_filter_bytecode(struct lttng_event_rul
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status;
        const char *filter;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
 
        LTTNG_ASSERT(rule);
 
@@ -261,7 +261,7 @@ lttng_event_rule_user_tracepoint_generate_filter_bytecode(struct lttng_event_rul
 
        status = lttng_event_rule_user_tracepoint_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
+               filter = nullptr;
        } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -274,15 +274,15 @@ lttng_event_rule_user_tracepoint_generate_filter_bytecode(struct lttng_event_rul
 
        if (filter) {
                tracepoint->internal_filter.filter = strdup(filter);
-               if (tracepoint->internal_filter.filter == NULL) {
+               if (tracepoint->internal_filter.filter == nullptr) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto error;
                }
        } else {
-               tracepoint->internal_filter.filter = NULL;
+               tracepoint->internal_filter.filter = nullptr;
        }
 
-       if (tracepoint->internal_filter.filter == NULL) {
+       if (tracepoint->internal_filter.filter == nullptr) {
                ret_code = LTTNG_OK;
                goto end;
        }
@@ -294,7 +294,7 @@ lttng_event_rule_user_tracepoint_generate_filter_bytecode(struct lttng_event_rul
        }
 
        tracepoint->internal_filter.bytecode = bytecode;
-       bytecode = NULL;
+       bytecode = nullptr;
        ret_code = LTTNG_OK;
 
 error:
@@ -339,7 +339,7 @@ lttng_event_rule_user_tracepoint_generate_exclusions(const struct lttng_event_ru
        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
        if (nb_exclusions == 0) {
                /* Nothing to do. */
-               exclusions = NULL;
+               exclusions = nullptr;
                ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
                goto end;
        }
@@ -367,7 +367,7 @@ lttng_event_rule_user_tracepoint_generate_exclusions(const struct lttng_event_ru
                                         sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i)));
                if (copy_ret) {
                        free(exclusions);
-                       exclusions = NULL;
+                       exclusions = nullptr;
                        ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_ERROR;
                        goto end;
                }
@@ -427,9 +427,9 @@ lttng_event_rule_user_tracepoint_mi_serialize(const struct lttng_event_rule *rul
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_event_rule_status status;
-       const char *filter = NULL;
-       const char *name_pattern = NULL;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const char *filter = nullptr;
+       const char *name_pattern = nullptr;
+       const struct lttng_log_level_rule *log_level_rule = nullptr;
        unsigned int exclusion_count = 0;
 
        LTTNG_ASSERT(rule);
@@ -466,7 +466,7 @@ lttng_event_rule_user_tracepoint_mi_serialize(const struct lttng_event_rule *rul
        }
 
        /* Filter expression. */
-       if (filter != NULL) {
+       if (filter != nullptr) {
                ret = mi_lttng_writer_write_element_string(
                        writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
@@ -534,7 +534,7 @@ end:
 
 struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void)
 {
-       struct lttng_event_rule *rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
        struct lttng_event_rule_user_tracepoint *tp_rule;
        enum lttng_event_rule_status status;
 
@@ -559,9 +559,9 @@ struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void)
        tp_rule->parent.mi_serialize = lttng_event_rule_user_tracepoint_mi_serialize;
 
        /* Not necessary for now. */
-       tp_rule->parent.generate_lttng_event = NULL;
+       tp_rule->parent.generate_lttng_event = nullptr;
 
-       tp_rule->log_level_rule = NULL;
+       tp_rule->log_level_rule = nullptr;
 
        lttng_dynamic_pointer_array_init(&tp_rule->exclusions, destroy_lttng_exclusions_element);
 
@@ -569,7 +569,7 @@ struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void)
        status = lttng_event_rule_user_tracepoint_set_name_pattern(rule, "*");
        if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                lttng_event_rule_destroy(rule);
-               rule = NULL;
+               rule = nullptr;
        }
 
 end:
@@ -584,13 +584,13 @@ ssize_t lttng_event_rule_user_tracepoint_create_from_payload(struct lttng_payloa
        enum lttng_event_rule_status status;
        const struct lttng_event_rule_user_tracepoint_comm *tracepoint_comm;
        const char *pattern;
-       const char *filter_expression = NULL;
-       const char **exclusions = NULL;
+       const char *filter_expression = nullptr;
+       const char **exclusions = nullptr;
        const uint32_t *exclusion_len;
        const char *exclusion;
        struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_log_level_rule *log_level_rule = NULL;
+       struct lttng_event_rule *rule = nullptr;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
 
        if (!_event_rule) {
                ret = -1;
@@ -747,7 +747,7 @@ skip_log_level_rule:
        }
 
        *_event_rule = rule;
-       rule = NULL;
+       rule = nullptr;
        ret = offset;
 end:
        free(exclusions);
@@ -760,7 +760,7 @@ enum lttng_event_rule_status
 lttng_event_rule_user_tracepoint_set_name_pattern(struct lttng_event_rule *rule,
                                                  const char *pattern)
 {
-       char *pattern_copy = NULL;
+       char *pattern_copy = nullptr;
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -782,7 +782,7 @@ lttng_event_rule_user_tracepoint_set_name_pattern(struct lttng_event_rule *rule,
        free(tracepoint->pattern);
 
        tracepoint->pattern = pattern_copy;
-       pattern_copy = NULL;
+       pattern_copy = nullptr;
 end:
        return status;
 }
@@ -813,7 +813,7 @@ end:
 enum lttng_event_rule_status
 lttng_event_rule_user_tracepoint_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
-       char *expression_copy = NULL;
+       char *expression_copy = nullptr;
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -836,7 +836,7 @@ lttng_event_rule_user_tracepoint_set_filter(struct lttng_event_rule *rule, const
        }
 
        tracepoint->filter_expression = expression_copy;
-       expression_copy = NULL;
+       expression_copy = nullptr;
 end:
        return status;
 }
@@ -903,7 +903,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_log_level_rule
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-       struct lttng_log_level_rule *copy = NULL;
+       struct lttng_log_level_rule *copy = nullptr;
 
        if (!rule || !IS_USER_TRACEPOINT_EVENT_RULE(rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -918,7 +918,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_log_level_rule
        }
 
        copy = lttng_log_level_rule_copy(log_level_rule);
-       if (copy == NULL) {
+       if (copy == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
                goto end;
        }
@@ -945,7 +945,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_log_level_rule
        }
 
        tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
-       if (tracepoint->log_level_rule == NULL) {
+       if (tracepoint->log_level_rule == nullptr) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
        }
@@ -960,7 +960,7 @@ lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(struct lttng_event_r
                                                            const char *exclusion)
 {
        int ret;
-       char *exclusion_copy = NULL;
+       char *exclusion_copy = nullptr;
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -988,7 +988,7 @@ lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(struct lttng_event_r
                goto end;
        }
 
-       exclusion_copy = NULL;
+       exclusion_copy = nullptr;
 end:
        free(exclusion_copy);
        return status;
index 49e1b136d860b9440838ac992385e2cbe1c99b72..b00cda83b7db462793952a323fbfbd277069253a 100644 (file)
@@ -67,7 +67,7 @@ end:
        return new_event;
 error:
        free(new_event);
-       new_event = NULL;
+       new_event = nullptr;
        goto end;
 }
 
@@ -141,7 +141,7 @@ lttng_event_probe_attr_create_from_payload(struct lttng_payload_view *view,
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_probe_attr_comm *comm;
-       struct lttng_event_probe_attr *local_attr = NULL;
+       struct lttng_event_probe_attr *local_attr = nullptr;
        struct lttng_payload_view comm_view =
                lttng_payload_view_from_view(view, offset, sizeof(*comm));
 
@@ -154,7 +154,7 @@ lttng_event_probe_attr_create_from_payload(struct lttng_payload_view *view,
        offset += sizeof(*comm);
 
        local_attr = zmalloc<lttng_event_probe_attr>();
-       if (local_attr == NULL) {
+       if (local_attr == nullptr) {
                ret = -1;
                goto end;
        }
@@ -190,7 +190,7 @@ lttng_event_probe_attr_create_from_payload(struct lttng_payload_view *view,
        }
 
        *probe_attr = local_attr;
-       local_attr = NULL;
+       local_attr = nullptr;
        ret = offset;
 end:
        free(local_attr);
@@ -203,7 +203,7 @@ lttng_event_function_attr_create_from_payload(struct lttng_payload_view *view,
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_function_attr_comm *comm;
-       struct lttng_event_function_attr *local_attr = NULL;
+       struct lttng_event_function_attr *local_attr = nullptr;
        struct lttng_payload_view comm_view =
                lttng_payload_view_from_view(view, offset, sizeof(*comm));
 
@@ -216,7 +216,7 @@ lttng_event_function_attr_create_from_payload(struct lttng_payload_view *view,
        offset += sizeof(*comm);
 
        local_attr = zmalloc<lttng_event_function_attr>();
-       if (local_attr == NULL) {
+       if (local_attr == nullptr) {
                ret = -1;
                goto end;
        }
@@ -249,7 +249,7 @@ lttng_event_function_attr_create_from_payload(struct lttng_payload_view *view,
        }
 
        *function_attr = local_attr;
-       local_attr = NULL;
+       local_attr = nullptr;
        ret = offset;
 end:
        free(local_attr);
@@ -315,7 +315,7 @@ static ssize_t lttng_event_exclusions_create_from_payload(struct lttng_payload_v
        }
 
        *exclusions = local_exclusions;
-       local_exclusions = NULL;
+       local_exclusions = nullptr;
        ret = offset;
 end:
        free(local_exclusions);
@@ -329,14 +329,14 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
                                        struct lttng_bytecode **out_bytecode)
 {
        ssize_t ret, offset = 0;
-       struct lttng_event *local_event = NULL;
-       struct lttng_event_exclusion *local_exclusions = NULL;
-       struct lttng_bytecode *local_bytecode = NULL;
-       char *local_filter_expression = NULL;
+       struct lttng_event *local_event = nullptr;
+       struct lttng_event_exclusion *local_exclusions = nullptr;
+       struct lttng_bytecode *local_bytecode = nullptr;
+       char *local_filter_expression = nullptr;
        const struct lttng_event_comm *event_comm;
-       struct lttng_event_function_attr *local_function_attr = NULL;
-       struct lttng_event_probe_attr *local_probe_attr = NULL;
-       struct lttng_userspace_probe_location *local_userspace_probe_location = NULL;
+       struct lttng_event_function_attr *local_function_attr = nullptr;
+       struct lttng_event_probe_attr *local_probe_attr = nullptr;
+       struct lttng_userspace_probe_location *local_userspace_probe_location = nullptr;
 
        /*
         * Only event is obligatory, the other output argument are optional and
@@ -360,7 +360,7 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
        }
 
        local_event = lttng_event_create();
-       if (local_event == NULL) {
+       if (local_event == nullptr) {
                ret = -1;
                goto end;
        }
@@ -612,7 +612,7 @@ deserialize_event_type_payload:
                 * Userspace probe location object ownership transfered to the
                 * event object.
                 */
-               local_userspace_probe_location = NULL;
+               local_userspace_probe_location = nullptr;
                offset += event_comm->userspace_probe_location_len;
                break;
        }
@@ -633,21 +633,21 @@ deserialize_event_type_payload:
 
        /* Transfer ownership to the caller. */
        *out_event = local_event;
-       local_event = NULL;
+       local_event = nullptr;
 
        if (out_bytecode) {
                *out_bytecode = local_bytecode;
-               local_bytecode = NULL;
+               local_bytecode = nullptr;
        }
 
        if (out_exclusion) {
                *out_exclusion = local_exclusions;
-               local_exclusions = NULL;
+               local_exclusions = nullptr;
        }
 
        if (out_filter_expression) {
                *out_filter_expression = local_filter_expression;
-               local_filter_expression = NULL;
+               local_filter_expression = nullptr;
        }
 
        ret = offset;
@@ -858,7 +858,7 @@ static ssize_t lttng_event_context_app_populate_from_payload(const struct lttng_
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_context_app_comm *comm;
-       char *provider_name = NULL, *context_name = NULL;
+       char *provider_name = nullptr, *context_name = nullptr;
        size_t provider_name_len, context_name_len;
        const struct lttng_buffer_view comm_view =
                lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
@@ -941,8 +941,8 @@ static ssize_t lttng_event_context_app_populate_from_payload(const struct lttng_
        /* Transfer ownership of the strings */
        event_ctx->u.app_ctx.provider_name = provider_name;
        event_ctx->u.app_ctx.ctx_name = context_name;
-       provider_name = NULL;
-       context_name = NULL;
+       provider_name = nullptr;
+       context_name = nullptr;
 
        ret = offset;
 end:
@@ -1018,7 +1018,7 @@ ssize_t lttng_event_context_create_from_payload(struct lttng_payload_view *view,
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_context_comm *comm;
-       struct lttng_event_context *local_context = NULL;
+       struct lttng_event_context *local_context = nullptr;
        struct lttng_buffer_view comm_view =
                lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
 
@@ -1070,7 +1070,7 @@ ssize_t lttng_event_context_create_from_payload(struct lttng_payload_view *view,
        offset += ret;
 
        *event_ctx = local_context;
-       local_context = NULL;
+       local_context = nullptr;
        ret = offset;
 
 end:
@@ -1246,17 +1246,17 @@ static void lttng_event_field_populate_lttng_event_from_event(const struct lttng
        memcpy(destination, src, sizeof(*destination));
 
        /* Remove all possible dynamic data from the destination event rule. */
-       destination->extended.ptr = NULL;
+       destination->extended.ptr = nullptr;
 }
 
 ssize_t lttng_event_field_create_from_payload(struct lttng_payload_view *view,
                                              struct lttng_event_field **field)
 {
        ssize_t ret, offset = 0;
-       struct lttng_event_field *local_event_field = NULL;
-       struct lttng_event *event = NULL;
+       struct lttng_event_field *local_event_field = nullptr;
+       struct lttng_event *event = nullptr;
        const struct lttng_event_field_comm *comm;
-       const char *name = NULL;
+       const char *name = nullptr;
 
        assert(field);
        assert(view);
@@ -1320,7 +1320,8 @@ ssize_t lttng_event_field_create_from_payload(struct lttng_payload_view *view,
                        goto end;
                }
 
-               ret = lttng_event_create_from_payload(&event_view, &event, NULL, NULL, NULL);
+               ret = lttng_event_create_from_payload(
+                       &event_view, &event, nullptr, nullptr, nullptr);
                if (ret != comm->event_len) {
                        ret = -1;
                        goto end;
@@ -1341,7 +1342,7 @@ ssize_t lttng_event_field_create_from_payload(struct lttng_payload_view *view,
        lttng_event_field_populate_lttng_event_from_event(event, &local_event_field->event);
 
        *field = local_event_field;
-       local_event_field = NULL;
+       local_event_field = nullptr;
        ret = offset;
 end:
        lttng_event_destroy(event);
@@ -1392,7 +1393,7 @@ int lttng_event_field_serialize(const struct lttng_event_field *field,
        }
 
        size_before_event = payload->buffer.size;
-       ret = lttng_event_serialize(&field->event, 0, NULL, NULL, 0, 0, payload);
+       ret = lttng_event_serialize(&field->event, 0, nullptr, nullptr, 0, nullptr, payload);
        if (ret) {
                ret = -1;
                goto end;
@@ -1429,11 +1430,11 @@ static enum lttng_error_code compute_flattened_size(struct lttng_dynamic_pointer
                const struct event_list_element *element =
                        (const struct event_list_element *) lttng_dynamic_pointer_array_get_pointer(
                                events, i);
-               const struct lttng_userspace_probe_location *location = NULL;
+               const struct lttng_userspace_probe_location *location = nullptr;
 
                location = lttng_event_get_userspace_probe_location(element->event);
                if (location) {
-                       ret = lttng_userspace_probe_location_flatten(location, NULL);
+                       ret = lttng_userspace_probe_location_flatten(location, nullptr);
                        if (ret < 0) {
                                ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL;
                                goto end;
@@ -1543,7 +1544,7 @@ static enum lttng_error_code flatten_lttng_events(struct lttng_dynamic_pointer_a
                struct lttng_event_extended *event_extended =
                        (struct lttng_event_extended *) (local_flattened_events.data +
                                                         local_flattened_events.size);
-               const struct lttng_userspace_probe_location *location = NULL;
+               const struct lttng_userspace_probe_location *location = nullptr;
 
                assert(element);
 
@@ -1662,7 +1663,7 @@ event_list_create_from_payload(struct lttng_payload_view *view,
                                                             &element->event,
                                                             &element->exclusions,
                                                             &element->filter_expression,
-                                                            NULL);
+                                                            nullptr);
                if (event_size < 0) {
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
@@ -1782,7 +1783,7 @@ event_field_list_create_from_payload(struct lttng_payload_view *view,
        enum lttng_error_code ret_code;
        int ret, offset = 0;
        unsigned int i;
-       struct lttng_dynamic_pointer_array *list = NULL;
+       struct lttng_dynamic_pointer_array *list = nullptr;
 
        assert(view);
        assert(event_field_list);
@@ -1797,7 +1798,7 @@ event_field_list_create_from_payload(struct lttng_payload_view *view,
 
        for (i = 0; i < count; i++) {
                ssize_t event_field_size;
-               struct lttng_event_field *field = NULL;
+               struct lttng_event_field *field = nullptr;
                struct lttng_payload_view event_field_view =
                        lttng_payload_view_from_view(view, offset, -1);
 
@@ -1824,7 +1825,7 @@ event_field_list_create_from_payload(struct lttng_payload_view *view,
        }
 
        *event_field_list = list;
-       list = NULL;
+       list = nullptr;
        ret_code = LTTNG_OK;
 
 end:
@@ -1840,7 +1841,7 @@ enum lttng_error_code lttng_event_fields_create_and_flatten_from_payload(
        struct lttng_payload_view *view, unsigned int count, struct lttng_event_field **fields)
 {
        enum lttng_error_code ret_code;
-       struct lttng_dynamic_pointer_array *local_event_fields = NULL;
+       struct lttng_dynamic_pointer_array *local_event_fields = nullptr;
 
        ret_code = event_field_list_create_from_payload(view, count, &local_event_fields);
        if (ret_code != LTTNG_OK) {
index 6bc1e9b5246e4ab3d6a7bfa0ef342e9c94edf065..6cf382757cb01cd9f2792b17b1da81375482681e 100644 (file)
@@ -34,7 +34,7 @@ static void fd_handle_release(struct urcu_ref *ref)
 
 struct fd_handle *fd_handle_create(int fd)
 {
-       struct fd_handle *handle = NULL;
+       struct fd_handle *handle = nullptr;
 
        if (fd < 0) {
                ERR("Attempted to create an fd_handle from an invalid file descriptor: fd = %d",
@@ -81,7 +81,7 @@ int fd_handle_get_fd(struct fd_handle *handle)
 
 struct fd_handle *fd_handle_copy(const struct fd_handle *handle)
 {
-       struct fd_handle *new_handle = NULL;
+       struct fd_handle *new_handle = nullptr;
        const int new_fd = dup(handle->fd);
 
        if (new_fd < 0) {
index a6239277d9df0aa8ec6a44c5c52d54567e1d5310..e610118e9a8d1a3217d24b9cd7ce0ec42159af64 100644 (file)
@@ -195,7 +195,7 @@ static struct unsuspendable_fd *unsuspendable_fd_create(const char *name, int fd
        return entry;
 error:
        unsuspendable_fd_destroy(entry);
-       return NULL;
+       return nullptr;
 }
 
 static void fs_handle_tracked_log(struct fs_handle_tracked *handle)
@@ -203,7 +203,7 @@ static void fs_handle_tracked_log(struct fs_handle_tracked *handle)
        const char *path;
 
        pthread_mutex_lock(&handle->lock);
-       lttng_inode_borrow_location(handle->inode, NULL, &path);
+       lttng_inode_borrow_location(handle->inode, nullptr, &path);
 
        if (handle->fd >= 0) {
                DBG_NO_LOC("    %s [active, fd %d%s]",
@@ -360,7 +360,7 @@ struct fd_tracker *fd_tracker_create(const char *unlinked_file_path, unsigned in
 
        pthread_mutex_lock(&seed.lock);
        if (!seed.initialized) {
-               seed.value = (unsigned long) time(NULL);
+               seed.value = (unsigned long) time(nullptr);
                seed.initialized = true;
        }
        pthread_mutex_unlock(&seed.lock);
@@ -369,7 +369,7 @@ struct fd_tracker *fd_tracker_create(const char *unlinked_file_path, unsigned in
        CDS_INIT_LIST_HEAD(&tracker->suspended_handles);
        tracker->capacity = capacity;
        tracker->unsuspendable_fds = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!tracker->unsuspendable_fds) {
                ERR("Failed to create fd-tracker's unsuspendable_fds hash table");
                goto error;
@@ -390,7 +390,7 @@ end:
        return tracker;
 error:
        fd_tracker_destroy(tracker);
-       return NULL;
+       return nullptr;
 }
 
 void fd_tracker_log(struct fd_tracker *tracker)
@@ -462,7 +462,7 @@ int fd_tracker_destroy(struct fd_tracker *tracker)
        pthread_mutex_unlock(&tracker->lock);
 
        if (tracker->unsuspendable_fds) {
-               ret = cds_lfht_destroy(tracker->unsuspendable_fds, NULL);
+               ret = cds_lfht_destroy(tracker->unsuspendable_fds, nullptr);
                LTTNG_ASSERT(!ret);
        }
 
@@ -481,7 +481,7 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
                                            mode_t *mode)
 {
        int ret;
-       struct fs_handle_tracked *handle = NULL;
+       struct fs_handle_tracked *handle = nullptr;
        struct stat fd_stat;
        struct open_properties properties = { .flags = flags,
                                              .mode = {
@@ -522,7 +522,7 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
 
        handle->tracker = tracker;
 
-       ret = pthread_mutex_init(&handle->lock, NULL);
+       ret = pthread_mutex_init(&handle->lock, nullptr);
        if (ret) {
                PERROR("Failed to initialize handle mutex while creating fs handle");
                goto error_mutex_init;
@@ -552,7 +552,7 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
        fd_tracker_track(tracker, handle);
 end:
        pthread_mutex_unlock(&tracker->lock);
-       return handle ? &handle->parent : NULL;
+       return handle ? &handle->parent : nullptr;
 error:
        if (handle->inode) {
                lttng_inode_put(handle->inode);
@@ -560,7 +560,7 @@ error:
        pthread_mutex_destroy(&handle->lock);
 error_mutex_init:
        free(handle);
-       handle = NULL;
+       handle = nullptr;
        goto end;
 }
 
@@ -641,7 +641,7 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
         */
        for (i = 0; i < fd_count; i++) {
                struct unsuspendable_fd *entry =
-                       unsuspendable_fd_create(names ? names[i] : NULL, out_fds[i]);
+                       unsuspendable_fd_create(names ? names[i] : nullptr, out_fds[i]);
 
                if (!entry) {
                        ret = -1;
@@ -667,7 +667,7 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
                        rcu_read_unlock();
                        goto end_free_entries;
                }
-               entries[i] = NULL;
+               entries[i] = nullptr;
        }
        tracker->count.unsuspendable += fd_count;
        rcu_read_unlock();
@@ -691,7 +691,7 @@ int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
                                      void *user_data)
 {
        int i, ret, user_ret;
-       int *fds = NULL;
+       int *fds = nullptr;
 
        /*
         * Maintain a local copy of fds_in as the user's callback may modify its
@@ -860,10 +860,10 @@ static int fs_handle_tracked_unlink(struct fs_handle *_handle)
 static int fs_handle_tracked_close(struct fs_handle *_handle)
 {
        int ret = 0;
-       const char *path = NULL;
+       const char *path = nullptr;
        struct fs_handle_tracked *handle =
                lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
-       struct lttng_directory_handle *inode_directory_handle = NULL;
+       struct lttng_directory_handle *inode_directory_handle = nullptr;
 
        if (!handle) {
                ret = -EINVAL;
@@ -873,7 +873,7 @@ static int fs_handle_tracked_close(struct fs_handle *_handle)
        pthread_mutex_lock(&handle->tracker->lock);
        pthread_mutex_lock(&handle->lock);
        if (handle->inode) {
-               lttng_inode_borrow_location(handle->inode, NULL, &path);
+               lttng_inode_borrow_location(handle->inode, nullptr, &path);
                /*
                 * Here a reference to the inode's directory handle is acquired
                 * to prevent the last reference to it from being released while
index b21a82d8731e6d56c7015aba95a87102a45d0e42..6555e97a311b10067bed7a495d49f17f58628dd5 100644 (file)
@@ -152,14 +152,14 @@ static int lttng_unlinked_file_pool_add_inode(struct lttng_unlinked_file_pool *p
        }
 
        lttng_directory_handle_put(inode->location.directory_handle);
-       inode->location.directory_handle = NULL;
+       inode->location.directory_handle = nullptr;
        reference_acquired = lttng_directory_handle_get(pool->unlink_directory_handle);
        LTTNG_ASSERT(reference_acquired);
        inode->location.directory_handle = pool->unlink_directory_handle;
 
        free(inode->location.path);
        inode->location.path = inode_unlinked_name;
-       inode_unlinked_name = NULL;
+       inode_unlinked_name = nullptr;
        LTTNG_OPTIONAL_SET(&inode->unlinked_id, unlinked_id);
        pool->file_count++;
 end:
@@ -183,9 +183,9 @@ static int lttng_unlinked_file_pool_remove_inode(struct lttng_unlinked_file_pool
                goto end;
        }
        free(inode->location.path);
-       inode->location.path = NULL;
+       inode->location.path = nullptr;
        lttng_directory_handle_put(inode->location.directory_handle);
-       inode->location.directory_handle = NULL;
+       inode->location.directory_handle = nullptr;
 
        pool->file_count--;
        if (pool->file_count == 0) {
@@ -199,7 +199,7 @@ static int lttng_unlinked_file_pool_remove_inode(struct lttng_unlinked_file_pool
                               pool->unlink_directory_path);
                }
                lttng_directory_handle_put(pool->unlink_directory_handle);
-               pool->unlink_directory_handle = NULL;
+               pool->unlink_directory_handle = nullptr;
        }
 end:
        return ret;
@@ -228,9 +228,9 @@ static void lttng_inode_destroy(struct lttng_inode *inode)
        }
 
        lttng_directory_handle_put(inode->location.directory_handle);
-       inode->location.directory_handle = NULL;
+       inode->location.directory_handle = nullptr;
        free(inode->location.path);
-       inode->location.path = NULL;
+       inode->location.path = nullptr;
        call_rcu(&inode->rcu_head, lttng_inode_free);
 }
 
@@ -267,7 +267,7 @@ struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(const char *pat
        return pool;
 error:
        lttng_unlinked_file_pool_destroy(pool);
-       return NULL;
+       return nullptr;
 }
 
 void lttng_unlinked_file_pool_destroy(struct lttng_unlinked_file_pool *pool)
@@ -372,7 +372,7 @@ int lttng_inode_rename(struct lttng_inode *inode,
        inode->location.directory_handle = new_directory_handle;
        /* Ownership transferred. */
        inode->location.path = new_path_copy;
-       new_path_copy = NULL;
+       new_path_copy = nullptr;
 end:
        free(new_path_copy);
        return ret;
@@ -412,7 +412,7 @@ static struct lttng_inode *lttng_inode_create(const struct inode_id *id,
                                              struct lttng_directory_handle *directory_handle,
                                              const char *path)
 {
-       struct lttng_inode *inode = NULL;
+       struct lttng_inode *inode = nullptr;
        char *path_copy;
        bool reference_acquired;
 
@@ -436,14 +436,14 @@ static struct lttng_inode *lttng_inode_create(const struct inode_id *id,
        inode->unlinked_file_pool = unlinked_file_pool;
        /* Ownership of path copy is transferred to inode. */
        inode->location.path = path_copy;
-       path_copy = NULL;
+       path_copy = nullptr;
        inode->location.directory_handle = directory_handle;
 end:
        free(path_copy);
        return inode;
 }
 
-struct lttng_inode_registry *lttng_inode_registry_create(void)
+struct lttng_inode_registry *lttng_inode_registry_create()
 {
        struct lttng_inode_registry *registry = zmalloc<lttng_inode_registry>();
 
@@ -453,13 +453,13 @@ struct lttng_inode_registry *lttng_inode_registry_create(void)
 
        pthread_mutex_lock(&seed.lock);
        if (!seed.initialized) {
-               seed.value = (unsigned long) time(NULL);
+               seed.value = (unsigned long) time(nullptr);
                seed.initialized = true;
        }
        pthread_mutex_unlock(&seed.lock);
 
        registry->inodes = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!registry->inodes) {
                goto error;
        }
@@ -467,7 +467,7 @@ end:
        return registry;
 error:
        lttng_inode_registry_destroy(registry);
-       return NULL;
+       return nullptr;
 }
 
 void lttng_inode_registry_destroy(struct lttng_inode_registry *registry)
@@ -476,7 +476,7 @@ void lttng_inode_registry_destroy(struct lttng_inode_registry *registry)
                return;
        }
        if (registry->inodes) {
-               int ret = cds_lfht_destroy(registry->inodes, NULL);
+               int ret = cds_lfht_destroy(registry->inodes, nullptr);
 
                LTTNG_ASSERT(!ret);
        }
@@ -495,7 +495,7 @@ lttng_inode_registry_get_inode(struct lttng_inode_registry *registry,
        struct inode_id id;
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
-       struct lttng_inode *inode = NULL;
+       struct lttng_inode *inode = nullptr;
 
        ret = fstat(fd, &statbuf);
        if (ret < 0) {
index 9d28e87cd98ba0ebb2a5a65222ca2672e0cf570d..408c5afc65756fcb92172c16db0b810dcc514cf7 100644 (file)
@@ -49,7 +49,7 @@ int fd_tracker_util_pipe_open_cloexec(struct fd_tracker *tracker, const char *na
        }
 
        ret = fd_tracker_open_unsuspendable_fd(
-               tracker, pipe, (const char **) names, 2, open_pipe_cloexec, NULL);
+               tracker, pipe, (const char **) names, 2, open_pipe_cloexec, nullptr);
        free(names[0]);
        free(names[1]);
 end:
@@ -58,7 +58,7 @@ end:
 
 int fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe)
 {
-       return fd_tracker_close_unsuspendable_fd(tracker, pipe, 2, close_pipe, NULL);
+       return fd_tracker_close_unsuspendable_fd(tracker, pipe, 2, close_pipe, nullptr);
 }
 
 namespace {
@@ -73,7 +73,7 @@ static int open_directory_handle(void *_args, int *out_fds)
 {
        int ret = 0;
        struct open_directory_handle_args *args = (open_directory_handle_args *) _args;
-       struct lttng_directory_handle *new_handle = NULL;
+       struct lttng_directory_handle *new_handle = nullptr;
 
        new_handle = args->in_handle ?
                lttng_directory_handle_create_from_handle(args->path, args->in_handle) :
@@ -119,7 +119,7 @@ static void directory_handle_destroy(struct lttng_directory_handle *handle, void
 {
        struct fd_tracker *tracker = (fd_tracker *) data;
        const int ret =
-               fd_tracker_close_unsuspendable_fd(tracker, &handle->dirfd, 1, fd_close, NULL);
+               fd_tracker_close_unsuspendable_fd(tracker, &handle->dirfd, 1, fd_close, nullptr);
 
        if (ret) {
                ERR("Failed to untrack directory handle file descriptor");
@@ -130,7 +130,7 @@ static void directory_handle_destroy(struct lttng_directory_handle *handle, void
 struct lttng_directory_handle *fd_tracker_create_directory_handle(struct fd_tracker *tracker,
                                                                  const char *path)
 {
-       return fd_tracker_create_directory_handle_from_handle(tracker, NULL, path);
+       return fd_tracker_create_directory_handle_from_handle(tracker, nullptr, path);
 }
 
 struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle(
@@ -138,9 +138,9 @@ struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle(
 {
        int ret;
        int dirfd = -1;
-       char *handle_name = NULL;
+       char *handle_name = nullptr;
        char cwd_path[LTTNG_PATH_MAX] = "working directory";
-       struct lttng_directory_handle *new_handle = NULL;
+       struct lttng_directory_handle *new_handle = nullptr;
        open_directory_handle_args open_args{};
 
        open_args.in_handle = in_handle;
index 9bda86731b500d77a136f5e0ac69877e5f7af296..54c2e182a1bb352e5395990ae486be093d5ef4e9 100644 (file)
@@ -27,8 +27,7 @@ public:
 
        file_descriptor(const file_descriptor&) = delete;
 
-       file_descriptor(file_descriptor&& other) : _raw_fd{-1}
-       {
+       file_descriptor(file_descriptor&& other) noexcept {
                LTTNG_ASSERT(_is_valid_fd(_raw_fd));
                std::swap(_raw_fd, other._raw_fd);
        }
@@ -57,7 +56,7 @@ private:
                return fd >= 0;
        }
 
-       int _raw_fd;
+       int _raw_fd = -1;
 };
 
 } /* namespace lttng */
index 6a943a2d0640d855bfc25ab57b02b9ba98b39aa0..39e403dfbafd7132fdee9914a269ea5e35d55593 100644 (file)
@@ -17,7 +17,7 @@ struct bytecode_symbol_iterator {
 
 struct bytecode_symbol_iterator *bytecode_symbol_iterator_create(struct lttng_bytecode *bytecode)
 {
-       struct bytecode_symbol_iterator *it = NULL;
+       struct bytecode_symbol_iterator *it = nullptr;
 
        if (!bytecode) {
                goto end;
@@ -68,7 +68,7 @@ end:
 
 const char *bytecode_symbol_iterator_get_name(struct bytecode_symbol_iterator *it)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!it) {
                goto end;
index 020766eb5ddd788dfd7c8114a6bd993e7817cfdf..b586fd489f8f934f8ace25808c7e19ce2acd4fe9 100644 (file)
@@ -30,7 +30,8 @@ struct formatter<std::type_info> : formatter<std::string> {
        typename FormatCtx::iterator format(const std::type_info& type_info, FormatCtx& ctx)
        {
                int status;
-               auto demangled_name = abi::__cxa_demangle(type_info.name(), nullptr, 0, &status);
+               auto demangled_name =
+                       abi::__cxa_demangle(type_info.name(), nullptr, nullptr, &status);
                auto it = status == 0 ? formatter<std::string>::format(demangled_name, ctx) :
                                        formatter<std::string>::format(type_info.name(), ctx);
 
index 1b9f7fc9288cae694e21cad369ffc87dc7ea174e..b0e01fc73d4d8d4a6cbec6e669958fe80fa94b5e 100644 (file)
@@ -42,7 +42,7 @@ void futex_wait_update(int32_t *futex, int active)
 {
        if (active) {
                uatomic_set(futex, 1);
-               if (futex_async(futex, FUTEX_WAKE, INT_MAX, NULL, NULL, 0) < 0) {
+               if (futex_async(futex, FUTEX_WAKE, INT_MAX, nullptr, nullptr, 0) < 0) {
                        PERROR("futex_async");
                        abort();
                }
@@ -72,7 +72,7 @@ void futex_nto1_wait(int32_t *futex)
        cmm_smp_mb();
 
        while (uatomic_read(futex) == -1) {
-               if (!futex_async(futex, FUTEX_WAIT, -1, NULL, NULL, 0)) {
+               if (!futex_async(futex, FUTEX_WAIT, -1, nullptr, nullptr, 0)) {
                        /*
                         * Prior queued wakeups queued by unrelated code
                         * using the same address can cause futex wait to
@@ -108,7 +108,7 @@ void futex_nto1_wake(int32_t *futex)
        if (caa_unlikely(uatomic_read(futex) != -1))
                goto end;
        uatomic_set(futex, 0);
-       if (futex_async(futex, FUTEX_WAKE, 1, NULL, NULL, 0) < 0) {
+       if (futex_async(futex, FUTEX_WAKE, 1, nullptr, nullptr, 0) < 0) {
                PERROR("futex_async");
                abort();
        }
index 840a7347936dabb11132eb56b838f961bf3e9bfb..6497da5f56af9701b43938e06fec839cf76e6b4c 100644 (file)
@@ -104,13 +104,13 @@ struct lttng_ht *lttng_ht_new(unsigned long size, lttng_ht_type type)
 
        pthread_mutex_lock(&seed_lock);
        if (!seed_init) {
-               lttng_ht_seed = (unsigned long) time(NULL);
+               lttng_ht_seed = (unsigned long) time(nullptr);
                seed_init = true;
        }
        pthread_mutex_unlock(&seed_lock);
 
        ht = zmalloc<lttng_ht>();
-       if (ht == NULL) {
+       if (ht == nullptr) {
                PERROR("zmalloc lttng_ht");
                goto error;
        }
@@ -119,7 +119,7 @@ struct lttng_ht *lttng_ht_new(unsigned long size, lttng_ht_type type)
                              min_hash_alloc_size,
                              max_hash_buckets_size,
                              CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
-                             NULL);
+                             nullptr);
        /*
         * There is already an assert in the RCU hashtable code so if the ht is
         * NULL here there is a *huge* problem.
@@ -154,7 +154,7 @@ struct lttng_ht *lttng_ht_new(unsigned long size, lttng_ht_type type)
        return ht;
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -164,7 +164,7 @@ void lttng_ht_destroy(struct lttng_ht *ht)
 {
        int ret;
 
-       ret = cds_lfht_destroy(ht->ht, NULL);
+       ret = cds_lfht_destroy(ht->ht, nullptr);
        LTTNG_ASSERT(!ret);
        free(ht);
 }
@@ -410,7 +410,7 @@ struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
                                        &node->node);
        rcu_read_unlock();
        if (!node_ptr) {
-               return NULL;
+               return nullptr;
        } else {
                return lttng::utils::container_of(node_ptr, &lttng_ht_node_ulong::node);
        }
@@ -437,7 +437,7 @@ struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht,
                                        &node->node);
        rcu_read_unlock();
        if (!node_ptr) {
-               return NULL;
+               return nullptr;
        } else {
                return lttng::utils::container_of(node_ptr, &lttng_ht_node_u64::node);
        }
@@ -515,7 +515,7 @@ struct lttng_ht_node_str *lttng_ht_iter_get_node_str(struct lttng_ht_iter *iter)
        LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
-               return NULL;
+               return nullptr;
        }
        return lttng::utils::container_of(node, &lttng_ht_node_str::node);
 }
@@ -530,7 +530,7 @@ struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(struct lttng_ht_iter *i
        LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
-               return NULL;
+               return nullptr;
        }
        return lttng::utils::container_of(node, &lttng_ht_node_ulong::node);
 }
@@ -545,7 +545,7 @@ struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(struct lttng_ht_iter *iter)
        LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
-               return NULL;
+               return nullptr;
        }
        return lttng::utils::container_of(node, &lttng_ht_node_u64::node);
 }
@@ -560,7 +560,7 @@ struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64(struct lttng_ht_ite
        LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
-               return NULL;
+               return nullptr;
        }
        return lttng::utils::container_of(node, &lttng_ht_node_two_u64::node);
 }
index 7682131e760e5aa53ad5bd7dd99ee1168214a031..1969ea44c5e2629ca147d270abb99731b2e23bd3 100644 (file)
@@ -66,14 +66,14 @@ struct health_app *health_app_create(int nr_types)
 
        ha = zmalloc<health_app>();
        if (!ha) {
-               return NULL;
+               return nullptr;
        }
        ha->flags = calloc<health_flags>(nr_types);
        if (!ha->flags) {
                goto error_flags;
        }
        CDS_INIT_LIST_HEAD(&ha->list);
-       pthread_mutex_init(&ha->lock, NULL);
+       pthread_mutex_init(&ha->lock, nullptr);
        ha->nr_types = nr_types;
        ha->time_delta.tv_sec = DEFAULT_HEALTH_CHECK_DELTA_S;
        ha->time_delta.tv_nsec = DEFAULT_HEALTH_CHECK_DELTA_NS;
@@ -82,7 +82,7 @@ struct health_app *health_app_create(int nr_types)
 
 error_flags:
        free(ha);
-       return NULL;
+       return nullptr;
 }
 
 void health_app_destroy(struct health_app *ha)
index c4f790ddbd729b4f7284f9bb8987801abb1b9f7f..c0bb8a1c4188d19f7e99cdc341a6b0e165df4117 100644 (file)
@@ -29,7 +29,7 @@ struct lttng_index {
 
 struct lttng_index_allocator *lttng_index_allocator_create(uint64_t index_count)
 {
-       struct lttng_index_allocator *allocator = NULL;
+       struct lttng_index_allocator *allocator = nullptr;
 
        allocator = zmalloc<lttng_index_allocator>();
        if (!allocator) {
@@ -82,7 +82,7 @@ end:
 enum lttng_index_allocator_status
 lttng_index_allocator_release(struct lttng_index_allocator *allocator, uint64_t idx)
 {
-       struct lttng_index *index = NULL;
+       struct lttng_index *index = nullptr;
        enum lttng_index_allocator_status status = LTTNG_INDEX_ALLOCATOR_STATUS_OK;
 
        LTTNG_ASSERT(idx < allocator->size);
@@ -104,7 +104,7 @@ end:
 
 void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator)
 {
-       struct lttng_index *index = NULL, *tmp_index = NULL;
+       struct lttng_index *index = nullptr, *tmp_index = nullptr;
 
        if (!allocator) {
                return;
index b1c828303ab8ae05f5d3e01ec952a4260f5be20f..863a4c52b0d3781f47fd1e4fab144e658fcccbef 100644 (file)
@@ -40,7 +40,7 @@ _lttng_index_file_create_from_trace_chunk(struct lttng_trace_chunk *chunk,
        struct lttng_index_file *index_file;
        enum lttng_trace_chunk_status chunk_status;
        int ret;
-       struct fs_handle *fs_handle = NULL;
+       struct fs_handle *fs_handle = nullptr;
        ssize_t size_ret;
        struct ctf_packet_index_file_hdr hdr;
        char index_directory_path[LTTNG_PATH_MAX];
index a9b65960b591081bd29e3bf333927c3b5b3f5559..11f4e5193e8cb6e8681fd6dd0f1253d8b811a81f 100644 (file)
@@ -63,7 +63,7 @@ int config_get_section_entries(const char *override_path,
 {
        int ret = 0;
        const char *path;
-       FILE *config_file = NULL;
+       FILE *config_file = nullptr;
        struct handler_filter_args filter = { section, handler, user_data };
 
        /* First, try system-wide conf. file. */
index 978b185fac98073f6e5beccdb952822cc301d183..cca38f8ca7c9a693c65bfade4cbd0e60ee429dba 100644 (file)
@@ -117,7 +117,7 @@ int ini_parse_file(FILE *file, ini_entry_handler handler, void *user)
 #endif
 
        /* Scan through file line by line */
-       while (fgets(line, INI_MAX_LINE, file) != NULL) {
+       while (fgets(line, INI_MAX_LINE, file) != nullptr) {
                lineno++;
 
                start = line;
index c40f3b6947ed72f3f4ae735022e3d3994398b770..3b42438d8826a1d2e246cf2c403a92107f699d79 100644 (file)
@@ -406,15 +406,15 @@ static int lttng_kconsumer_snapshot_metadata(struct lttng_consumer_channel *meta
                        }
                        metadata_stream->out_fd = -1;
                        lttng_trace_chunk_put(metadata_stream->trace_chunk);
-                       metadata_stream->trace_chunk = NULL;
+                       metadata_stream->trace_chunk = nullptr;
                }
        }
 
        ret = 0;
 error_snapshot:
        metadata_stream->read_subbuffer_ops.unlock(metadata_stream);
-       consumer_stream_destroy(metadata_stream, NULL);
-       metadata_channel->metadata_stream = NULL;
+       consumer_stream_destroy(metadata_stream, nullptr);
+       metadata_channel->metadata_stream = nullptr;
        rcu_read_unlock();
        return ret;
 }
@@ -496,23 +496,23 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                health_code_update();
 
                DBG("consumer_add_channel %" PRIu64, msg.u.channel.channel_key);
-               new_channel =
-                       consumer_allocate_channel(msg.u.channel.channel_key,
-                                                 msg.u.channel.session_id,
-                                                 msg.u.channel.chunk_id.is_set ? &chunk_id : NULL,
-                                                 msg.u.channel.pathname,
-                                                 msg.u.channel.name,
-                                                 msg.u.channel.relayd_id,
-                                                 msg.u.channel.output,
-                                                 msg.u.channel.tracefile_size,
-                                                 msg.u.channel.tracefile_count,
-                                                 0,
-                                                 msg.u.channel.monitor,
-                                                 msg.u.channel.live_timer_interval,
-                                                 msg.u.channel.is_live,
-                                                 NULL,
-                                                 NULL);
-               if (new_channel == NULL) {
+               new_channel = consumer_allocate_channel(msg.u.channel.channel_key,
+                                                       msg.u.channel.session_id,
+                                                       msg.u.channel.chunk_id.is_set ? &chunk_id :
+                                                                                       nullptr,
+                                                       msg.u.channel.pathname,
+                                                       msg.u.channel.name,
+                                                       msg.u.channel.relayd_id,
+                                                       msg.u.channel.output,
+                                                       msg.u.channel.tracefile_size,
+                                                       msg.u.channel.tracefile_count,
+                                                       0,
+                                                       msg.u.channel.monitor,
+                                                       msg.u.channel.live_timer_interval,
+                                                       msg.u.channel.is_live,
+                                                       nullptr,
+                                                       nullptr);
+               if (new_channel == nullptr) {
                        lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR);
                        goto end_nosignal;
                }
@@ -542,7 +542,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                health_code_update();
 
-               if (ctx->on_recv_channel != NULL) {
+               if (ctx->on_recv_channel != nullptr) {
                        int ret_recv_channel = ctx->on_recv_channel(new_channel);
                        if (ret_recv_channel == 0) {
                                ret_add_channel = consumer_add_channel(new_channel, ctx);
@@ -663,7 +663,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                                    &alloc_ret,
                                                    channel->type,
                                                    channel->monitor);
-               if (new_stream == NULL) {
+               if (new_stream == nullptr) {
                        switch (alloc_ret) {
                        case -ENOMEM:
                        case -EINVAL:
@@ -880,7 +880,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                /* Get relayd reference if exists. */
                relayd = consumer_find_relayd(index);
-               if (relayd == NULL) {
+               if (relayd == nullptr) {
                        DBG("Unable to find relayd %" PRIu64, index);
                        ret_code = LTTCOMM_CONSUMERD_RELAYD_FAIL;
                }
@@ -1246,8 +1246,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                const uint64_t relayd_id = msg.u.create_trace_chunk.relayd_id.value;
                const char *chunk_override_name = *msg.u.create_trace_chunk.override_name ?
                        msg.u.create_trace_chunk.override_name :
-                       NULL;
-               struct lttng_directory_handle *chunk_directory_handle = NULL;
+                       nullptr;
+               struct lttng_directory_handle *chunk_directory_handle = nullptr;
 
                /*
                 * The session daemon will only provide a chunk directory file
@@ -1284,12 +1284,12 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
 
                ret_code = lttng_consumer_create_trace_chunk(
-                       !is_local_trace ? &relayd_id : NULL,
+                       !is_local_trace ? &relayd_id : nullptr,
                        msg.u.create_trace_chunk.session_id,
                        msg.u.create_trace_chunk.chunk_id,
                        (time_t) msg.u.create_trace_chunk.creation_timestamp,
                        chunk_override_name,
-                       msg.u.create_trace_chunk.credentials.is_set ? &credentials : NULL,
+                       msg.u.create_trace_chunk.credentials.is_set ? &credentials : nullptr,
                        chunk_directory_handle);
                lttng_directory_handle_put(chunk_directory_handle);
                goto end_msg_sessiond;
@@ -1304,11 +1304,11 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                ssize_t ret_send;
 
                ret_code = lttng_consumer_close_trace_chunk(
-                       msg.u.close_trace_chunk.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.close_trace_chunk.relayd_id.is_set ? &relayd_id : nullptr,
                        msg.u.close_trace_chunk.session_id,
                        msg.u.close_trace_chunk.chunk_id,
                        (time_t) msg.u.close_trace_chunk.close_timestamp,
-                       msg.u.close_trace_chunk.close_command.is_set ? &close_command : NULL,
+                       msg.u.close_trace_chunk.close_command.is_set ? &close_command : nullptr,
                        path);
                reply.ret_code = ret_code;
                reply.path_length = strlen(path) + 1;
@@ -1327,7 +1327,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                const uint64_t relayd_id = msg.u.trace_chunk_exists.relayd_id.value;
 
                ret_code = lttng_consumer_trace_chunk_exists(
-                       msg.u.trace_chunk_exists.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.trace_chunk_exists.relayd_id.is_set ? &relayd_id : nullptr,
                        msg.u.trace_chunk_exists.session_id,
                        msg.u.trace_chunk_exists.chunk_id);
                goto end_msg_sessiond;
@@ -1689,7 +1689,7 @@ static int put_next_subbuffer(struct lttng_consumer_stream *stream,
 
 static bool is_get_next_check_metadata_available(int tracer_fd)
 {
-       const int ret = kernctl_get_next_subbuf_metadata_check(tracer_fd, NULL);
+       const int ret = kernctl_get_next_subbuf_metadata_check(tracer_fd, nullptr);
        const bool available = ret != -ENOTTY;
 
        if (ret == 0) {
@@ -1732,7 +1732,7 @@ static int lttng_kconsumer_set_stream_ops(struct lttng_consumer_stream *stream)
                         */
                        WARN("Kernel tracer does not support get_next_subbuffer_metadata_check which may cause live clients to fail to parse the metadata stream");
                        metadata_bucket_destroy(stream->metadata_bucket);
-                       stream->metadata_bucket = NULL;
+                       stream->metadata_bucket = nullptr;
                }
 
                stream->read_subbuffer_ops.on_sleep = signal_metadata;
@@ -1790,7 +1790,7 @@ int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
                stream->mmap_len = (size_t) mmap_len;
 
                stream->mmap_base =
-                       mmap(NULL, stream->mmap_len, PROT_READ, MAP_PRIVATE, stream->wait_fd, 0);
+                       mmap(nullptr, stream->mmap_len, PROT_READ, MAP_PRIVATE, stream->wait_fd, 0);
                if (stream->mmap_base == MAP_FAILED) {
                        PERROR("Error mmaping");
                        ret = -1;
index 5d66acec4e73c9299a37b17fa1c649ce264118a5..d3a97ce843f5bd860a8967c2ac9a64bd3ee0e631 100644 (file)
@@ -155,7 +155,7 @@ int kernctl_create_channel(int fd, struct lttng_channel_attr *chops)
 
 int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits)
 {
-       struct lttng_kernel_abi_syscall_mask kmask_len, *kmask = NULL;
+       struct lttng_kernel_abi_syscall_mask kmask_len, *kmask = nullptr;
        size_t array_alloc_len;
        char *new_mask;
        int ret = 0;
index db900331ee3ddeabbb20bdcb80d796de14e30fe9..daf0dc005edf204f649bd8fe57a613018fe5d02f 100644 (file)
@@ -69,7 +69,7 @@ lttng_kernel_probe_location_address_destroy(struct lttng_kernel_probe_location *
 
 static void lttng_kernel_probe_location_symbol_destroy(struct lttng_kernel_probe_location *location)
 {
-       struct lttng_kernel_probe_location_symbol *location_symbol = NULL;
+       struct lttng_kernel_probe_location_symbol *location_symbol = nullptr;
 
        LTTNG_ASSERT(location);
 
@@ -102,7 +102,7 @@ void lttng_kernel_probe_location_destroy(struct lttng_kernel_probe_location *loc
 
 struct lttng_kernel_probe_location *lttng_kernel_probe_location_address_create(uint64_t address)
 {
-       struct lttng_kernel_probe_location *ret = NULL;
+       struct lttng_kernel_probe_location *ret = nullptr;
        struct lttng_kernel_probe_location_address *location;
 
        location = zmalloc<lttng_kernel_probe_location_address>();
@@ -127,8 +127,8 @@ end:
 struct lttng_kernel_probe_location *
 lttng_kernel_probe_location_symbol_create(const char *symbol_name, uint64_t offset)
 {
-       char *symbol_name_copy = NULL;
-       struct lttng_kernel_probe_location *ret = NULL;
+       char *symbol_name_copy = nullptr;
+       struct lttng_kernel_probe_location *ret = nullptr;
        struct lttng_kernel_probe_location_symbol *location;
 
        if (!symbol_name || strlen(symbol_name) >= LTTNG_SYMBOL_NAME_LEN) {
@@ -191,7 +191,7 @@ end:
 const char *
 lttng_kernel_probe_location_symbol_get_name(const struct lttng_kernel_probe_location *location)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
        struct lttng_kernel_probe_location_symbol *symbol_location;
 
        if (!location ||
@@ -580,9 +580,9 @@ end:
 static struct lttng_kernel_probe_location *
 lttng_kernel_probe_location_symbol_copy(const struct lttng_kernel_probe_location *location)
 {
-       struct lttng_kernel_probe_location *new_location = NULL;
+       struct lttng_kernel_probe_location *new_location = nullptr;
        enum lttng_kernel_probe_location_status status;
-       const char *symbol_name = NULL;
+       const char *symbol_name = nullptr;
        uint64_t offset;
 
        LTTNG_ASSERT(location);
@@ -607,14 +607,14 @@ lttng_kernel_probe_location_symbol_copy(const struct lttng_kernel_probe_location
        goto end;
 
 error:
-       new_location = NULL;
+       new_location = nullptr;
 end:
        return new_location;
 }
 static struct lttng_kernel_probe_location *
 lttng_kernel_probe_location_address_copy(const struct lttng_kernel_probe_location *location)
 {
-       struct lttng_kernel_probe_location *new_location = NULL;
+       struct lttng_kernel_probe_location *new_location = nullptr;
        enum lttng_kernel_probe_location_status status;
        uint64_t address;
 
@@ -634,7 +634,7 @@ lttng_kernel_probe_location_address_copy(const struct lttng_kernel_probe_locatio
        goto end;
 
 error:
-       new_location = NULL;
+       new_location = nullptr;
 end:
        return new_location;
 }
@@ -642,7 +642,7 @@ end:
 struct lttng_kernel_probe_location *
 lttng_kernel_probe_location_copy(const struct lttng_kernel_probe_location *location)
 {
-       struct lttng_kernel_probe_location *new_location = NULL;
+       struct lttng_kernel_probe_location *new_location = nullptr;
        enum lttng_kernel_probe_location_type type;
 
        if (!location) {
@@ -664,7 +664,7 @@ lttng_kernel_probe_location_copy(const struct lttng_kernel_probe_location *locat
                }
                break;
        default:
-               new_location = NULL;
+               new_location = nullptr;
                goto err;
        }
 err:
@@ -726,7 +726,7 @@ lttng_kernel_probe_location_symbol_mi_serialize(const struct lttng_kernel_probe_
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_kernel_probe_location_status status;
-       const char *name = NULL;
+       const char *name = nullptr;
        uint64_t offset;
 
        LTTNG_ASSERT(location);
index 7d9a95a711c31e98db842ce19b04bea1b2cd6984..cd4b03a47cdb7c76c0e1928c76e8b25a30f72cba 100644 (file)
@@ -65,7 +65,7 @@ void lttng_trace_archive_location_put(struct lttng_trace_archive_location *locat
 struct lttng_trace_archive_location *
 lttng_trace_archive_location_local_create(const char *absolute_path)
 {
-       struct lttng_trace_archive_location *location = NULL;
+       struct lttng_trace_archive_location *location = nullptr;
 
        if (!absolute_path) {
                goto end;
@@ -85,7 +85,7 @@ end:
        return location;
 error:
        lttng_trace_archive_location_put(location);
-       return NULL;
+       return nullptr;
 }
 
 struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
@@ -95,7 +95,7 @@ struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
        uint16_t data_port,
        const char *relative_path)
 {
-       struct lttng_trace_archive_location *location = NULL;
+       struct lttng_trace_archive_location *location = nullptr;
 
        if (!host || !relative_path) {
                goto end;
@@ -122,7 +122,7 @@ end:
        return location;
 error:
        lttng_trace_archive_location_put(location);
-       return NULL;
+       return nullptr;
 }
 
 ssize_t
index 36ff3d153d29e5a3c160744eeb86edfd078cc6e8..6673ddc8d3504a7c40b496fd277f0274f3d7743c 100644 (file)
@@ -40,7 +40,7 @@ lttng_log_level_rule_get_type(const struct lttng_log_level_rule *rule)
 
 struct lttng_log_level_rule *lttng_log_level_rule_exactly_create(int level)
 {
-       struct lttng_log_level_rule *rule = NULL;
+       struct lttng_log_level_rule *rule = nullptr;
 
        rule = zmalloc<lttng_log_level_rule>();
        if (!rule) {
@@ -71,7 +71,7 @@ end:
 
 struct lttng_log_level_rule *lttng_log_level_rule_at_least_as_severe_as_create(int level)
 {
-       struct lttng_log_level_rule *rule = NULL;
+       struct lttng_log_level_rule *rule = nullptr;
 
        rule = zmalloc<lttng_log_level_rule>();
        if (!rule) {
@@ -111,7 +111,7 @@ ssize_t lttng_log_level_rule_create_from_payload(struct lttng_payload_view *view
 {
        ssize_t ret;
        size_t offset = 0;
-       struct lttng_log_level_rule *rule = NULL;
+       struct lttng_log_level_rule *rule = nullptr;
        const struct lttng_log_level_rule_comm *comm =
                (const struct lttng_log_level_rule_comm *) view->buffer.data;
 
@@ -179,13 +179,13 @@ bool lttng_log_level_rule_is_equal(const struct lttng_log_level_rule *a,
 {
        bool is_equal = false;
 
-       if (a == NULL && b == NULL) {
+       if (a == nullptr && b == nullptr) {
                /* Both are null. */
                is_equal = true;
                goto end;
        }
 
-       if (a == NULL || b == NULL) {
+       if (a == nullptr || b == nullptr) {
                /* One is NULL.*/
                goto end;
        }
@@ -212,7 +212,7 @@ end:
 
 struct lttng_log_level_rule *lttng_log_level_rule_copy(const struct lttng_log_level_rule *source)
 {
-       struct lttng_log_level_rule *copy = NULL;
+       struct lttng_log_level_rule *copy = nullptr;
 
        LTTNG_ASSERT(source);
 
@@ -287,7 +287,7 @@ enum lttng_error_code lttng_log_level_rule_mi_serialize(const struct lttng_log_l
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_log_level_rule_status status;
-       const char *element_str = NULL;
+       const char *element_str = nullptr;
        int level;
 
        LTTNG_ASSERT(rule);
index 4fa711102ce5cd1a0f262cdcbeb395bebab52806..108686042db85ae66fb46b9383754be8ac7c5bdc 100644 (file)
@@ -343,7 +343,7 @@ error:
  */
 static char *lttng_elf_get_section_name(struct lttng_elf *elf, off_t offset)
 {
-       char *name = NULL;
+       char *name = nullptr;
        size_t name_length = 0, to_read; /* name_length does not include \0 */
 
        if (!elf) {
@@ -407,14 +407,14 @@ end:
 
 error:
        free(name);
-       return NULL;
+       return nullptr;
 }
 
 static int lttng_elf_validate_and_populate(struct lttng_elf *elf)
 {
        uint8_t version;
        uint8_t e_ident[EI_NIDENT];
-       uint8_t *magic_number = NULL;
+       uint8_t *magic_number = nullptr;
        int ret = 0;
 
        if (elf->fd == -1) {
@@ -509,7 +509,7 @@ static int lttng_elf_validate_and_populate(struct lttng_elf *elf)
 
 free_elf_error:
        free(elf->ehdr);
-       elf->ehdr = NULL;
+       elf->ehdr = nullptr;
 end:
        return ret;
 }
@@ -523,7 +523,7 @@ end:
 static struct lttng_elf *lttng_elf_create(int fd)
 {
        struct lttng_elf_shdr section_names_shdr;
-       struct lttng_elf *elf = NULL;
+       struct lttng_elf *elf = nullptr;
        int ret;
        struct stat stat_buf;
 
@@ -581,7 +581,7 @@ error:
                }
                free(elf);
        }
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -667,7 +667,7 @@ static char *lttng_elf_get_section_data(struct lttng_elf *elf, struct lttng_elf_
 free_error:
        free(data);
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -744,13 +744,13 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
        int sym_count = 0;
        int sym_idx = 0;
        uint64_t addr = 0;
-       char *curr_sym_str = NULL;
-       char *symbol_table_data = NULL;
-       char *string_table_data = NULL;
-       const char *string_table_name = NULL;
+       char *curr_sym_str = nullptr;
+       char *symbol_table_data = nullptr;
+       char *string_table_data = nullptr;
+       const char *string_table_name = nullptr;
        struct lttng_elf_shdr symtab_hdr;
        struct lttng_elf_shdr strtab_hdr;
-       struct lttng_elf *elf = NULL;
+       struct lttng_elf *elf = nullptr;
 
        if (!symbol || !offset) {
                ret = LTTNG_ERR_ELF_PARSING;
@@ -787,7 +787,7 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
 
        /* Get the data associated with the symbol table section. */
        symbol_table_data = lttng_elf_get_section_data(elf, &symtab_hdr);
-       if (symbol_table_data == NULL) {
+       if (symbol_table_data == nullptr) {
                DBG("Cannot get ELF Symbol Table data.");
                ret = LTTNG_ERR_ELF_PARSING;
                goto destroy_elf;
@@ -802,7 +802,7 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
 
        /* Get the data associated with the string table section. */
        string_table_data = lttng_elf_get_section_data(elf, &strtab_hdr);
-       if (string_table_data == NULL) {
+       if (string_table_data == nullptr) {
                DBG("Cannot get ELF string table section data.");
                ret = LTTNG_ERR_ELF_PARSING;
                goto free_symbol_table_data;
@@ -905,13 +905,13 @@ int lttng_elf_get_sdt_probe_offsets(int fd,
 {
        int ret = 0, nb_match = 0;
        struct lttng_elf_shdr stap_note_section_hdr;
-       struct lttng_elf *elf = NULL;
-       char *stap_note_section_data = NULL;
+       struct lttng_elf *elf = nullptr;
+       char *stap_note_section_data = nullptr;
        char *curr_note_section_begin, *curr_data_ptr, *curr_probe, *curr_provider;
        char *next_note_ptr;
        uint32_t name_size, desc_size, note_type;
        uint64_t curr_probe_location, curr_probe_offset, curr_semaphore_location;
-       uint64_t *probe_locs = NULL, *new_probe_locs = NULL;
+       uint64_t *probe_locs = nullptr, *new_probe_locs = nullptr;
 
        if (!provider_name || !probe_name || !nb_probes || !offsets) {
                DBG("Invalid arguments.");
@@ -936,7 +936,7 @@ int lttng_elf_get_sdt_probe_offsets(int fd,
 
        /* Get the data associated with the stap note section. */
        stap_note_section_data = lttng_elf_get_section_data(elf, &stap_note_section_hdr);
-       if (stap_note_section_data == NULL) {
+       if (stap_note_section_data == nullptr) {
                DBG("Cannot get ELF stap note section data.");
                ret = LTTNG_ERR_ELF_PARSING;
                goto destroy_elf_error;
@@ -945,8 +945,8 @@ int lttng_elf_get_sdt_probe_offsets(int fd,
        next_note_ptr = stap_note_section_data;
        curr_note_section_begin = stap_note_section_data;
 
-       *offsets = NULL;
-       while (1) {
+       *offsets = nullptr;
+       while (true) {
                curr_data_ptr = next_note_ptr;
                /* Check if we have reached the end of the note section. */
                if (curr_data_ptr >= curr_note_section_begin + stap_note_section_hdr.sh_size) {
@@ -1041,7 +1041,7 @@ int lttng_elf_get_sdt_probe_offsets(int fd,
                                goto realloc_error;
                        }
                        probe_locs = new_probe_locs;
-                       new_probe_locs = NULL;
+                       new_probe_locs = nullptr;
 
                        /*
                         * Use the virtual address of the probe to compute the offset of
index ac15b7687e2418b5d8d4e692ebcb345c053af80b..6d4f16bc6581ff3667407f6b46e7955c8f2feb25 100644 (file)
@@ -599,7 +599,7 @@ static const char *mi_lttng_event_contexttype_string(enum lttng_event_context_ty
        case LTTNG_EVENT_CONTEXT_VSGID:
                return config_event_context_vsgid;
        default:
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -635,7 +635,7 @@ const char *mi_lttng_domaintype_string(enum lttng_domain_type value)
        default:
                /* Should not have an unknown domain */
                abort();
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -651,7 +651,7 @@ const char *mi_lttng_buffertype_string(enum lttng_buffer_type value)
        default:
                /* Should not have an unknow buffer type */
                abort();
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -669,7 +669,7 @@ const char *mi_lttng_rotation_state_string(enum lttng_rotation_state value)
        default:
                /* Should not have an unknow rotation state. */
                abort();
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -682,7 +682,7 @@ const char *mi_lttng_trace_archive_location_relay_protocol_type_string(
        default:
                /* Should not have an unknown relay protocol. */
                abort();
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -710,7 +710,7 @@ end:
 
 err_destroy:
        free(mi_writer);
-       return NULL;
+       return nullptr;
 }
 
 int mi_lttng_writer_destroy(struct mi_writer *writer)
index 694223e92008cbc494bd439628afc9a85a2b4e64..b024a0c090935a49fce2682e54e80d17511ae239 100644 (file)
@@ -18,7 +18,7 @@
 struct lttng_notification *lttng_notification_create(struct lttng_trigger *trigger,
                                                     struct lttng_evaluation *evaluation)
 {
-       struct lttng_notification *notification = NULL;
+       struct lttng_notification *notification = nullptr;
 
        if (!trigger || !evaluation) {
                goto end;
@@ -74,8 +74,8 @@ ssize_t lttng_notification_create_from_payload(struct lttng_payload_view *src_vi
                                               struct lttng_notification **notification)
 {
        ssize_t ret, notification_size = 0, trigger_size, evaluation_size;
-       struct lttng_trigger *trigger = NULL;
-       struct lttng_evaluation *evaluation = NULL;
+       struct lttng_trigger *trigger = nullptr;
+       struct lttng_evaluation *evaluation = nullptr;
        const struct lttng_notification_comm *notification_comm;
        const struct lttng_payload_view notification_comm_view =
                lttng_payload_view_from_view(src_view, 0, sizeof(*notification_comm));
@@ -159,34 +159,34 @@ void lttng_notification_destroy(struct lttng_notification *notification)
 const struct lttng_condition *
 lttng_notification_get_condition(struct lttng_notification *notification)
 {
-       return notification ? lttng_trigger_get_const_condition(notification->trigger) : NULL;
+       return notification ? lttng_trigger_get_const_condition(notification->trigger) : nullptr;
 }
 
 const struct lttng_evaluation *
 lttng_notification_get_evaluation(struct lttng_notification *notification)
 {
-       return notification ? notification->evaluation : NULL;
+       return notification ? notification->evaluation : nullptr;
 }
 
 const struct lttng_condition *
 lttng_notification_get_const_condition(const struct lttng_notification *notification)
 {
-       return notification ? lttng_trigger_get_const_condition(notification->trigger) : NULL;
+       return notification ? lttng_trigger_get_const_condition(notification->trigger) : nullptr;
 }
 
 const struct lttng_evaluation *
 lttng_notification_get_const_evaluation(const struct lttng_notification *notification)
 {
-       return notification ? notification->evaluation : NULL;
+       return notification ? notification->evaluation : nullptr;
 }
 
 const struct lttng_trigger *
 lttng_notification_get_const_trigger(const struct lttng_notification *notification)
 {
-       return notification ? notification->trigger : NULL;
+       return notification ? notification->trigger : nullptr;
 }
 
 const struct lttng_trigger *lttng_notification_get_trigger(struct lttng_notification *notification)
 {
-       return notification ? notification->trigger : NULL;
+       return notification ? notification->trigger : nullptr;
 }
index cc7cbbc469c0c0c530f79db032bc8353ebc7e20d..14611c2164812245f0d0a2c48a6675e80db40610 100644 (file)
  */
 static char *utils_partial_realpath(const char *path)
 {
-       char *cut_path = NULL, *try_path = NULL, *try_path_prev = NULL;
+       char *cut_path = nullptr, *try_path = nullptr, *try_path_prev = nullptr;
        const char *next, *prev, *end;
-       char *resolved_path = NULL;
+       char *resolved_path = nullptr;
 
        /* Safety net */
-       if (path == NULL) {
+       if (path == nullptr) {
                goto error;
        }
 
@@ -50,21 +50,21 @@ static char *utils_partial_realpath(const char *path)
        try_path = (char *) next;
 
        /* Resolve the canonical path of the first part of the path */
-       while (try_path != NULL && next != end) {
-               char *try_path_buf = NULL;
+       while (try_path != nullptr && next != end) {
+               char *try_path_buf = nullptr;
 
                /*
                 * If there is not any '/' left, we want to try with
                 * the full path
                 */
                next = strpbrk(next + 1, "/");
-               if (next == NULL) {
+               if (next == nullptr) {
                        next = end;
                }
 
                /* Cut the part we will be trying to resolve */
                cut_path = lttng_strndup(path, next - path);
-               if (cut_path == NULL) {
+               if (cut_path == nullptr) {
                        PERROR("lttng_strndup");
                        goto error;
                }
@@ -77,7 +77,7 @@ static char *utils_partial_realpath(const char *path)
 
                /* Try to resolve this part */
                try_path = realpath((char *) cut_path, try_path_buf);
-               if (try_path == NULL) {
+               if (try_path == nullptr) {
                        free(try_path_buf);
                        /*
                         * There was an error, we just want to be assured it
@@ -95,7 +95,7 @@ static char *utils_partial_realpath(const char *path)
                        }
                } else {
                        /* Save the place we are before trying the next step */
-                       try_path_buf = NULL;
+                       try_path_buf = nullptr;
                        free(try_path_prev);
                        try_path_prev = try_path;
                        prev = next;
@@ -103,12 +103,12 @@ static char *utils_partial_realpath(const char *path)
 
                /* Free the allocated memory */
                free(cut_path);
-               cut_path = NULL;
+               cut_path = nullptr;
        }
 
        /* Allocate memory for the resolved path. */
        resolved_path = zmalloc<char>(LTTNG_PATH_MAX);
-       if (resolved_path == NULL) {
+       if (resolved_path == nullptr) {
                PERROR("zmalloc resolved path");
                goto error;
        }
@@ -117,7 +117,7 @@ static char *utils_partial_realpath(const char *path)
         * If we were able to solve at least partially the path, we can concatenate
         * what worked and what didn't work
         */
-       if (try_path_prev != NULL) {
+       if (try_path_prev != nullptr) {
                /* If we risk to concatenate two '/', we remove one of them */
                if (try_path_prev[strlen(try_path_prev) - 1] == '/' && prev[0] == '/') {
                        try_path_prev[strlen(try_path_prev) - 1] = '\0';
@@ -128,7 +128,7 @@ static char *utils_partial_realpath(const char *path)
                 * path are pointers for the same memory space
                 */
                cut_path = strdup(prev);
-               if (cut_path == NULL) {
+               if (cut_path == nullptr) {
                        PERROR("strdup");
                        goto error;
                }
@@ -139,8 +139,8 @@ static char *utils_partial_realpath(const char *path)
                /* Free the allocated memory */
                free(cut_path);
                free(try_path_prev);
-               cut_path = NULL;
-               try_path_prev = NULL;
+               cut_path = nullptr;
+               try_path_prev = nullptr;
                /*
                 * Else, we just copy the path in our resolved_path to
                 * return it as is
@@ -159,7 +159,7 @@ error:
        if (try_path_prev != try_path) {
                free(try_path_prev);
        }
-       return NULL;
+       return nullptr;
 }
 
 static int expand_double_slashes_dot_and_dotdot(char *path)
@@ -187,7 +187,7 @@ static int expand_double_slashes_dot_and_dotdot(char *path)
                }
 
                next_slash = (const char *) memchr(curr_char, '/', path_last_char - curr_char);
-               if (next_slash == NULL) {
+               if (next_slash == nullptr) {
                        /* Reached the end of the provided path. */
                        next_slash = path_last_char;
                }
@@ -234,7 +234,7 @@ static int expand_double_slashes_dot_and_dotdot(char *path)
                                 * beginning of the path. We can't go back any
                                 * further.
                                 */
-                               if (prev_slash != NULL) {
+                               if (prev_slash != nullptr) {
                                        expanded_path_len = prev_slash - path;
                                }
                                continue;
@@ -275,18 +275,18 @@ error:
 static char *_utils_expand_path(const char *path, bool keep_symlink)
 {
        int ret;
-       char *absolute_path = NULL;
+       char *absolute_path = nullptr;
        char *last_token;
        bool is_dot, is_dotdot;
 
        /* Safety net */
-       if (path == NULL) {
+       if (path == nullptr) {
                goto error;
        }
 
        /* Allocate memory for the absolute_path */
        absolute_path = zmalloc<char>(LTTNG_PATH_MAX);
-       if (absolute_path == NULL) {
+       if (absolute_path == nullptr) {
                PERROR("zmalloc expand path");
                goto error;
        }
@@ -368,7 +368,7 @@ static char *_utils_expand_path(const char *path, bool keep_symlink)
 
 error:
        free(absolute_path);
-       return NULL;
+       return nullptr;
 }
 char *utils_expand_path(const char *path)
 {
index edb5789a9420ee1e488abfe9b71ef26f6d8a4371..0f41027bd0dcabb3389a0d80e8ac52ae14ef592b 100644 (file)
@@ -122,7 +122,7 @@ end:
 
 struct fd_handle *lttng_payload_view_pop_fd_handle(struct lttng_payload_view *view)
 {
-       struct fd_handle *handle = NULL;
+       struct fd_handle *handle = nullptr;
        size_t fd_handle_count;
        size_t *pos;
 
index 1c39ba224a983f0fd346fd4547860593bc565549..63a20512d9c8e5bd0fb3012fa899245debf553a3 100644 (file)
@@ -103,7 +103,7 @@ end:
        return ret_val;
 }
 
-static struct lttng_pipe *_pipe_create(void)
+static struct lttng_pipe *_pipe_create()
 {
        int ret;
        struct lttng_pipe *p;
@@ -115,12 +115,12 @@ static struct lttng_pipe *_pipe_create(void)
        }
        p->fd[0] = p->fd[1] = -1;
 
-       ret = pthread_mutex_init(&p->read_mutex, NULL);
+       ret = pthread_mutex_init(&p->read_mutex, nullptr);
        if (ret) {
                PERROR("pthread_mutex_init read lock pipe create");
                goto error_destroy;
        }
-       ret = pthread_mutex_init(&p->write_mutex, NULL);
+       ret = pthread_mutex_init(&p->write_mutex, nullptr);
        if (ret) {
                PERROR("pthread_mutex_init write lock pipe create");
                goto error_destroy_rmutex;
@@ -131,7 +131,7 @@ error_destroy_rmutex:
        (void) pthread_mutex_destroy(&p->read_mutex);
 error_destroy:
        free(p);
-       return NULL;
+       return nullptr;
 }
 
 static int _pipe_set_flags(struct lttng_pipe *pipe, int flags)
@@ -205,7 +205,7 @@ struct lttng_pipe *lttng_pipe_open(int flags)
        return p;
 error:
        lttng_pipe_destroy(p);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -254,7 +254,7 @@ struct lttng_pipe *lttng_pipe_named_open(const char *path, mode_t mode, int flag
        return pipe;
 error:
        lttng_pipe_destroy(pipe);
-       return NULL;
+       return nullptr;
 }
 
 /*
index d19e3f3fbeb9ba066c19494ce209191859d2b495..824b2f2a91ce03cacedaab5bf6d72c3fb2f8660e 100644 (file)
@@ -26,7 +26,7 @@ namespace details {
  */
 class mutex {
 public:
-       mutex(pthread_mutex_t& mutex_p) : _mutex{mutex_p}
+       explicit mutex(pthread_mutex_t& mutex_p) : _mutex{mutex_p}
        {
        }
 
@@ -76,7 +76,7 @@ private:
  */
 class lock_guard {
 public:
-       lock_guard(pthread_mutex_t& mutex) : _mutex{mutex}, _guard(_mutex)
+       explicit lock_guard(pthread_mutex_t& mutex) : _mutex{mutex}, _guard(_mutex)
        {
        }
 
index 7bbfc95ff62dd817f8db9641c9e4e31df8d33754..59b90b4eaa315bb6ec23d182238da47c79997fae 100644 (file)
@@ -66,7 +66,7 @@ static int send_command(struct lttcomm_relayd_sock *rsock,
        }
 
        buf = calloc<char>(buf_size);
-       if (buf == NULL) {
+       if (buf == nullptr) {
                PERROR("zmalloc relayd send command buf");
                ret = -1;
                goto alloc_error;
@@ -159,7 +159,7 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock,
                                      char *output_path)
 {
        int ret;
-       struct lttcomm_relayd_create_session_2_11 *msg = NULL;
+       struct lttcomm_relayd_create_session_2_11 *msg = nullptr;
        size_t session_name_len;
        size_t hostname_len;
        size_t base_path_len;
@@ -299,7 +299,7 @@ static int relayd_create_session_2_1(struct lttcomm_relayd_sock *rsock,
        int ret;
 
        /* Send command */
-       ret = send_command(rsock, RELAYD_CREATE_SESSION, NULL, 0, 0);
+       ret = send_command(rsock, RELAYD_CREATE_SESSION, nullptr, 0, 0);
        if (ret < 0) {
                goto error;
        }
@@ -457,7 +457,7 @@ static int relayd_add_stream_2_11(struct lttcomm_relayd_sock *rsock,
                                  uint64_t trace_archive_id)
 {
        int ret;
-       struct lttcomm_relayd_add_stream_2_11 *msg = NULL;
+       struct lttcomm_relayd_add_stream_2_11 *msg = nullptr;
        size_t channel_name_len;
        size_t pathname_len;
        size_t msg_length;
@@ -629,7 +629,7 @@ int relayd_streams_sent(struct lttcomm_relayd_sock *rsock)
        }
 
        /* Send command */
-       ret = send_command(rsock, RELAYD_STREAMS_SENT, NULL, 0, 0);
+       ret = send_command(rsock, RELAYD_STREAMS_SENT, nullptr, 0, 0);
        if (ret < 0) {
                goto error;
        }
@@ -748,7 +748,7 @@ int relayd_send_metadata(struct lttcomm_relayd_sock *rsock, size_t len)
        DBG("Relayd sending metadata of size %zu", len);
 
        /* Send command */
-       ret = send_command(rsock, RELAYD_SEND_METADATA, NULL, len, 0);
+       ret = send_command(rsock, RELAYD_SEND_METADATA, nullptr, len, 0);
        if (ret < 0) {
                goto error;
        }
index 667b28cb8e3ed8ccba5ff33db7701b41ca80ba01..d253ee0544e5317183b1a01becfc87a11cbd5ed5 100644 (file)
@@ -349,7 +349,7 @@ static int use_clone(void)
        return 0;
 }
 #else
-static int use_clone(void)
+static int use_clone()
 {
        return !lttng_secure_getenv("LTTNG_DEBUG_NOCLONE");
 }
@@ -517,7 +517,7 @@ end:
 static int _rename(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        const char *old_path, *new_path;
-       struct lttng_directory_handle *old_handle = NULL, *new_handle = NULL;
+       struct lttng_directory_handle *old_handle = nullptr, *new_handle = nullptr;
 
        old_path = data->u.rename.old_path;
        new_path = data->u.rename.new_path;
@@ -569,7 +569,7 @@ static int _extract_elf_symbol_offset(struct run_as_data *data, struct run_as_re
 static int _extract_sdt_probe_offsets(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        int ret = 0;
-       uint64_t *offsets = NULL;
+       uint64_t *offsets = nullptr;
        uint32_t num_offset;
 
        ret_value->_error = false;
@@ -625,8 +625,8 @@ static int _extract_sdt_probe_offsets(struct run_as_data *data __attribute__((un
 static int _generate_filter_bytecode(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        int ret = 0;
-       const char *filter_expression = NULL;
-       struct filter_parser_ctx *ctx = NULL;
+       const char *filter_expression = nullptr;
+       struct filter_parser_ctx *ctx = nullptr;
 
        ret_value->_error = false;
 
@@ -694,7 +694,7 @@ static run_as_fct run_as_enum_to_fct(enum run_as_cmd cmd)
                return _generate_filter_bytecode;
        default:
                ERR("Unknown command %d", (int) cmd);
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -867,11 +867,11 @@ end:
 static int get_user_infos_from_uid(uid_t uid, char **username, gid_t *primary_gid)
 {
        int ret;
-       char *buf = NULL;
+       char *buf = nullptr;
        long raw_get_pw_buf_size;
        size_t get_pw_buf_size;
        struct passwd pwd;
-       struct passwd *result = NULL;
+       struct passwd *result = nullptr;
 
        /* Fetch the max size for the temporary buffer. */
        errno = 0;
@@ -891,7 +891,7 @@ static int get_user_infos_from_uid(uid_t uid, char **username, gid_t *primary_gi
        get_pw_buf_size = (size_t) raw_get_pw_buf_size;
 
        buf = calloc<char>(get_pw_buf_size);
-       if (buf == NULL) {
+       if (buf == nullptr) {
                PERROR("Failed to allocate buffer to get password file entries");
                goto error;
        }
@@ -902,14 +902,14 @@ static int get_user_infos_from_uid(uid_t uid, char **username, gid_t *primary_gi
                goto error;
        }
 
-       if (result == NULL) {
+       if (result == nullptr) {
                ERR("Failed to find user information in password entries: uid = %d", (int) uid);
                ret = -1;
                goto error;
        }
 
        *username = strdup(result->pw_name);
-       if (*username == NULL) {
+       if (*username == nullptr) {
                PERROR("Failed to copy user name");
                goto error;
        }
@@ -920,7 +920,7 @@ end:
        free(buf);
        return ret;
 error:
-       *username = NULL;
+       *username = nullptr;
        *primary_gid = -1;
        ret = -1;
        goto end;
@@ -930,7 +930,7 @@ static int demote_creds(uid_t prev_uid, gid_t prev_gid, uid_t new_uid, gid_t new
 {
        int ret = 0;
        gid_t primary_gid;
-       char *username = NULL;
+       char *username = nullptr;
 
        /* Change the group id. */
        if (prev_gid != new_gid) {
@@ -997,7 +997,7 @@ static int promote_creds(uid_t prev_uid, gid_t prev_gid, uid_t new_uid, gid_t ne
 {
        int ret = 0;
        gid_t primary_gid;
-       char *username = NULL;
+       char *username = nullptr;
 
        /* Change the group id. */
        if (prev_gid != new_gid) {
@@ -1316,7 +1316,7 @@ end:
        return ret;
 }
 
-static int reset_sighandler(void)
+static int reset_sighandler()
 {
        int sig;
 
@@ -1345,7 +1345,7 @@ static void worker_sighandler(int sig)
                signame = "SIGTERM";
                break;
        default:
-               signame = NULL;
+               signame = nullptr;
        }
 
        if (signame) {
@@ -1355,7 +1355,7 @@ static void worker_sighandler(int sig)
        }
 }
 
-static int set_worker_sighandlers(void)
+static int set_worker_sighandlers()
 {
        int ret = 0;
        sigset_t sigset;
@@ -1369,12 +1369,12 @@ static int set_worker_sighandlers(void)
        sa.sa_handler = worker_sighandler;
        sa.sa_mask = sigset;
        sa.sa_flags = 0;
-       if ((ret = sigaction(SIGINT, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGINT, &sa, nullptr)) < 0) {
                PERROR("sigaction SIGINT");
                goto end;
        }
 
-       if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
+       if ((ret = sigaction(SIGTERM, &sa, nullptr)) < 0) {
                PERROR("sigaction SIGTERM");
                goto end;
        }
@@ -1510,7 +1510,7 @@ error_procname_alloc:
        return ret;
 }
 
-static void run_as_destroy_worker_no_lock(void)
+static void run_as_destroy_worker_no_lock()
 {
        run_as_worker_data *worker = global_worker;
 
@@ -1551,13 +1551,13 @@ static void run_as_destroy_worker_no_lock(void)
        }
        free(worker->procname);
        free(worker);
-       global_worker = NULL;
+       global_worker = nullptr;
 }
 
 static int run_as_restart_worker(run_as_worker_data *worker)
 {
        int ret = 0;
-       char *procname = NULL;
+       char *procname = nullptr;
 
        procname = worker->procname;
 
@@ -1565,7 +1565,7 @@ static int run_as_restart_worker(run_as_worker_data *worker)
        run_as_destroy_worker_no_lock();
 
        /* Create a new run_as worker process*/
-       ret = run_as_create_worker_no_lock(procname, NULL, NULL);
+       ret = run_as_create_worker_no_lock(procname, nullptr, nullptr);
        if (ret < 0) {
                ERR("Restarting the worker process failed");
                ret = -1;
@@ -1957,8 +1957,8 @@ int run_as_generate_filter_bytecode(const char *filter_expression,
        int ret;
        struct run_as_data data = {};
        struct run_as_ret run_as_ret = {};
-       const struct lttng_bytecode *view_bytecode = NULL;
-       struct lttng_bytecode *local_bytecode = NULL;
+       const struct lttng_bytecode *view_bytecode = nullptr;
+       struct lttng_bytecode *local_bytecode = nullptr;
        const uid_t uid = lttng_credentials_get_uid(creds);
        const gid_t gid = lttng_credentials_get_gid(creds);
 
@@ -2010,7 +2010,7 @@ int run_as_create_worker(const char *procname,
        return ret;
 }
 
-void run_as_destroy_worker(void)
+void run_as_destroy_worker()
 {
        pthread_mutex_lock(&worker_lock);
        run_as_destroy_worker_no_lock();
index be806afc2f141baa4640cb0aa9346dd2a22d6d9d..86c56c987381bb483e587c9edcd8852a491de2a6 100644 (file)
@@ -59,6 +59,6 @@ int run_as_generate_filter_bytecode(const char *filter_expression,
                struct lttng_bytecode **bytecode);
 int run_as_create_worker(const char *procname,
                post_fork_cleanup_cb clean_up_func, void *clean_up_user_data);
-void run_as_destroy_worker(void);
+void run_as_destroy_worker();
 
 #endif /* _RUNAS_H */
index 46479bc572439762ecded83cad8d4b682927cac0..e73b5792b776910c5191f6583b27cce2a2d97860 100644 (file)
@@ -36,15 +36,15 @@ public:
         * must be `noexcept` lest we anger the undefined behaviour gods.
         */
        static_assert(details::is_invocation_noexcept<ScopeExitInvocableType>::value,
-                       "scope_exit requires a noexcept invocable type");
+                     "scope_exit requires a noexcept invocable type");
 
        explicit scope_exit(ScopeExitInvocableType&& scope_exit_callable) :
-               _on_scope_exit{std::forward<ScopeExitInvocableType>(scope_exit_callable)}
+               _on_scope_exit{ std::forward<ScopeExitInvocableType>(scope_exit_callable) }
        {
        }
 
-       scope_exit(scope_exit&& rhs) :
-               _on_scope_exit{std::move(rhs._on_scope_exit)}, _armed{rhs._armed}
+       scope_exit(scope_exit&& rhs) noexcept :
+               _on_scope_exit{ std::move(rhs._on_scope_exit) }, _armed{ rhs._armed }
        {
                /* Don't invoke ScopeExitInvocableType for the moved-from copy. */
                rhs.disarm();
@@ -81,7 +81,7 @@ template <typename ScopeExitInvocableType>
 scope_exit<ScopeExitInvocableType> make_scope_exit(ScopeExitInvocableType&& scope_exit_callable)
 {
        return scope_exit<ScopeExitInvocableType>(
-                       std::forward<ScopeExitInvocableType>(scope_exit_callable));
+               std::forward<ScopeExitInvocableType>(scope_exit_callable));
 }
 
 } /* namespace lttng */
index 56655f20b63a92029509b5a6f639bc932e7cb8f2..55db55e5cea78cc7cec48c1b3d986e9a2345810c 100644 (file)
@@ -70,7 +70,7 @@ struct lttng_session_descriptor_live_comm {
 
 static struct lttng_uri *uri_copy(const struct lttng_uri *uri)
 {
-       struct lttng_uri *new_uri = NULL;
+       struct lttng_uri *new_uri = nullptr;
 
        if (!uri) {
                goto end;
@@ -87,7 +87,7 @@ end:
 
 static struct lttng_uri *uri_from_path(const char *path)
 {
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
        ssize_t uri_count;
        char local_protocol_string[LTTNG_PATH_MAX + sizeof("file://")] = "file://";
 
@@ -113,7 +113,7 @@ end:
        return uris;
 error:
        free(uris);
-       return NULL;
+       return nullptr;
 }
 
 static void network_location_fini(struct lttng_session_descriptor_network_location *location)
@@ -149,8 +149,8 @@ network_location_set_from_lttng_uris(struct lttng_session_descriptor_network_loc
        free(location->data);
        location->control = control;
        location->data = data;
-       control = NULL;
-       data = NULL;
+       control = nullptr;
+       data = nullptr;
 end:
        free(control);
        free(data);
@@ -164,9 +164,9 @@ network_location_set_from_uri_strings(struct lttng_session_descriptor_network_lo
 {
        int ret = 0;
        ssize_t uri_count;
-       struct lttng_uri *parsed_uris = NULL;
-       struct lttng_uri *control_uri = NULL;
-       struct lttng_uri *data_uri = NULL;
+       struct lttng_uri *parsed_uris = nullptr;
+       struct lttng_uri *control_uri = nullptr;
+       struct lttng_uri *data_uri = nullptr;
 
        uri_count = uri_parse_str_urls(control, data, &parsed_uris);
        if (uri_count != 2 && uri_count != 0) {
@@ -191,8 +191,8 @@ network_location_set_from_uri_strings(struct lttng_session_descriptor_network_lo
 
        /* Ownership of control and data uris is transferred. */
        ret = network_location_set_from_lttng_uris(location, control_uri, data_uri);
-       control_uri = NULL;
-       data_uri = NULL;
+       control_uri = nullptr;
+       data_uri = nullptr;
 end:
        free(parsed_uris);
        free(control_uri);
@@ -217,7 +217,7 @@ struct lttng_session_descriptor *lttng_session_descriptor_create(const char *nam
        return descriptor;
 error:
        lttng_session_descriptor_destroy(descriptor);
-       return NULL;
+       return nullptr;
 }
 
 /* Ownership of uri is transferred. */
@@ -237,19 +237,19 @@ _lttng_session_descriptor_local_create(const char *name, struct lttng_uri *uri)
                        goto error;
                }
                descriptor->output.local = uri;
-               uri = NULL;
+               uri = nullptr;
        }
        return descriptor;
 error:
        free(uri);
        lttng_session_descriptor_destroy(descriptor);
-       return NULL;
+       return nullptr;
 }
 
 struct lttng_session_descriptor *lttng_session_descriptor_local_create(const char *name,
                                                                       const char *path)
 {
-       struct lttng_uri *uri = NULL;
+       struct lttng_uri *uri = nullptr;
        struct lttng_session_descriptor *descriptor;
 
        if (path) {
@@ -261,7 +261,7 @@ struct lttng_session_descriptor *lttng_session_descriptor_local_create(const cha
        descriptor = _lttng_session_descriptor_local_create(name, uri);
        return descriptor;
 error:
-       return NULL;
+       return nullptr;
 }
 
 /* Assumes the ownership of both uris. */
@@ -280,8 +280,8 @@ static struct lttng_session_descriptor *_lttng_session_descriptor_network_create
        descriptor->output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
        /* Assumes the ownership of both uris. */
        ret = network_location_set_from_lttng_uris(&descriptor->output.network, control, data);
-       control = NULL;
-       data = NULL;
+       control = nullptr;
+       data = nullptr;
        if (ret) {
                goto error;
        }
@@ -290,7 +290,7 @@ error:
        lttng_session_descriptor_destroy(descriptor);
        free(control);
        free(data);
-       return NULL;
+       return nullptr;
 }
 
 struct lttng_session_descriptor *lttng_session_descriptor_network_create(const char *name,
@@ -300,7 +300,7 @@ struct lttng_session_descriptor *lttng_session_descriptor_network_create(const c
        int ret;
        struct lttng_session_descriptor *descriptor;
 
-       descriptor = _lttng_session_descriptor_network_create(name, NULL, NULL);
+       descriptor = _lttng_session_descriptor_network_create(name, nullptr, nullptr);
        if (!descriptor) {
                goto error;
        }
@@ -313,7 +313,7 @@ struct lttng_session_descriptor *lttng_session_descriptor_network_create(const c
        return descriptor;
 error:
        lttng_session_descriptor_destroy(descriptor);
-       return NULL;
+       return nullptr;
 }
 
 static struct lttng_session_descriptor_snapshot *
@@ -333,8 +333,8 @@ _lttng_session_descriptor_snapshot_create(const char *name)
        }
        return descriptor;
 error:
-       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : NULL);
-       return NULL;
+       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : nullptr);
+       return nullptr;
 }
 
 /* Ownership of control and data is transferred. */
@@ -352,8 +352,8 @@ static struct lttng_session_descriptor_snapshot *_lttng_session_descriptor_snaps
        descriptor->base.output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
        /* Ownership of control and data is transferred. */
        ret = network_location_set_from_lttng_uris(&descriptor->base.output.network, control, data);
-       control = NULL;
-       data = NULL;
+       control = nullptr;
+       data = nullptr;
        if (ret) {
                goto error;
        }
@@ -361,8 +361,8 @@ static struct lttng_session_descriptor_snapshot *_lttng_session_descriptor_snaps
 error:
        free(control);
        free(data);
-       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : NULL);
-       return NULL;
+       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : nullptr);
+       return nullptr;
 }
 
 struct lttng_session_descriptor *lttng_session_descriptor_snapshot_create(const char *name)
@@ -370,7 +370,7 @@ struct lttng_session_descriptor *lttng_session_descriptor_snapshot_create(const
        struct lttng_session_descriptor_snapshot *descriptor;
 
        descriptor = _lttng_session_descriptor_snapshot_create(name);
-       return descriptor ? &descriptor->base : NULL;
+       return descriptor ? &descriptor->base : nullptr;
 }
 
 struct lttng_session_descriptor *lttng_session_descriptor_snapshot_network_create(
@@ -379,7 +379,7 @@ struct lttng_session_descriptor *lttng_session_descriptor_snapshot_network_creat
        int ret;
        struct lttng_session_descriptor_snapshot *descriptor;
 
-       descriptor = _lttng_session_descriptor_snapshot_network_create(name, NULL, NULL);
+       descriptor = _lttng_session_descriptor_snapshot_network_create(name, nullptr, nullptr);
        if (!descriptor) {
                goto error;
        }
@@ -391,8 +391,8 @@ struct lttng_session_descriptor *lttng_session_descriptor_snapshot_network_creat
        }
        return &descriptor->base;
 error:
-       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : NULL);
-       return NULL;
+       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : nullptr);
+       return nullptr;
 }
 
 /* Ownership of uri is transferred. */
@@ -411,19 +411,19 @@ _lttng_session_descriptor_snapshot_local_create(const char *name, struct lttng_u
                        goto error;
                }
                descriptor->base.output.local = uri;
-               uri = NULL;
+               uri = nullptr;
        }
        return descriptor;
 error:
        free(uri);
-       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : NULL);
-       return NULL;
+       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : nullptr);
+       return nullptr;
 }
 
 struct lttng_session_descriptor *lttng_session_descriptor_snapshot_local_create(const char *name,
                                                                                const char *path)
 {
-       struct lttng_uri *path_uri = NULL;
+       struct lttng_uri *path_uri = nullptr;
        struct lttng_session_descriptor_snapshot *descriptor;
 
        if (path) {
@@ -433,15 +433,15 @@ struct lttng_session_descriptor *lttng_session_descriptor_snapshot_local_create(
                }
        }
        descriptor = _lttng_session_descriptor_snapshot_local_create(name, path_uri);
-       return descriptor ? &descriptor->base : NULL;
+       return descriptor ? &descriptor->base : nullptr;
 error:
-       return NULL;
+       return nullptr;
 }
 
 static struct lttng_session_descriptor_live *
 _lttng_session_descriptor_live_create(const char *name, unsigned long long live_timer_interval_us)
 {
-       struct lttng_session_descriptor_live *descriptor = NULL;
+       struct lttng_session_descriptor_live *descriptor = nullptr;
 
        if (live_timer_interval_us == 0) {
                goto error;
@@ -460,8 +460,8 @@ _lttng_session_descriptor_live_create(const char *name, unsigned long long live_
 
        return descriptor;
 error:
-       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : NULL);
-       return NULL;
+       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : nullptr);
+       return nullptr;
 }
 
 /* Ownership of control and data is transferred. */
@@ -483,8 +483,8 @@ _lttng_session_descriptor_live_network_create(const char *name,
 
        /* Ownerwhip of control and data is transferred. */
        ret = network_location_set_from_lttng_uris(&descriptor->base.output.network, control, data);
-       control = NULL;
-       data = NULL;
+       control = nullptr;
+       data = nullptr;
        if (ret) {
                goto error;
        }
@@ -492,8 +492,8 @@ _lttng_session_descriptor_live_network_create(const char *name,
 error:
        free(control);
        free(data);
-       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : NULL);
-       return NULL;
+       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : nullptr);
+       return nullptr;
 }
 
 struct lttng_session_descriptor *
@@ -503,7 +503,7 @@ lttng_session_descriptor_live_create(const char *name, unsigned long long live_t
 
        descriptor = _lttng_session_descriptor_live_create(name, live_timer_us);
 
-       return descriptor ? &descriptor->base : NULL;
+       return descriptor ? &descriptor->base : nullptr;
 }
 
 struct lttng_session_descriptor *
@@ -515,7 +515,8 @@ lttng_session_descriptor_live_network_create(const char *name,
        int ret;
        struct lttng_session_descriptor_live *descriptor;
 
-       descriptor = _lttng_session_descriptor_live_network_create(name, NULL, NULL, live_timer_us);
+       descriptor = _lttng_session_descriptor_live_network_create(
+               name, nullptr, nullptr, live_timer_us);
        if (!descriptor) {
                goto error;
        }
@@ -527,8 +528,8 @@ lttng_session_descriptor_live_network_create(const char *name,
        }
        return &descriptor->base;
 error:
-       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : NULL);
-       return NULL;
+       lttng_session_descriptor_destroy(descriptor ? &descriptor->base : nullptr);
+       return nullptr;
 }
 
 void lttng_session_descriptor_destroy(struct lttng_session_descriptor *descriptor)
@@ -560,7 +561,7 @@ ssize_t lttng_session_descriptor_create_from_buffer(const struct lttng_buffer_vi
        int i;
        ssize_t offset = 0, ret;
        struct lttng_buffer_view current_view;
-       const char *name = NULL;
+       const char *name = nullptr;
        const struct lttng_session_descriptor_comm *base_header;
        size_t max_expected_uri_count;
        uint64_t live_timer_us = 0;
@@ -705,7 +706,7 @@ skip_name:
                        /* Already checked. */
                        abort();
                }
-               *descriptor = snapshot ? &snapshot->base : NULL;
+               *descriptor = snapshot ? &snapshot->base : nullptr;
                break;
        }
        case LTTNG_SESSION_DESCRIPTOR_TYPE_LIVE:
@@ -727,7 +728,7 @@ skip_name:
                        /* Already checked. */
                        abort();
                }
-               *descriptor = live ? &live->base : NULL;
+               *descriptor = live ? &live->base : nullptr;
                break;
        }
        default:
@@ -766,7 +767,7 @@ int lttng_session_descriptor_serialize(const struct lttng_session_descriptor *de
                .live_timer_us = 0,
 
        };
-       const void *header_ptr = NULL;
+       const void *header_ptr = nullptr;
        size_t header_size;
 
        switch (descriptor->output_type) {
@@ -940,7 +941,7 @@ lttng_session_descriptor_set_default_output(struct lttng_session_descriptor *des
                                            const char *absolute_home_path)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
 
        switch (descriptor->output_type) {
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE:
@@ -996,16 +997,16 @@ lttng_session_descriptor_set_default_output(struct lttng_session_descriptor *des
                }
                free(descriptor->output.local);
                descriptor->output.local = &uris[0];
-               uris = NULL;
+               uris = nullptr;
                break;
        }
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
        {
                int ret;
                ssize_t uri_ret;
-               struct lttng_uri *control = NULL, *data = NULL;
+               struct lttng_uri *control = nullptr, *data = nullptr;
 
-               uri_ret = uri_parse_str_urls("net://127.0.0.1", NULL, &uris);
+               uri_ret = uri_parse_str_urls("net://127.0.0.1", nullptr, &uris);
                if (uri_ret != 2) {
                        ret_code = LTTNG_ERR_SET_URL;
                        goto end;
@@ -1070,7 +1071,7 @@ int lttng_session_descriptor_assign(struct lttng_session_descriptor *dst,
                break;
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
        {
-               struct lttng_uri *control_copy = NULL, *data_copy = NULL;
+               struct lttng_uri *control_copy = nullptr, *data_copy = nullptr;
 
                control_copy = uri_copy(dst->output.network.control);
                if (!control_copy && dst->output.network.control) {
index 15e6ba7c8b8276a2ab9fcb29b2a7d3f9e5e21948..633685799aad448f352adfac358c5214269dfa05 100644 (file)
@@ -256,7 +256,7 @@ struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
        }
 
        new_sock = lttcomm_alloc_sock(sock->proto);
-       if (new_sock == NULL) {
+       if (new_sock == nullptr) {
                goto error;
        }
 
@@ -296,7 +296,7 @@ error_close:
 
 error:
        free(new_sock);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -480,7 +480,7 @@ static unsigned long read_proc_value(const char *path)
        buf[size_ret] = '\0';
 
        errno = 0;
-       r_val = strtol(buf, NULL, 10);
+       r_val = strtol(buf, nullptr, 10);
        if (errno != 0 || r_val < -1L) {
                val = 0;
                goto error_close;
@@ -499,7 +499,7 @@ error:
        return val;
 }
 
-void lttcomm_inet_init(void)
+void lttcomm_inet_init()
 {
        unsigned long syn_retries, fin_timeout, syn_timeout, env;
 
index dca1cc154c1c80ea2fef6e6ae3bd41ffa91a88ee..6e24fb3ebf709edfd5303bbeb0800b0952acb289 100644 (file)
@@ -51,6 +51,6 @@ extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock,
                const void *buf, size_t len, int flags);
 
 /* Initialize inet communication layer. */
-extern void lttcomm_inet_init(void);
+extern void lttcomm_inet_init();
 
 #endif /* _LTTCOMM_INET_H */
index 21b8378e12e30b34f4c897d8ca2ad3df637b11c1..289e19e98df67b3192095da8d4df50c4197b99cb 100644 (file)
@@ -251,7 +251,7 @@ struct lttcomm_sock *lttcomm_accept_inet6_sock(struct lttcomm_sock *sock)
        }
 
        new_sock = lttcomm_alloc_sock(sock->proto);
-       if (new_sock == NULL) {
+       if (new_sock == nullptr) {
                goto error;
        }
 
@@ -272,7 +272,7 @@ end:
 
 error:
        free(new_sock);
-       return NULL;
+       return nullptr;
 }
 
 /*
index 7ad1be6037d02ec08e8c62d41e284588d7caa795..593ab265ccc25f6a1d7e06d098c31c0568529b27 100644 (file)
@@ -180,7 +180,7 @@ struct lttcomm_sock *lttcomm_alloc_sock(enum lttcomm_sock_proto proto)
 {
        struct lttcomm_sock *sock = zmalloc<lttcomm_sock>();
 
-       if (sock == NULL) {
+       if (sock == nullptr) {
                PERROR("zmalloc create sock");
                goto end;
        }
@@ -207,7 +207,7 @@ struct lttcomm_sock *lttcomm_alloc_copy_sock(struct lttcomm_sock *src)
        LTTNG_ASSERT(src);
 
        sock = lttcomm_alloc_sock(src->proto);
-       if (sock == NULL) {
+       if (sock == nullptr) {
                goto alloc_error;
        }
 
@@ -299,7 +299,7 @@ struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri)
 {
        int ret;
        int _sock_proto;
-       struct lttcomm_sock *sock = NULL;
+       struct lttcomm_sock *sock = nullptr;
 
        /* Safety net */
        LTTNG_ASSERT(uri);
@@ -313,7 +313,7 @@ struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri)
        }
 
        sock = lttcomm_alloc_sock((lttcomm_sock_proto) _sock_proto);
-       if (sock == NULL) {
+       if (sock == nullptr) {
                goto alloc_error;
        }
 
@@ -339,7 +339,7 @@ struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri)
 error:
        lttcomm_destroy_sock(sock);
 alloc_error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -360,7 +360,7 @@ struct lttcomm_relayd_sock *
 lttcomm_alloc_relayd_sock(struct lttng_uri *uri, uint32_t major, uint32_t minor)
 {
        int ret;
-       struct lttcomm_sock *tmp_sock = NULL;
+       struct lttcomm_sock *tmp_sock = nullptr;
        struct lttcomm_relayd_sock *rsock = zmalloc<lttcomm_relayd_sock>();
 
        LTTNG_ASSERT(uri);
@@ -372,7 +372,7 @@ lttcomm_alloc_relayd_sock(struct lttng_uri *uri, uint32_t major, uint32_t minor)
 
        /* Allocate socket object from URI */
        tmp_sock = lttcomm_alloc_sock_from_uri(uri);
-       if (tmp_sock == NULL) {
+       if (tmp_sock == nullptr) {
                goto error_free;
        }
 
@@ -396,7 +396,7 @@ lttcomm_alloc_relayd_sock(struct lttng_uri *uri, uint32_t major, uint32_t minor)
 error_free:
        free(rsock);
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -478,7 +478,7 @@ int lttcomm_sock_set_port(struct lttcomm_sock *sock, uint16_t port)
        return 0;
 }
 
-void lttcomm_init(void)
+void lttcomm_init()
 {
        const char *env;
 
@@ -487,7 +487,7 @@ void lttcomm_init(void)
                long timeout;
 
                errno = 0;
-               timeout = strtol(env, NULL, 0);
+               timeout = strtol(env, nullptr, 0);
                if (errno != 0 || timeout < -1L) {
                        PERROR("Network timeout");
                } else {
@@ -498,7 +498,7 @@ void lttcomm_init(void)
        }
 }
 
-unsigned long lttcomm_get_network_timeout(void)
+unsigned long lttcomm_get_network_timeout()
 {
        return network_timeout;
 }
index 31482350e037aa9570490b349c28f8599d99499c..3d4eb6b8a070a324f213003be96f36a31209d2df 100644 (file)
@@ -950,8 +950,8 @@ int lttcomm_sock_get_port(const struct lttcomm_sock *sock,
  */
 int lttcomm_sock_set_port(struct lttcomm_sock *sock, uint16_t port);
 
-void lttcomm_init(void);
+void lttcomm_init();
 /* Get network timeout, in milliseconds */
-unsigned long lttcomm_get_network_timeout(void);
+unsigned long lttcomm_get_network_timeout();
 
 #endif /* _LTTNG_SESSIOND_COMM_H */
index 6284ed1fddcb1c609b868595717b05664bb58ae2..deaf715a651cd62ba156dbf2f173da0d5526fcec 100644 (file)
@@ -187,8 +187,8 @@ char *shm_ust_get_mmap(char *shm_path, int global)
                goto error;
        }
 
-       wait_shm_mmap =
-               (char *) mmap(NULL, mmap_size, PROT_WRITE | PROT_READ, MAP_SHARED, wait_shm_fd, 0);
+       wait_shm_mmap = (char *) mmap(
+               nullptr, mmap_size, PROT_WRITE | PROT_READ, MAP_SHARED, wait_shm_fd, 0);
 
        /* close shm fd immediately after taking the mmap reference */
        ret = close(wait_shm_fd);
@@ -207,7 +207,7 @@ char *shm_ust_get_mmap(char *shm_path, int global)
        return wait_shm_mmap;
 
 error:
-       return NULL;
+       return nullptr;
 }
 
 /*
index ba4a554513a75171c7febe6b243da5bc1fc2ea52..765c11cb4d60efab0fbd84de372dd68f0c571f1f 100644 (file)
@@ -127,7 +127,7 @@ ssize_t lttng_snapshot_output_create_from_payload(struct lttng_payload_view *vie
                                                  struct lttng_snapshot_output **output_p)
 {
        const struct lttng_snapshot_output_comm *comm;
-       struct lttng_snapshot_output *output = NULL;
+       struct lttng_snapshot_output *output = nullptr;
        int ret;
 
        if (view->buffer.size != sizeof(*comm)) {
@@ -162,7 +162,7 @@ ssize_t lttng_snapshot_output_create_from_payload(struct lttng_payload_view *vie
        }
 
        *output_p = output;
-       output = NULL;
+       output = nullptr;
        ret = sizeof(*comm);
 
 end:
index e3aeb8314858badb81ab71684489025e481d6475..150fa4e94bafe948ba3d4f96cb59f1365adddb22 100644 (file)
@@ -46,13 +46,13 @@ const struct viewer {
 } viewers[] = {
        { "babeltrace", VIEWER_BABELTRACE },
        { "babeltrace2", VIEWER_BABELTRACE2 },
-       { NULL, VIEWER_USER_DEFINED },
+       { nullptr, VIEWER_USER_DEFINED },
 };
 } /* namespace */
 
 static const struct viewer *parse_viewer_option(const char *opt_viewer)
 {
-       if (opt_viewer == NULL) {
+       if (opt_viewer == nullptr) {
                /* Default is babeltrace2 */
                return &(viewers[VIEWER_BABELTRACE2]);
        }
@@ -70,7 +70,7 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path)
 {
        int i = 0, ignore_space = 0;
        unsigned int num_opts = 1;
-       char **argv, *token = opts, *saveptr = NULL;
+       char **argv, *token = opts, *saveptr = nullptr;
 
        /* Count number of arguments. */
        do {
@@ -88,22 +88,22 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path)
 
        /* Add two here for the NULL terminating element and trace path */
        argv = calloc<char *>(num_opts + 2);
-       if (argv == NULL) {
+       if (argv == nullptr) {
                goto error;
        }
 
        token = strtok_r(opts, " ", &saveptr);
-       while (token != NULL) {
+       while (token != nullptr) {
                argv[i] = strdup(token);
-               if (argv[i] == NULL) {
+               if (argv[i] == nullptr) {
                        goto error;
                }
-               token = strtok_r(NULL, " ", &saveptr);
+               token = strtok_r(nullptr, " ", &saveptr);
                i++;
        }
 
        argv[num_opts] = (char *) trace_path;
-       argv[num_opts + 1] = NULL;
+       argv[num_opts + 1] = nullptr;
 
        return argv;
 
@@ -115,7 +115,7 @@ error:
                free(argv);
        }
 
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -143,7 +143,7 @@ static char **alloc_argv_from_local_opts(const char **opts,
        }
 
        argv = calloc<char *>(mem_len);
-       if (argv == NULL) {
+       if (argv == nullptr) {
                goto error;
        }
 
@@ -153,10 +153,10 @@ static char **alloc_argv_from_local_opts(const char **opts,
                argv[opts_len] = (char *) "-i";
                argv[opts_len + 1] = (char *) "lttng-live";
                argv[opts_len + 2] = (char *) trace_path;
-               argv[opts_len + 3] = NULL;
+               argv[opts_len + 3] = nullptr;
        } else {
                argv[opts_len] = (char *) trace_path;
-               argv[opts_len + 1] = NULL;
+               argv[opts_len + 1] = nullptr;
        }
 
 error:
@@ -170,13 +170,13 @@ int spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode)
 {
        int ret = 0;
        struct stat status;
-       const char *viewer_bin = NULL;
+       const char *viewer_bin = nullptr;
        const struct viewer *viewer;
-       char **argv = NULL;
+       char **argv = nullptr;
 
        /* Check for --viewer option. */
        viewer = parse_viewer_option(opt_viewer);
-       if (viewer == NULL) {
+       if (viewer == nullptr) {
                ret = -1;
                goto error;
        }
@@ -211,7 +211,7 @@ retry_viewer:
                abort();
        }
 
-       if (argv == NULL || !viewer_bin) {
+       if (argv == nullptr || !viewer_bin) {
                ret = -1;
                goto error;
        }
@@ -228,7 +228,7 @@ retry_viewer:
                                    viewers[VIEWER_BABELTRACE].exec_name);
                                viewer = &viewers[VIEWER_BABELTRACE];
                                free(argv);
-                               argv = NULL;
+                               argv = nullptr;
                                goto retry_viewer;
                        } else {
                                ERR("Default viewer \"%s\" (and fallback \"%s\") not found on the system",
index 3fecd87a1b00e6c02c72c6e87001b8a500f9d9bf..63de5267442721ac861ffb666c6a6b42d332ccb4 100644 (file)
@@ -375,7 +375,7 @@ int strutils_append_str(char **s, const char *append)
 {
        char *old = *s;
        char *new_str;
-       size_t oldlen = (old == NULL) ? 0 : strlen(old);
+       size_t oldlen = (old == nullptr) ? 0 : strlen(old);
        size_t appendlen = strlen(append);
 
        new_str = zmalloc<char>(oldlen + appendlen + 1);
@@ -400,7 +400,7 @@ int strutils_appendf(char **s, const char *fmt, ...)
 
        /* Compute length of formatted string we append. */
        va_start(args, fmt);
-       ret = vsnprintf(NULL, 0, fmt, args);
+       ret = vsnprintf(nullptr, 0, fmt, args);
        va_end(args);
 
        if (ret == -1) {
@@ -431,7 +431,7 @@ int strutils_appendf(char **s, const char *fmt, ...)
 
        free(*s);
        *s = new_str;
-       new_str = NULL;
+       new_str = nullptr;
 
 end:
        return ret;
index 753b79594754c8e96875faec3ccfa0a7c6d5c72d..7d41fae5fa381d5299012a400799ccc940fd9d36 100644 (file)
@@ -23,12 +23,12 @@ int lttng_testpoint_activated;
 /*
  * Toggle the support for testpoints on the application startup.
  */
-static void __attribute__((constructor)) lttng_testpoint_check(void)
+static void __attribute__((constructor)) lttng_testpoint_check()
 {
-       char *testpoint_env_val = NULL;
+       char *testpoint_env_val = nullptr;
 
        testpoint_env_val = getenv(lttng_testpoint_env_var);
-       if (testpoint_env_val != NULL && (strncmp(testpoint_env_val, "1", 1) == 0)) {
+       if (testpoint_env_val != nullptr && (strncmp(testpoint_env_val, "1", 1) == 0)) {
                lttng_testpoint_activated = 1;
        }
 }
@@ -42,7 +42,7 @@ static void __attribute__((constructor)) lttng_testpoint_check(void)
 void *lttng_testpoint_lookup(const char *name)
 {
        if (!name) {
-               return NULL;
+               return nullptr;
        }
 
        return dlsym(RTLD_DEFAULT, name);
index 5155eb82cf1a74329fa7b0a94ca169e619a36ffa..ca29b2d61891efad38919300ee6771cc70f7008d 100644 (file)
@@ -21,7 +21,7 @@
 
 static bool utf8_output_supported;
 
-bool locale_supports_utf8(void)
+bool locale_supports_utf8()
 {
        return utf8_output_supported;
 }
@@ -57,9 +57,9 @@ struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2)
        return res;
 }
 
-static void __attribute__((constructor)) init_locale_utf8_support(void)
+static void __attribute__((constructor)) init_locale_utf8_support()
 {
-       const char *program_locale = setlocale(LC_ALL, NULL);
+       const char *program_locale = setlocale(LC_ALL, nullptr);
        const char *lang = getenv("LANG");
 
        if (program_locale && strstr(program_locale, "utf8")) {
index 34c41a08adbd9837018489546c4dcc2a7894bd36..2c52f334cfe00b29aeb3e125f1e707413dbbc0a5 100644 (file)
@@ -32,7 +32,7 @@
 #define ISO8601_STR_LEN sizeof("YYYYmmddTHHMMSS+HHMM")
 #define DATETIME_STR_LEN sizeof("YYYYmmdd-HHMMSS")
 
-bool locale_supports_utf8(void);
+bool locale_supports_utf8();
 
 #define NSEC_UNIT       "ns"
 #define USEC_UNIT       (locale_supports_utf8() ? "µs" : "us")
index e634e71e8163b67b283185f2f9788013185bc220..3731f33ba4569e62b089085f2e0671e00a481228 100644 (file)
@@ -31,7 +31,7 @@ struct lttng_trace_chunk_registry;
  *
  * Note that a trace chunk registry may only be accessed by an RCU thread.
  */
-struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void);
+struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create();
 
 /*
  * Destroy an lttng trace chunk registry. The registry must be emptied
index f38a93b90930b3abd357574a34f009d1807f17b1..2be4224f950167675df9b46e155fb4a34ff44270 100644 (file)
@@ -188,7 +188,7 @@ static struct fs_handle *fs_handle_untracked_create(struct lttng_directory_handl
                                                    const char *path,
                                                    int fd)
 {
-       struct fs_handle_untracked *handle = NULL;
+       struct fs_handle_untracked *handle = nullptr;
        bool reference_acquired;
        char *path_copy = strdup(path);
 
@@ -217,10 +217,10 @@ static struct fs_handle *fs_handle_untracked_create(struct lttng_directory_handl
        handle->location.directory_handle = directory_handle;
        /* Ownership is transferred. */
        handle->location.path = path_copy;
-       path_copy = NULL;
+       path_copy = nullptr;
 end:
        free(path_copy);
-       return handle ? &handle->parent : NULL;
+       return handle ? &handle->parent : nullptr;
 }
 
 static int fs_handle_untracked_get_fd(struct fs_handle *_handle)
@@ -305,7 +305,7 @@ static char *
 generate_chunk_name(uint64_t chunk_id, time_t creation_timestamp, const time_t *close_timestamp)
 {
        int ret = 0;
-       char *new_name = NULL;
+       char *new_name = nullptr;
        char start_datetime[ISO8601_STR_LEN] = {};
        /* Add 1 for a '-' prefix. */
        char end_datetime_suffix[ISO8601_STR_LEN + 1] = {};
@@ -343,13 +343,13 @@ generate_chunk_name(uint64_t chunk_id, time_t creation_timestamp, const time_t *
        return new_name;
 error:
        free(new_name);
-       return NULL;
+       return nullptr;
 }
 
 static void lttng_trace_chunk_init(struct lttng_trace_chunk *chunk)
 {
        urcu_ref_init(&chunk->ref);
-       pthread_mutex_init(&chunk->lock, NULL);
+       pthread_mutex_init(&chunk->lock, nullptr);
        lttng_dynamic_pointer_array_init(&chunk->top_level_directories, free);
        lttng_dynamic_pointer_array_init(&chunk->files, free);
 }
@@ -358,24 +358,24 @@ static void lttng_trace_chunk_fini(struct lttng_trace_chunk *chunk)
 {
        if (chunk->session_output_directory) {
                lttng_directory_handle_put(chunk->session_output_directory);
-               chunk->session_output_directory = NULL;
+               chunk->session_output_directory = nullptr;
        }
        if (chunk->chunk_directory) {
                lttng_directory_handle_put(chunk->chunk_directory);
-               chunk->chunk_directory = NULL;
+               chunk->chunk_directory = nullptr;
        }
        free(chunk->name);
-       chunk->name = NULL;
+       chunk->name = nullptr;
        free(chunk->path);
-       chunk->path = NULL;
+       chunk->path = nullptr;
        lttng_dynamic_pointer_array_reset(&chunk->top_level_directories);
        lttng_dynamic_pointer_array_reset(&chunk->files);
        pthread_mutex_destroy(&chunk->lock);
 }
 
-static struct lttng_trace_chunk *lttng_trace_chunk_allocate(void)
+static struct lttng_trace_chunk *lttng_trace_chunk_allocate()
 {
-       struct lttng_trace_chunk *chunk = NULL;
+       struct lttng_trace_chunk *chunk = nullptr;
 
        chunk = zmalloc<lttng_trace_chunk>();
        if (!chunk) {
@@ -387,7 +387,7 @@ end:
        return chunk;
 }
 
-struct lttng_trace_chunk *lttng_trace_chunk_create_anonymous(void)
+struct lttng_trace_chunk *lttng_trace_chunk_create_anonymous()
 {
        DBG("Creating anonymous trace chunk");
        return lttng_trace_chunk_allocate();
@@ -426,7 +426,7 @@ lttng_trace_chunk_create(uint64_t chunk_id, time_t chunk_creation_time, const ch
        LTTNG_OPTIONAL_SET(&chunk->id, chunk_id);
        LTTNG_OPTIONAL_SET(&chunk->timestamp_creation, chunk_creation_time);
        if (chunk_id != 0) {
-               chunk->name = generate_chunk_name(chunk_id, chunk_creation_time, NULL);
+               chunk->name = generate_chunk_name(chunk_id, chunk_creation_time, nullptr);
                if (!chunk->name) {
                        ERR("Failed to allocate trace chunk name storage");
                        goto error;
@@ -451,7 +451,7 @@ end:
        return chunk;
 error:
        lttng_trace_chunk_put(chunk);
-       return NULL;
+       return nullptr;
 }
 
 void lttng_trace_chunk_set_fd_tracker(struct lttng_trace_chunk *chunk,
@@ -526,7 +526,7 @@ end:
 error_unlock:
        pthread_mutex_unlock(&source_chunk->lock);
        lttng_trace_chunk_put(new_chunk);
-       return NULL;
+       return nullptr;
 }
 
 enum lttng_trace_chunk_status lttng_trace_chunk_get_id(struct lttng_trace_chunk *chunk,
@@ -718,7 +718,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
 
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
-       struct lttng_directory_handle *rename_directory = NULL;
+       struct lttng_directory_handle *rename_directory = nullptr;
        char *new_path, *old_path;
        int ret;
 
@@ -763,7 +763,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
                        chunk->session_output_directory,
                        path,
                        LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
-                               NULL :
+                               nullptr :
                                &chunk->credentials.value.user);
                if (ret) {
                        PERROR("Failed to move trace chunk directory \"%s\" to \"%s\"",
@@ -790,7 +790,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
                 * handle.
                 */
                chunk->chunk_directory = rename_directory;
-               rename_directory = NULL;
+               rename_directory = nullptr;
        } else if (old_path && old_path[0] == '\0') {
                size_t i,
                        count = lttng_dynamic_pointer_array_get_count(
@@ -801,7 +801,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
                        path,
                        DIR_CREATION_MODE,
                        LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
-                               NULL :
+                               nullptr :
                                &chunk->credentials.value.user);
                if (ret) {
                        PERROR("Failed to create trace chunk rename directory \"%s\"", path);
@@ -829,7 +829,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
                                rename_directory,
                                top_level_name,
                                LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
-                                       NULL :
+                                       nullptr :
                                        &chunk->credentials.value.user);
                        if (ret) {
                                PERROR("Failed to move \"%s\" to trace chunk rename directory",
@@ -845,7 +845,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
                 * handle.
                 */
                chunk->chunk_directory = rename_directory;
-               rename_directory = NULL;
+               rename_directory = nullptr;
        } else if (old_path) {
                size_t i,
                        count = lttng_dynamic_pointer_array_get_count(
@@ -868,7 +868,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
                                rename_directory,
                                top_level_name,
                                LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
-                                       NULL :
+                                       nullptr :
                                        &chunk->credentials.value.user);
                        if (ret) {
                                PERROR("Failed to move \"%s\" to trace chunk rename directory",
@@ -884,7 +884,7 @@ lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const cha
                 * handle.
                 */
                chunk->chunk_directory = rename_directory;
-               rename_directory = NULL;
+               rename_directory = nullptr;
 
                /* Remove old directory. */
                status = (lttng_trace_chunk_status) lttng_directory_handle_remove_subdirectory(
@@ -994,7 +994,7 @@ lttng_trace_chunk_set_as_owner(struct lttng_trace_chunk *chunk,
 {
        int ret;
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
-       struct lttng_directory_handle *chunk_directory_handle = NULL;
+       struct lttng_directory_handle *chunk_directory_handle = nullptr;
        bool reference_acquired;
 
        pthread_mutex_lock(&chunk->lock);
@@ -1018,7 +1018,7 @@ lttng_trace_chunk_set_as_owner(struct lttng_trace_chunk *chunk,
                        DIR_CREATION_MODE,
                        !chunk->credentials.value.use_current_user ?
                                &chunk->credentials.value.user :
-                               NULL);
+                               nullptr);
                if (ret) {
                        PERROR("Failed to create chunk output directory \"%s\"", chunk->path);
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
@@ -1045,7 +1045,7 @@ lttng_trace_chunk_set_as_owner(struct lttng_trace_chunk *chunk,
                chunk_directory_handle = session_output_directory;
        }
        chunk->chunk_directory = chunk_directory_handle;
-       chunk_directory_handle = NULL;
+       chunk_directory_handle = nullptr;
        reference_acquired = lttng_directory_handle_get(session_output_directory);
        LTTNG_ASSERT(reference_acquired);
        chunk->session_output_directory = session_output_directory;
@@ -1090,7 +1090,7 @@ lttng_trace_chunk_get_session_output_directory_handle(struct lttng_trace_chunk *
        pthread_mutex_lock(&chunk->lock);
        if (!chunk->session_output_directory) {
                status = LTTNG_TRACE_CHUNK_STATUS_NONE;
-               *handle = NULL;
+               *handle = nullptr;
                goto end;
        } else {
                const bool reference_acquired =
@@ -1207,7 +1207,8 @@ enum lttng_trace_chunk_status lttng_trace_chunk_create_subdirectory(struct lttng
                chunk->chunk_directory,
                path,
                DIR_CREATION_MODE,
-               chunk->credentials.value.use_current_user ? NULL : &chunk->credentials.value.user);
+               chunk->credentials.value.use_current_user ? nullptr :
+                                                           &chunk->credentials.value.user);
        if (ret) {
                PERROR("Failed to create trace chunk subdirectory \"%s\"", path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
@@ -1252,7 +1253,7 @@ static enum lttng_trace_chunk_status lttng_trace_chunk_add_file(struct lttng_tra
        int ret;
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
-       if (lttng_trace_chunk_find_file(chunk, path, NULL)) {
+       if (lttng_trace_chunk_find_file(chunk, path, nullptr)) {
                return LTTNG_TRACE_CHUNK_STATUS_OK;
        }
        DBG("Adding new file \"%s\" to trace chunk \"%s\"", path, chunk->name ?: "(unnamed)");
@@ -1330,7 +1331,7 @@ _lttng_trace_chunk_open_fs_handle_locked(struct lttng_trace_chunk *chunk,
                        file_path,
                        flags,
                        mode,
-                       chunk->credentials.value.use_current_user ? NULL :
+                       chunk->credentials.value.use_current_user ? nullptr :
                                                                    &chunk->credentials.value.user);
                if (ret >= 0) {
                        *out_handle =
@@ -1429,10 +1430,11 @@ int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk, const char *f
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
-       ret = lttng_directory_handle_unlink_file_as_user(
-               chunk->chunk_directory,
-               file_path,
-               chunk->credentials.value.use_current_user ? NULL : &chunk->credentials.value.user);
+       ret = lttng_directory_handle_unlink_file_as_user(chunk->chunk_directory,
+                                                        file_path,
+                                                        chunk->credentials.value.use_current_user ?
+                                                                nullptr :
+                                                                &chunk->credentials.value.user);
        if (ret < 0) {
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
@@ -1470,7 +1472,8 @@ static int lttng_trace_chunk_remove_subdirectory_recursive(struct lttng_trace_ch
        ret = lttng_directory_handle_remove_subdirectory_recursive_as_user(
                chunk->chunk_directory,
                path,
-               chunk->credentials.value.use_current_user ? NULL : &chunk->credentials.value.user,
+               chunk->credentials.value.use_current_user ? nullptr :
+                                                           &chunk->credentials.value.user,
                LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
        if (ret < 0) {
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
@@ -1484,11 +1487,11 @@ end:
 static int lttng_trace_chunk_move_to_completed_post_release(struct lttng_trace_chunk *trace_chunk)
 {
        int ret = 0;
-       char *archived_chunk_name = NULL;
+       char *archived_chunk_name = nullptr;
        const uint64_t chunk_id = LTTNG_OPTIONAL_GET(trace_chunk->id);
        const time_t creation_timestamp = LTTNG_OPTIONAL_GET(trace_chunk->timestamp_creation);
        const time_t close_timestamp = LTTNG_OPTIONAL_GET(trace_chunk->timestamp_close);
-       struct lttng_directory_handle *archived_chunks_directory = NULL;
+       struct lttng_directory_handle *archived_chunks_directory = nullptr;
        enum lttng_trace_chunk_status status;
 
        if (!trace_chunk->mode.is_set || trace_chunk->mode.value != TRACE_CHUNK_MODE_OWNER ||
@@ -1517,7 +1520,7 @@ static int lttng_trace_chunk_move_to_completed_post_release(struct lttng_trace_c
                DIR_CREATION_MODE,
                !trace_chunk->credentials.value.use_current_user ?
                        &trace_chunk->credentials.value.user :
-                       NULL);
+                       nullptr);
        if (ret) {
                PERROR("Failed to create \"" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY
                       "\" directory for archived trace chunks");
@@ -1558,7 +1561,7 @@ static int lttng_trace_chunk_move_to_completed_post_release(struct lttng_trace_c
                archived_chunks_directory,
                archived_chunk_name,
                LTTNG_OPTIONAL_GET(trace_chunk->credentials).use_current_user ?
-                       NULL :
+                       nullptr :
                        &trace_chunk->credentials.value.user);
        if (ret) {
                PERROR("Failed to rename folder \"%s\" to \"%s\"",
@@ -1639,7 +1642,7 @@ static int lttng_trace_chunk_delete_post_release_owner(struct lttng_trace_chunk
        }
        if (!ret) {
                lttng_directory_handle_put(trace_chunk->chunk_directory);
-               trace_chunk->chunk_directory = NULL;
+               trace_chunk->chunk_directory = nullptr;
 
                if (trace_chunk->path && trace_chunk->path[0] != '\0') {
                        status = (lttng_trace_chunk_status)
@@ -1653,7 +1656,7 @@ static int lttng_trace_chunk_delete_post_release_owner(struct lttng_trace_chunk
                }
        }
        free(trace_chunk->path);
-       trace_chunk->path = NULL;
+       trace_chunk->path = nullptr;
 end:
        return ret;
 }
@@ -1848,7 +1851,7 @@ void lttng_trace_chunk_put(struct lttng_trace_chunk *chunk)
        urcu_ref_put(&chunk->ref, lttng_trace_chunk_release);
 }
 
-struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void)
+struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create()
 {
        struct lttng_trace_chunk_registry *registry;
 
@@ -1858,7 +1861,7 @@ struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void)
        }
 
        registry->ht = cds_lfht_new(
-               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
        if (!registry->ht) {
                goto error;
        }
@@ -1866,7 +1869,7 @@ end:
        return registry;
 error:
        lttng_trace_chunk_registry_destroy(registry);
-       return NULL;
+       return nullptr;
 }
 
 void lttng_trace_chunk_registry_destroy(struct lttng_trace_chunk_registry *registry)
@@ -1875,7 +1878,7 @@ void lttng_trace_chunk_registry_destroy(struct lttng_trace_chunk_registry *regis
                return;
        }
        if (registry->ht) {
-               int ret = cds_lfht_destroy(registry->ht, NULL);
+               int ret = cds_lfht_destroy(registry->ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        free(registry);
@@ -1899,19 +1902,19 @@ lttng_trace_chunk_registry_element_create_from_chunk(struct lttng_trace_chunk *c
        if (chunk->session_output_directory) {
                /* Transferred ownership. */
                element->chunk.session_output_directory = chunk->session_output_directory;
-               chunk->session_output_directory = NULL;
+               chunk->session_output_directory = nullptr;
        }
        if (chunk->chunk_directory) {
                /* Transferred ownership. */
                element->chunk.chunk_directory = chunk->chunk_directory;
-               chunk->chunk_directory = NULL;
+               chunk->chunk_directory = nullptr;
        }
        /*
         * The original chunk becomes invalid; the name and path attributes are
         * transferred to the new chunk instance.
         */
-       chunk->name = NULL;
-       chunk->path = NULL;
+       chunk->name = nullptr;
+       chunk->path = nullptr;
        element->chunk.fd_tracker = chunk->fd_tracker;
        element->chunk.in_registry_element = true;
 end:
@@ -1947,11 +1950,11 @@ lttng_trace_chunk_registry_publish_chunk(struct lttng_trace_chunk_registry *regi
         * chunk is now invalid, the only valid operation is a 'put' from the
         * caller.
         */
-       chunk = NULL;
+       chunk = nullptr;
        element_hash = lttng_trace_chunk_registry_element_hash(element);
 
        rcu_read_lock();
-       while (1) {
+       while (true) {
                struct cds_lfht_node *published_node;
                struct lttng_trace_chunk *published_chunk;
                struct lttng_trace_chunk_registry_element *published_element;
@@ -2004,7 +2007,7 @@ lttng_trace_chunk_registry_publish_chunk(struct lttng_trace_chunk_registry *regi
        }
        rcu_read_unlock();
 end:
-       return element ? &element->chunk : NULL;
+       return element ? &element->chunk : nullptr;
 }
 
 /*
@@ -2028,7 +2031,7 @@ static struct lttng_trace_chunk *_lttng_trace_chunk_registry_find_chunk(
        const unsigned long element_hash = lttng_trace_chunk_registry_element_hash(&target_element);
        struct cds_lfht_node *published_node;
        struct lttng_trace_chunk_registry_element *published_element;
-       struct lttng_trace_chunk *published_chunk = NULL;
+       struct lttng_trace_chunk *published_chunk = nullptr;
        struct cds_lfht_iter iter;
 
        rcu_read_lock();
@@ -2096,7 +2099,7 @@ struct lttng_trace_chunk *
 lttng_trace_chunk_registry_find_anonymous_chunk(const struct lttng_trace_chunk_registry *registry,
                                                uint64_t session_id)
 {
-       return _lttng_trace_chunk_registry_find_chunk(registry, session_id, NULL);
+       return _lttng_trace_chunk_registry_find_chunk(registry, session_id, nullptr);
 }
 
 unsigned int
index cf038b9512401c9d6ddce0420e8939249444f9fe..3fcf833c21ecba8b8ec0053323014b0dea97700f 100644 (file)
@@ -70,7 +70,7 @@ enum lttng_trace_chunk_command_type {
        LTTNG_TRACE_CHUNK_COMMAND_TYPE_MAX,
 };
 
-struct lttng_trace_chunk *lttng_trace_chunk_create_anonymous(void);
+struct lttng_trace_chunk *lttng_trace_chunk_create_anonymous();
 
 struct lttng_trace_chunk *lttng_trace_chunk_create(
                uint64_t chunk_id,
index d6669b6f87eabb1a2b3829f106b1b05c9d5c5a69..1f292a3f02981653fd90682bc88e6733c45d98b4 100644 (file)
@@ -67,7 +67,7 @@ process_attr_value_from_comm(enum lttng_domain_type domain,
                             const struct lttng_buffer_view *value_view,
                             struct process_attr_value **_value)
 {
-       char *name = NULL;
+       char *name = nullptr;
        enum lttng_error_code ret = LTTNG_OK;
        struct process_attr_value *value = zmalloc<process_attr_value>();
 
@@ -133,7 +133,7 @@ process_attr_value_from_comm(enum lttng_domain_type domain,
                        }
 
                        value->value.user_name = name;
-                       name = NULL;
+                       name = nullptr;
                        break;
                default:
                        ERR("Invalid value type used for user ID process attribute");
@@ -154,7 +154,7 @@ process_attr_value_from_comm(enum lttng_domain_type domain,
                        }
 
                        value->value.group_name = name;
-                       name = NULL;
+                       name = nullptr;
                        break;
                default:
                        ERR("Invalid value type used for group ID process attribute");
@@ -168,7 +168,7 @@ process_attr_value_from_comm(enum lttng_domain_type domain,
        }
 
        *_value = value;
-       value = NULL;
+       value = nullptr;
        free(name);
        return LTTNG_OK;
 error:
@@ -204,7 +204,7 @@ static void process_attr_tracker_value_destructor(void *ptr)
        process_attr_value_destroy(value);
 }
 
-struct lttng_process_attr_values *lttng_process_attr_values_create(void)
+struct lttng_process_attr_values *lttng_process_attr_values_create()
 {
        struct lttng_process_attr_values *values = zmalloc<lttng_process_attr_values>();
 
@@ -238,7 +238,7 @@ static int process_attr_tracker_value_serialize(const struct process_attr_value
                .type = (int32_t) value->type,
                .value = {},
        };
-       const char *name = NULL;
+       const char *name = nullptr;
 
        switch (value->type) {
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_PID:
@@ -398,7 +398,7 @@ void lttng_process_attr_values_destroy(struct lttng_process_attr_values *values)
 
 struct process_attr_value *process_attr_value_copy(const struct process_attr_value *value)
 {
-       struct process_attr_value *new_value = NULL;
+       struct process_attr_value *new_value = nullptr;
 
        if (!value) {
                goto end;
@@ -428,7 +428,7 @@ end:
        return new_value;
 error:
        free(new_value);
-       return NULL;
+       return nullptr;
 }
 
 unsigned long process_attr_value_hash(const struct process_attr_value *a)
index 7f4702a7d262204e215cba063221f3772d1149d9..e53a2a18535627fd6ce13edbd7b69e77a2b958a1 100644 (file)
@@ -35,7 +35,7 @@ struct lttng_process_attr_values {
 
 const char *lttng_process_attr_to_string(enum lttng_process_attr process_attr);
 
-struct lttng_process_attr_values *lttng_process_attr_values_create(void);
+struct lttng_process_attr_values *lttng_process_attr_values_create();
 
 /* Prefixed with '_' since the name conflicts with a public API. */
 unsigned int _lttng_process_attr_values_get_count(
index 927860edf343df8bcc171088a10eefda3910fbd2..75892542cd090d82be20c9d53692102873e4fbaf 100644 (file)
@@ -50,7 +50,7 @@ end:
 struct lttng_trigger *lttng_trigger_create(struct lttng_condition *condition,
                                           struct lttng_action *action)
 {
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_trigger *trigger = nullptr;
 
        if (!condition || !action) {
                goto end;
@@ -69,7 +69,7 @@ struct lttng_trigger *lttng_trigger_create(struct lttng_condition *condition,
        lttng_action_get(action);
        trigger->action = action;
 
-       pthread_mutex_init(&trigger->lock, NULL);
+       pthread_mutex_init(&trigger->lock, nullptr);
        trigger->registered = false;
 
 end:
@@ -83,12 +83,12 @@ end:
  */
 struct lttng_condition *lttng_trigger_get_condition(struct lttng_trigger *trigger)
 {
-       return trigger ? trigger->condition : NULL;
+       return trigger ? trigger->condition : nullptr;
 }
 
 const struct lttng_condition *lttng_trigger_get_const_condition(const struct lttng_trigger *trigger)
 {
-       return trigger ? trigger->condition : NULL;
+       return trigger ? trigger->condition : nullptr;
 }
 
 /*
@@ -98,12 +98,12 @@ const struct lttng_condition *lttng_trigger_get_const_condition(const struct ltt
  */
 struct lttng_action *lttng_trigger_get_action(struct lttng_trigger *trigger)
 {
-       return trigger ? trigger->action : NULL;
+       return trigger ? trigger->action : nullptr;
 }
 
 const struct lttng_action *lttng_trigger_get_const_action(const struct lttng_trigger *trigger)
 {
-       return trigger ? trigger->action : NULL;
+       return trigger ? trigger->action : nullptr;
 }
 
 static void trigger_destroy_ref(struct urcu_ref *ref)
@@ -134,15 +134,15 @@ ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *src_view,
                                          struct lttng_trigger **_trigger)
 {
        ssize_t ret, offset = 0, condition_size, action_size, name_size = 0;
-       struct lttng_condition *condition = NULL;
-       struct lttng_action *action = NULL;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_action *action = nullptr;
        const struct lttng_trigger_comm *trigger_comm;
-       const char *name = NULL;
+       const char *name = nullptr;
        struct lttng_credentials creds = {
                .uid = LTTNG_OPTIONAL_INIT_UNSET,
                .gid = LTTNG_OPTIONAL_INIT_UNSET,
        };
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_trigger *trigger = nullptr;
        const struct lttng_payload_view trigger_comm_view =
                lttng_payload_view_from_view(src_view, 0, sizeof(*trigger_comm));
 
@@ -239,10 +239,10 @@ ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *src_view,
         * objects.
         */
        lttng_condition_put(condition);
-       condition = NULL;
+       condition = nullptr;
 
        lttng_action_put(action);
-       action = NULL;
+       action = nullptr;
 
        if (name) {
                const enum lttng_trigger_status status = lttng_trigger_set_name(trigger, name);
@@ -282,14 +282,14 @@ int lttng_trigger_serialize(const struct lttng_trigger *trigger, struct lttng_pa
        size_t header_offset, size_before_payload, size_name;
        struct lttng_trigger_comm trigger_comm = {};
        struct lttng_trigger_comm *header;
-       const struct lttng_credentials *creds = NULL;
+       const struct lttng_credentials *creds = nullptr;
 
        creds = lttng_trigger_get_credentials(trigger);
        LTTNG_ASSERT(creds);
 
        trigger_comm.uid = LTTNG_OPTIONAL_GET(creds->uid);
 
-       if (trigger->name != NULL) {
+       if (trigger->name != nullptr) {
                size_name = strlen(trigger->name) + 1;
        } else {
                size_name = 0;
@@ -375,7 +375,7 @@ void lttng_trigger_set_hidden(struct lttng_trigger *trigger)
 
 enum lttng_trigger_status lttng_trigger_set_name(struct lttng_trigger *trigger, const char *name)
 {
-       char *name_copy = NULL;
+       char *name_copy = nullptr;
        enum lttng_trigger_status status = LTTNG_TRIGGER_STATUS_OK;
 
        if (!trigger) {
@@ -394,7 +394,7 @@ enum lttng_trigger_status lttng_trigger_set_name(struct lttng_trigger *trigger,
        free(trigger->name);
 
        trigger->name = name_copy;
-       name_copy = NULL;
+       name_copy = nullptr;
 end:
        return status;
 }
@@ -449,7 +449,7 @@ uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger *trigger)
 int lttng_trigger_generate_name(struct lttng_trigger *trigger, uint64_t unique_id)
 {
        int ret = 0;
-       char *generated_name = NULL;
+       char *generated_name = nullptr;
 
        ret = asprintf(&generated_name, "trigger%" PRIu64 "", unique_id);
        if (ret < 0) {
@@ -486,9 +486,9 @@ static void delete_trigger_array_element(void *ptr)
        lttng_trigger_put(trigger);
 }
 
-struct lttng_triggers *lttng_triggers_create(void)
+struct lttng_triggers *lttng_triggers_create()
 {
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
 
        triggers = zmalloc<lttng_triggers>();
        if (!triggers) {
@@ -504,7 +504,7 @@ end:
 struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(const struct lttng_triggers *triggers,
                                                             unsigned int index)
 {
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_trigger *trigger = nullptr;
 
        LTTNG_ASSERT(triggers);
        if (index >= lttng_dynamic_pointer_array_get_count(&triggers->array)) {
@@ -646,7 +646,7 @@ ssize_t lttng_triggers_create_from_payload(struct lttng_payload_view *src_view,
        ssize_t ret, offset = 0, triggers_size = 0;
        unsigned int i;
        const struct lttng_triggers_comm *triggers_comm;
-       struct lttng_triggers *local_triggers = NULL;
+       struct lttng_triggers *local_triggers = nullptr;
 
        if (!src_view || !triggers) {
                ret = -1;
@@ -664,7 +664,7 @@ ssize_t lttng_triggers_create_from_payload(struct lttng_payload_view *src_view,
        }
 
        for (i = 0; i < triggers_comm->count; i++) {
-               struct lttng_trigger *trigger = NULL;
+               struct lttng_trigger *trigger = nullptr;
                struct lttng_payload_view trigger_view =
                        lttng_payload_view_from_view(src_view, offset, -1);
                ssize_t trigger_size;
@@ -695,7 +695,7 @@ ssize_t lttng_triggers_create_from_payload(struct lttng_payload_view *src_view,
 
        /* Pass ownership to caller. */
        *triggers = local_triggers;
-       local_triggers = NULL;
+       local_triggers = nullptr;
 
        ret = offset;
 error:
@@ -748,7 +748,7 @@ enum lttng_trigger_status lttng_trigger_get_owner_uid(const struct lttng_trigger
                                                      uid_t *uid)
 {
        enum lttng_trigger_status ret = LTTNG_TRIGGER_STATUS_OK;
-       const struct lttng_credentials *creds = NULL;
+       const struct lttng_credentials *creds = nullptr;
 
        if (!trigger || !uid) {
                ret = LTTNG_TRIGGER_STATUS_INVALID;
@@ -816,7 +816,7 @@ enum lttng_error_code lttng_trigger_generate_bytecode(struct lttng_trigger *trig
                                                      const struct lttng_credentials *creds)
 {
        enum lttng_error_code ret;
-       struct lttng_condition *condition = NULL;
+       struct lttng_condition *condition = nullptr;
 
        condition = lttng_trigger_get_condition(trigger);
        if (!condition) {
@@ -862,9 +862,9 @@ struct lttng_trigger *lttng_trigger_copy(const struct lttng_trigger *trigger)
 {
        int ret;
        struct lttng_payload copy_buffer;
-       struct lttng_condition *condition_copy = NULL;
-       struct lttng_action *action_copy = NULL;
-       struct lttng_trigger *copy = NULL;
+       struct lttng_condition *condition_copy = nullptr;
+       struct lttng_action *action_copy = nullptr;
+       struct lttng_trigger *copy = nullptr;
        enum lttng_trigger_status trigger_status;
        const char *trigger_name;
        uid_t trigger_owner_uid;
@@ -944,7 +944,7 @@ struct lttng_trigger *lttng_trigger_copy(const struct lttng_trigger *trigger)
 
 error_cleanup_trigger:
        lttng_trigger_destroy(copy);
-       copy = NULL;
+       copy = nullptr;
 end:
        lttng_condition_put(condition_copy);
        lttng_action_put(action_copy);
@@ -1020,15 +1020,15 @@ lttng_trigger_mi_serialize(const struct lttng_trigger *trigger,
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_trigger_status trigger_status;
-       const struct lttng_condition *condition = NULL;
-       const struct lttng_action *action = NULL;
+       const struct lttng_condition *condition = nullptr;
+       const struct lttng_action *action = nullptr;
        struct lttng_dynamic_array action_path_indexes;
        uid_t owner_uid;
 
        LTTNG_ASSERT(trigger);
        LTTNG_ASSERT(writer);
 
-       lttng_dynamic_array_init(&action_path_indexes, sizeof(uint64_t), NULL);
+       lttng_dynamic_array_init(&action_path_indexes, sizeof(uint64_t), nullptr);
 
        /* Open trigger element. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_trigger);
@@ -1070,7 +1070,7 @@ lttng_trigger_mi_serialize(const struct lttng_trigger *trigger,
        }
 
        if (error_query_callbacks && error_query_callbacks->trigger_cb) {
-               struct lttng_error_query_results *results = NULL;
+               struct lttng_error_query_results *results = nullptr;
 
                ret_code = error_query_callbacks->trigger_cb(trigger, &results);
                if (ret_code != LTTNG_OK) {
@@ -1136,7 +1136,7 @@ lttng_triggers_mi_serialize(const struct lttng_triggers *triggers,
         * Sort trigger by name to ensure an order at the MI level and ignore
         * any anonymous trigger present.
         */
-       lttng_dynamic_pointer_array_init(&sorted_triggers, NULL);
+       lttng_dynamic_pointer_array_init(&sorted_triggers, nullptr);
 
        status = lttng_triggers_get_count(triggers, &count);
        LTTNG_ASSERT(status == LTTNG_TRIGGER_STATUS_OK);
index 1aea70d9f194cbb78d16a2b6058cb1e385bf6051..11ab18a98567cddcf6ca2cb3513f61009150e6cf 100644 (file)
@@ -472,7 +472,7 @@ _lttcomm_send_payload_view_fds_unix_sock(int sock, struct lttng_payload_view *vi
        struct lttng_dynamic_array raw_fds;
        const int fd_count = lttng_payload_view_get_fd_handle_count(view);
 
-       lttng_dynamic_array_init(&raw_fds, sizeof(int), NULL);
+       lttng_dynamic_array_init(&raw_fds, sizeof(int), nullptr);
 
        if (fd_count < 0) {
                ret = -LTTNG_ERR_INVALID;
@@ -685,7 +685,7 @@ retry:
         * need to expect a cmsg of the SCM_CREDENTIALS as the first control
         * message.
         */
-       for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+       for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
                if (cmsg->cmsg_level != SOL_SOCKET) {
                        fprintf(stderr, "Error: The socket needs to be of type SOL_SOCKET\n");
                        ret = -1;
@@ -932,7 +932,7 @@ retry:
         * need to expect a cmsg of the SCM_CREDENTIALS as the first control
         * message.
         */
-       for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+       for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
                if (cmsg->cmsg_level != SOL_SOCKET) {
                        fprintf(stderr, "Error: The socket needs to be of type SOL_SOCKET\n");
                        ret = -1;
@@ -1095,7 +1095,7 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, lttng_sock
        }
 
        cmptr = CMSG_FIRSTHDR(&msg);
-       if (cmptr == NULL) {
+       if (cmptr == nullptr) {
                fprintf(stderr, "Error: Invalid control message header\n");
                ret = -1;
                goto end;
index e83ac8f926b9ac609f8df2bc17018db55e4a6dc6..af78bd35585e2ee1cb1b23f241eaf4ab31506960 100644 (file)
@@ -85,7 +85,7 @@ const struct uri_proto proto_uri[] = { { .name = "file",
 static inline const char *strpbrk_or_eos(const char *s, const char *accept)
 {
        char *p = (char *) strpbrk(s, accept);
-       if (p == NULL) {
+       if (p == nullptr) {
                p = (char *) strchr(s, '\0');
        }
 
@@ -97,14 +97,14 @@ static inline const char *strpbrk_or_eos(const char *s, const char *accept)
  */
 static const struct uri_proto *get_uri_proto(const char *uri_str)
 {
-       const struct uri_proto *supported = NULL;
+       const struct uri_proto *supported = nullptr;
 
        /* Safety net */
-       if (uri_str == NULL) {
+       if (uri_str == nullptr) {
                goto end;
        }
 
-       for (supported = &proto_uri[0]; supported->leading_string != NULL; ++supported) {
+       for (supported = &proto_uri[0]; supported->leading_string != nullptr; ++supported) {
                if (strncasecmp(uri_str,
                                supported->leading_string,
                                strlen(supported->leading_string)) == 0) {
@@ -113,7 +113,7 @@ static const struct uri_proto *get_uri_proto(const char *uri_str)
        }
 
        /* Proto not found */
-       return NULL;
+       return nullptr;
 
 end:
        return supported;
@@ -313,9 +313,9 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
        unsigned int ctrl_port = 0;
        unsigned int data_port = 0;
        struct lttng_uri *tmp_uris;
-       char *addr_f = NULL;
+       char *addr_f = nullptr;
        const struct uri_proto *proto;
-       const char *purl, *addr_e, *addr_b, *subdir_b = NULL;
+       const char *purl, *addr_e, *addr_b, *subdir_b = nullptr;
        const char *seps = ":/\0";
 
        /*
@@ -329,7 +329,7 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
        DBG3("URI string: %s", str_uri);
 
        proto = get_uri_proto(str_uri);
-       if (proto == NULL) {
+       if (proto == nullptr) {
                ERR("URI parse unknown protocol %s", str_uri);
                goto error;
        }
@@ -343,7 +343,7 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
 
        /* Allocate URI array */
        tmp_uris = calloc<lttng_uri>(size);
-       if (tmp_uris == NULL) {
+       if (tmp_uris == nullptr) {
                PERROR("zmalloc uri");
                goto error;
        }
@@ -382,7 +382,7 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
                /* Address begins after '[' */
                addr_b = purl + 1;
                addr_e = strchr(addr_b, ']');
-               if (addr_e == NULL || addr_b == addr_e) {
+               if (addr_e == nullptr || addr_b == addr_e) {
                        ERR("Broken IPv6 address %s", addr_b);
                        goto free_error;
                }
@@ -393,7 +393,7 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
                /*
                 * The closing bracket must be followed by a seperator or NULL char.
                 */
-               if (strchr(seps, *purl) == NULL) {
+               if (strchr(seps, *purl) == nullptr) {
                        ERR("Unknown symbol after IPv6 address: %s", purl);
                        goto free_error;
                }
@@ -409,7 +409,7 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
        }
 
        addr_f = utils_strdupdelim(addr_b, addr_e);
-       if (addr_f == NULL) {
+       if (addr_f == nullptr) {
                goto free_error;
        }
 
@@ -446,7 +446,7 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
                        int port;
 
                        port_f = utils_strdupdelim(port_b, port_e);
-                       if (port_f == NULL) {
+                       if (port_f == nullptr) {
                                goto free_error;
                        }
 
@@ -568,11 +568,11 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lt
        /* Add the "file://" size to the URL maximum size */
        char url[PATH_MAX + 7];
        ssize_t ctrl_uri_count = 0, data_uri_count = 0, uri_count;
-       struct lttng_uri *ctrl_uris = NULL, *data_uris = NULL;
-       struct lttng_uri *tmp_uris = NULL;
+       struct lttng_uri *ctrl_uris = nullptr, *data_uris = nullptr;
+       struct lttng_uri *tmp_uris = nullptr;
 
        /* No URL(s) is allowed. This means that the consumer will be disabled. */
-       if (ctrl_url == NULL && data_url == NULL) {
+       if (ctrl_url == nullptr && data_url == nullptr) {
                return 0;
        }
 
@@ -632,7 +632,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lt
                                 * The data_url and ctrl_url are equal and the ctrl_url
                                 * contains a net:// protocol so we just skip the data part.
                                 */
-                               data_url = NULL;
+                               data_url = nullptr;
                        }
                }
        }
@@ -671,7 +671,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lt
        }
 
        tmp_uris = calloc<lttng_uri>(uri_count);
-       if (tmp_uris == NULL) {
+       if (tmp_uris == nullptr) {
                PERROR("zmalloc uris");
                goto error;
        }
index 48b9d03f0e7ff2409802b6aede31e59ce276799d..8be0e07247e4333395e4ca54b78887b9648a5d84 100644 (file)
@@ -62,7 +62,7 @@ void lttng_userspace_probe_location_lookup_method_destroy(
 struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_lookup_method_function_elf_create(void)
 {
-       struct lttng_userspace_probe_location_lookup_method *ret = NULL;
+       struct lttng_userspace_probe_location_lookup_method *ret = nullptr;
        struct lttng_userspace_probe_location_lookup_method_elf *elf_method;
 
        elf_method = zmalloc<lttng_userspace_probe_location_lookup_method_elf>();
@@ -80,7 +80,7 @@ end:
 struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_lookup_method_tracepoint_sdt_create(void)
 {
-       struct lttng_userspace_probe_location_lookup_method *ret = NULL;
+       struct lttng_userspace_probe_location_lookup_method *ret = nullptr;
        struct lttng_userspace_probe_location_lookup_method_sdt *sdt_method;
 
        sdt_method = zmalloc<lttng_userspace_probe_location_lookup_method_sdt>();
@@ -104,7 +104,7 @@ lttng_userspace_probe_location_get_type(const struct lttng_userspace_probe_locat
 static void
 lttng_userspace_probe_location_function_destroy(struct lttng_userspace_probe_location *location)
 {
-       struct lttng_userspace_probe_location_function *location_function = NULL;
+       struct lttng_userspace_probe_location_function *location_function = nullptr;
 
        LTTNG_ASSERT(location);
 
@@ -122,7 +122,7 @@ lttng_userspace_probe_location_function_destroy(struct lttng_userspace_probe_loc
 static void
 lttng_userspace_probe_location_tracepoint_destroy(struct lttng_userspace_probe_location *location)
 {
-       struct lttng_userspace_probe_location_tracepoint *location_tracepoint = NULL;
+       struct lttng_userspace_probe_location_tracepoint *location_tracepoint = nullptr;
 
        LTTNG_ASSERT(location);
 
@@ -260,9 +260,9 @@ lttng_userspace_probe_location_function_create_no_check(
        bool open_binary)
 {
        int binary_fd = -1;
-       struct fd_handle *binary_fd_handle = NULL;
-       char *function_name_copy = NULL, *binary_path_copy = NULL;
-       struct lttng_userspace_probe_location *ret = NULL;
+       struct fd_handle *binary_fd_handle = nullptr;
+       char *function_name_copy = nullptr, *binary_path_copy = nullptr;
+       struct lttng_userspace_probe_location *ret = nullptr;
        struct lttng_userspace_probe_location_function *location;
 
        if (open_binary) {
@@ -302,7 +302,7 @@ lttng_userspace_probe_location_function_create_no_check(
        location->function_name = function_name_copy;
        location->binary_path = binary_path_copy;
        location->binary_fd_handle = binary_fd_handle;
-       binary_fd_handle = NULL;
+       binary_fd_handle = nullptr;
        location->instrumentation_type =
                LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY;
 
@@ -388,11 +388,11 @@ lttng_userspace_probe_location_tracepoint_create_no_check(
        bool open_binary)
 {
        int binary_fd = -1;
-       struct fd_handle *binary_fd_handle = NULL;
-       char *probe_name_copy = NULL;
-       char *provider_name_copy = NULL;
-       char *binary_path_copy = NULL;
-       struct lttng_userspace_probe_location *ret = NULL;
+       struct fd_handle *binary_fd_handle = nullptr;
+       char *probe_name_copy = nullptr;
+       char *provider_name_copy = nullptr;
+       char *binary_path_copy = nullptr;
+       struct lttng_userspace_probe_location *ret = nullptr;
        struct lttng_userspace_probe_location_tracepoint *location;
 
        if (open_binary) {
@@ -439,7 +439,7 @@ lttng_userspace_probe_location_tracepoint_create_no_check(
        location->provider_name = provider_name_copy;
        location->binary_path = binary_path_copy;
        location->binary_fd_handle = binary_fd_handle;
-       binary_fd_handle = NULL;
+       binary_fd_handle = nullptr;
 
        ret = &location->parent;
        ret->lookup_method = lookup_method;
@@ -467,7 +467,7 @@ struct lttng_userspace_probe_location *lttng_userspace_probe_location_function_c
        const char *function_name,
        struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
-       struct lttng_userspace_probe_location *ret = NULL;
+       struct lttng_userspace_probe_location *ret = nullptr;
 
        if (!binary_path || !function_name) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
@@ -495,7 +495,7 @@ struct lttng_userspace_probe_location *lttng_userspace_probe_location_tracepoint
        const char *probe_name,
        struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
-       struct lttng_userspace_probe_location *ret = NULL;
+       struct lttng_userspace_probe_location *ret = nullptr;
 
        if (!binary_path || !probe_name || !provider_name) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
@@ -520,7 +520,7 @@ static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_lookup_method_function_elf_copy(
        const struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
-       struct lttng_userspace_probe_location_lookup_method *parent = NULL;
+       struct lttng_userspace_probe_location_lookup_method *parent = nullptr;
        struct lttng_userspace_probe_location_lookup_method_elf *elf_method;
 
        LTTNG_ASSERT(lookup_method);
@@ -538,7 +538,7 @@ lttng_userspace_probe_location_lookup_method_function_elf_copy(
 
        goto end;
 error:
-       parent = NULL;
+       parent = nullptr;
 end:
        return parent;
 }
@@ -547,7 +547,7 @@ static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_lookup_method_tracepoint_sdt_copy(
        struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
-       struct lttng_userspace_probe_location_lookup_method *parent = NULL;
+       struct lttng_userspace_probe_location_lookup_method *parent = nullptr;
        struct lttng_userspace_probe_location_lookup_method_sdt *sdt_method;
 
        LTTNG_ASSERT(lookup_method);
@@ -566,7 +566,7 @@ lttng_userspace_probe_location_lookup_method_tracepoint_sdt_copy(
        goto end;
 
 error:
-       parent = NULL;
+       parent = nullptr;
 end:
        return parent;
 }
@@ -575,10 +575,10 @@ static struct lttng_userspace_probe_location *
 lttng_userspace_probe_location_function_copy(const struct lttng_userspace_probe_location *location)
 {
        enum lttng_userspace_probe_location_lookup_method_type lookup_type;
-       struct lttng_userspace_probe_location *new_location = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
-       const char *binary_path = NULL;
-       const char *function_name = NULL;
+       struct lttng_userspace_probe_location *new_location = nullptr;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
+       const char *binary_path = nullptr;
+       const char *function_name = nullptr;
        struct lttng_userspace_probe_location_function *function_location;
 
        LTTNG_ASSERT(location);
@@ -637,7 +637,7 @@ destroy_probe_location:
 destroy_lookup_method:
        lttng_userspace_probe_location_lookup_method_destroy(lookup_method);
 error:
-       new_location = NULL;
+       new_location = nullptr;
 end:
        return new_location;
 }
@@ -646,11 +646,11 @@ static struct lttng_userspace_probe_location *lttng_userspace_probe_location_tra
        const struct lttng_userspace_probe_location *location)
 {
        enum lttng_userspace_probe_location_lookup_method_type lookup_type;
-       struct lttng_userspace_probe_location *new_location = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
-       const char *binary_path = NULL;
-       const char *probe_name = NULL;
-       const char *provider_name = NULL;
+       struct lttng_userspace_probe_location *new_location = nullptr;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
+       const char *binary_path = nullptr;
+       const char *probe_name = nullptr;
+       const char *provider_name = nullptr;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
        LTTNG_ASSERT(location);
@@ -715,7 +715,7 @@ destroy_probe_location:
 destroy_lookup_method:
        lttng_userspace_probe_location_lookup_method_destroy(lookup_method);
 error:
-       new_location = NULL;
+       new_location = nullptr;
 end:
        return new_location;
 }
@@ -723,7 +723,7 @@ end:
 const char *lttng_userspace_probe_location_function_get_binary_path(
        const struct lttng_userspace_probe_location *location)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
        struct lttng_userspace_probe_location_function *function_location;
 
        if (!location ||
@@ -743,7 +743,7 @@ end:
 const char *lttng_userspace_probe_location_tracepoint_get_binary_path(
        const struct lttng_userspace_probe_location *location)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
        if (!location ||
@@ -763,7 +763,7 @@ end:
 const char *lttng_userspace_probe_location_function_get_function_name(
        const struct lttng_userspace_probe_location *location)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
        struct lttng_userspace_probe_location_function *function_location;
 
        if (!location ||
@@ -783,7 +783,7 @@ end:
 const char *lttng_userspace_probe_location_tracepoint_get_probe_name(
        const struct lttng_userspace_probe_location *location)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
        if (!location ||
@@ -803,7 +803,7 @@ end:
 const char *lttng_userspace_probe_location_tracepoint_get_provider_name(
        const struct lttng_userspace_probe_location *location)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
        if (!location ||
@@ -916,7 +916,7 @@ static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_function_get_lookup_method(
        const struct lttng_userspace_probe_location *location)
 {
-       struct lttng_userspace_probe_location_lookup_method *ret = NULL;
+       struct lttng_userspace_probe_location_lookup_method *ret = nullptr;
 
        if (!location ||
            lttng_userspace_probe_location_get_type(location) !=
@@ -934,7 +934,7 @@ static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_tracepoint_get_lookup_method(
        const struct lttng_userspace_probe_location *location)
 {
-       struct lttng_userspace_probe_location_lookup_method *ret = NULL;
+       struct lttng_userspace_probe_location_lookup_method *ret = nullptr;
 
        if (!location ||
            lttng_userspace_probe_location_get_type(location) !=
@@ -952,7 +952,7 @@ const struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_get_lookup_method(
        const struct lttng_userspace_probe_location *location)
 {
-       struct lttng_userspace_probe_location_lookup_method *ret = NULL;
+       struct lttng_userspace_probe_location_lookup_method *ret = nullptr;
 
        LTTNG_ASSERT(location);
        switch (location->type) {
@@ -1208,7 +1208,7 @@ static int lttng_userspace_probe_location_function_create_from_payload(
 {
        struct lttng_userspace_probe_location_function_comm *location_function_comm;
        const char *function_name_src, *binary_path_src;
-       char *function_name = NULL, *binary_path = NULL;
+       char *function_name = nullptr, *binary_path = nullptr;
        int ret = 0;
        size_t expected_size;
        struct fd_handle *binary_fd_handle = lttng_payload_view_pop_fd_handle(view);
@@ -1260,7 +1260,7 @@ static int lttng_userspace_probe_location_function_create_from_payload(
        }
 
        *location = lttng_userspace_probe_location_function_create_no_check(
-               binary_path, function_name, NULL, false);
+               binary_path, function_name, nullptr, false);
        if (!(*location)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1286,7 +1286,7 @@ static int lttng_userspace_probe_location_tracepoint_create_from_payload(
 {
        struct lttng_userspace_probe_location_tracepoint_comm *location_tracepoint_comm;
        const char *probe_name_src, *provider_name_src, *binary_path_src;
-       char *probe_name = NULL, *provider_name = NULL, *binary_path = NULL;
+       char *probe_name = nullptr, *provider_name = nullptr, *binary_path = nullptr;
        int ret = 0;
        size_t expected_size;
        struct fd_handle *binary_fd_handle = lttng_payload_view_pop_fd_handle(view);
@@ -1359,7 +1359,7 @@ static int lttng_userspace_probe_location_tracepoint_create_from_payload(
        }
 
        *location = lttng_userspace_probe_location_tracepoint_create_no_check(
-               binary_path, provider_name, probe_name, NULL, false);
+               binary_path, provider_name, probe_name, nullptr, false);
        if (!(*location)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1401,7 +1401,7 @@ static int lttng_userspace_probe_location_lookup_method_create_from_payload(
        type = (enum lttng_userspace_probe_location_lookup_method_type) lookup_comm->type;
        switch (type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
-               *lookup_method = NULL;
+               *lookup_method = nullptr;
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
                *lookup_method = lttng_userspace_probe_location_lookup_method_function_elf_create();
@@ -1442,7 +1442,7 @@ int lttng_userspace_probe_location_create_from_payload(
        LTTNG_ASSERT(view);
        LTTNG_ASSERT(location);
 
-       lookup_method = NULL;
+       lookup_method = nullptr;
 
        if (!lttng_payload_view_is_valid(&probe_location_comm_view)) {
                ret = -LTTNG_ERR_INVALID;
@@ -1503,7 +1503,7 @@ int lttng_userspace_probe_location_create_from_payload(
 
        LTTNG_ASSERT(lookup_method);
        (*location)->lookup_method = lookup_method;
-       lookup_method = NULL;
+       lookup_method = nullptr;
        ret += consumed;
 end:
        return ret;
@@ -1614,12 +1614,12 @@ static int lttng_userspace_probe_location_function_flatten(
                                 *) (flat_probe_start + sizeof(flat_probe) + function_name_len +
                                     binary_path_len + padding_needed);
        } else {
-               flat_probe.parent.lookup_method = NULL;
+               flat_probe.parent.lookup_method = nullptr;
        }
 
        flat_probe.function_name = flat_probe_start + sizeof(flat_probe);
        flat_probe.binary_path = flat_probe.function_name + function_name_len;
-       flat_probe.binary_fd_handle = NULL;
+       flat_probe.binary_fd_handle = nullptr;
        ret = lttng_dynamic_buffer_append(buffer, &flat_probe, sizeof(flat_probe));
        if (ret) {
                goto end;
@@ -1738,13 +1738,13 @@ static int lttng_userspace_probe_location_tracepoint_flatten(
                                 *) (flat_probe_start + sizeof(flat_probe) + probe_name_len +
                                     provider_name_len + binary_path_len + padding_needed);
        } else {
-               flat_probe.parent.lookup_method = NULL;
+               flat_probe.parent.lookup_method = nullptr;
        }
 
        flat_probe.probe_name = flat_probe_start + sizeof(flat_probe);
        flat_probe.provider_name = flat_probe.probe_name + probe_name_len;
        flat_probe.binary_path = flat_probe.provider_name + provider_name_len;
-       flat_probe.binary_fd_handle = NULL;
+       flat_probe.binary_fd_handle = nullptr;
        ret = lttng_dynamic_buffer_append(buffer, &flat_probe, sizeof(flat_probe));
        if (ret) {
                goto end;
@@ -1819,7 +1819,7 @@ end:
 struct lttng_userspace_probe_location *
 lttng_userspace_probe_location_copy(const struct lttng_userspace_probe_location *location)
 {
-       struct lttng_userspace_probe_location *new_location = NULL;
+       struct lttng_userspace_probe_location *new_location = nullptr;
        enum lttng_userspace_probe_location_type type;
 
        if (!location) {
@@ -1841,7 +1841,7 @@ lttng_userspace_probe_location_copy(const struct lttng_userspace_probe_location
                }
                break;
        default:
-               new_location = NULL;
+               new_location = nullptr;
                goto err;
        }
 err:
@@ -1915,7 +1915,7 @@ lttng_userspace_probe_location_mi_serialize(const struct lttng_userspace_probe_l
 
        int ret;
        enum lttng_error_code ret_code;
-       mi_fp mi_function = NULL;
+       mi_fp mi_function = nullptr;
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(writer);
@@ -2020,10 +2020,10 @@ static enum lttng_error_code lttng_userspace_probe_location_tracepoint_mi_serial
 {
        int ret;
        enum lttng_error_code ret_code;
-       const char *probe_name = NULL;
-       const char *provider_name = NULL;
-       const char *binary_path = NULL;
-       const struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+       const char *probe_name = nullptr;
+       const char *provider_name = nullptr;
+       const char *binary_path = nullptr;
+       const struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(writer);
@@ -2091,11 +2091,11 @@ static enum lttng_error_code lttng_userspace_probe_location_function_mi_serializ
 {
        int ret;
        enum lttng_error_code ret_code;
-       const char *function_name = NULL;
-       const char *binary_path = NULL;
-       const char *instrumentation_type_str = NULL;
+       const char *function_name = nullptr;
+       const char *binary_path = nullptr;
+       const char *instrumentation_type_str = nullptr;
        enum lttng_userspace_probe_location_function_instrumentation_type instrumentation_type;
-       const struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+       const struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(writer);
index ea3e3619106654d556bdbf543afca0ce75308bd2..5339553cb5fd7fb7b54d61f8b74814f21e1faf6c 100644 (file)
@@ -63,7 +63,7 @@ static int add_channel(struct lttng_consumer_channel *channel,
        LTTNG_ASSERT(channel);
        LTTNG_ASSERT(ctx);
 
-       if (ctx->on_recv_channel != NULL) {
+       if (ctx->on_recv_channel != nullptr) {
                ret = ctx->on_recv_channel(channel);
                if (ret == 0) {
                        ret = consumer_add_channel(channel, ctx);
@@ -95,7 +95,7 @@ static struct lttng_consumer_stream *allocate_stream(int cpu,
                                                     int *_alloc_ret)
 {
        int alloc_ret;
-       struct lttng_consumer_stream *stream = NULL;
+       struct lttng_consumer_stream *stream = nullptr;
 
        LTTNG_ASSERT(channel);
        LTTNG_ASSERT(ctx);
@@ -111,7 +111,7 @@ static struct lttng_consumer_stream *allocate_stream(int cpu,
                                        &alloc_ret,
                                        channel->type,
                                        channel->monitor);
-       if (stream == NULL) {
+       if (stream == nullptr) {
                switch (alloc_ret) {
                case -ENOENT:
                        /*
@@ -214,7 +214,7 @@ static int create_ust_streams(struct lttng_consumer_channel *channel,
        int ret, cpu = 0;
        struct lttng_ust_ctl_consumer_stream *ustream;
        struct lttng_consumer_stream *stream;
-       pthread_mutex_t *current_stream_lock = NULL;
+       pthread_mutex_t *current_stream_lock = nullptr;
 
        LTTNG_ASSERT(channel);
        LTTNG_ASSERT(ctx);
@@ -302,7 +302,7 @@ static int create_ust_streams(struct lttng_consumer_channel *channel,
                        }
                }
                pthread_mutex_unlock(&stream->lock);
-               current_stream_lock = NULL;
+               current_stream_lock = nullptr;
        }
 
        return 0;
@@ -539,7 +539,7 @@ static int send_channel_to_sessiond_and_relayd(int sock,
        }
 
        /* Tell sessiond there is no more stream. */
-       ret = lttng_ust_ctl_send_stream_to_sessiond(sock, NULL);
+       ret = lttng_ust_ctl_send_stream_to_sessiond(sock, nullptr);
        if (ret < 0) {
                goto error;
        }
@@ -928,8 +928,8 @@ error:
         * the stream is still in the local stream list of the channel. This call
         * will make sure to clean that list.
         */
-       consumer_stream_destroy(metadata->metadata_stream, NULL);
-       metadata->metadata_stream = NULL;
+       consumer_stream_destroy(metadata->metadata_stream, nullptr);
+       metadata->metadata_stream = nullptr;
 send_streams_error:
 error_no_stream:
 end:
@@ -1011,8 +1011,8 @@ error_stream:
         * Clean up the stream completely because the next snapshot will use a
         * new metadata stream.
         */
-       consumer_stream_destroy(metadata_stream, NULL);
-       metadata_channel->metadata_stream = NULL;
+       consumer_stream_destroy(metadata_stream, nullptr);
+       metadata_channel->metadata_stream = nullptr;
 
 error:
        rcu_read_unlock();
@@ -1306,7 +1306,7 @@ int lttng_ustconsumer_recv_metadata(int sock,
                 * channel is under a snapshot session type. No need to update
                 * the stream position in that scenario.
                 */
-               if (channel->metadata_stream != NULL) {
+               if (channel->metadata_stream != nullptr) {
                        pthread_mutex_lock(&channel->metadata_stream->lock);
                        metadata_stream_reset_cache_consumed_position(channel->metadata_stream);
                        pthread_mutex_unlock(&channel->metadata_stream->lock);
@@ -1368,7 +1368,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        int ret_func;
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
        struct lttcomm_consumer_msg msg;
-       struct lttng_consumer_channel *channel = NULL;
+       struct lttng_consumer_channel *channel = nullptr;
 
        health_code_update();
 
@@ -1432,7 +1432,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                /* Get relayd reference if exists. */
                relayd = consumer_find_relayd(index);
-               if (relayd == NULL) {
+               if (relayd == nullptr) {
                        DBG("Unable to find relayd %" PRIu64, index);
                        ret_code = LTTCOMM_CONSUMERD_RELAYD_FAIL;
                }
@@ -1495,7 +1495,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                channel = consumer_allocate_channel(
                        msg.u.ask_channel.key,
                        msg.u.ask_channel.session_id,
-                       msg.u.ask_channel.chunk_id.is_set ? &chunk_id : NULL,
+                       msg.u.ask_channel.chunk_id.is_set ? &chunk_id : nullptr,
                        msg.u.ask_channel.pathname,
                        msg.u.ask_channel.name,
                        msg.u.ask_channel.relayd_id,
@@ -2131,8 +2131,8 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                const uint64_t relayd_id = msg.u.create_trace_chunk.relayd_id.value;
                const char *chunk_override_name = *msg.u.create_trace_chunk.override_name ?
                        msg.u.create_trace_chunk.override_name :
-                       NULL;
-               struct lttng_directory_handle *chunk_directory_handle = NULL;
+                       nullptr;
+               struct lttng_directory_handle *chunk_directory_handle = nullptr;
 
                /*
                 * The session daemon will only provide a chunk directory file
@@ -2172,12 +2172,12 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
 
                ret_code = lttng_consumer_create_trace_chunk(
-                       !is_local_trace ? &relayd_id : NULL,
+                       !is_local_trace ? &relayd_id : nullptr,
                        msg.u.create_trace_chunk.session_id,
                        msg.u.create_trace_chunk.chunk_id,
                        (time_t) msg.u.create_trace_chunk.creation_timestamp,
                        chunk_override_name,
-                       msg.u.create_trace_chunk.credentials.is_set ? &credentials : NULL,
+                       msg.u.create_trace_chunk.credentials.is_set ? &credentials : nullptr,
                        chunk_directory_handle);
                lttng_directory_handle_put(chunk_directory_handle);
                goto end_msg_sessiond;
@@ -2192,11 +2192,11 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                int ret;
 
                ret_code = lttng_consumer_close_trace_chunk(
-                       msg.u.close_trace_chunk.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.close_trace_chunk.relayd_id.is_set ? &relayd_id : nullptr,
                        msg.u.close_trace_chunk.session_id,
                        msg.u.close_trace_chunk.chunk_id,
                        (time_t) msg.u.close_trace_chunk.close_timestamp,
-                       msg.u.close_trace_chunk.close_command.is_set ? &close_command : NULL,
+                       msg.u.close_trace_chunk.close_command.is_set ? &close_command : nullptr,
                        closed_trace_chunk_path);
                reply.ret_code = ret_code;
                reply.path_length = strlen(closed_trace_chunk_path) + 1;
@@ -2215,7 +2215,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                const uint64_t relayd_id = msg.u.trace_chunk_exists.relayd_id.value;
 
                ret_code = lttng_consumer_trace_chunk_exists(
-                       msg.u.trace_chunk_exists.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.trace_chunk_exists.relayd_id.is_set ? &relayd_id : nullptr,
                        msg.u.trace_chunk_exists.session_id,
                        msg.u.trace_chunk_exists.chunk_id);
                goto end_msg_sessiond;
@@ -2279,7 +2279,7 @@ end_channel_error:
        {
                int ret_send_status;
 
-               ret_send_status = consumer_send_status_channel(sock, NULL);
+               ret_send_status = consumer_send_status_channel(sock, nullptr);
                if (ret_send_status < 0) {
                        /* Stop everything if session daemon can not be notified. */
                        goto error_fatal;
@@ -2864,7 +2864,7 @@ static int get_next_subbuffer_common(struct lttng_consumer_stream *stream,
 
        subbuffer->buffer.buffer =
                lttng_buffer_view_init(addr, 0, subbuffer->info.data.padded_subbuf_size);
-       LTTNG_ASSERT(subbuffer->buffer.buffer.data != NULL);
+       LTTNG_ASSERT(subbuffer->buffer.buffer.data != nullptr);
 end:
        return ret;
 }
index 71104c8e87868363f3fb8353860c6e5967c257af..831926aab16c48656082113a984386d530be3203 100644 (file)
@@ -39,7 +39,7 @@
 #define PROC_MEMINFO_MEMAVAILABLE_LINE "MemAvailable:"
 #define PROC_MEMINFO_MEMTOTAL_LINE     "MemTotal:"
 
-/* The length of the longest field of `/proc/meminfo`. */
+/* The lnullptrh of the longest field of `/proc/meminfo`. */
 #define PROC_MEMINFO_FIELD_MAX_NAME_LEN 20
 
 #if (PROC_MEMINFO_FIELD_MAX_NAME_LEN == 20)
@@ -58,7 +58,7 @@ int utils_create_pipe(int *dst)
 {
        int ret;
 
-       if (dst == NULL) {
+       if (dst == nullptr) {
                return -1;
        }
 
@@ -80,7 +80,7 @@ int utils_create_pipe_cloexec(int *dst)
 {
        int ret, i;
 
-       if (dst == NULL) {
+       if (dst == nullptr) {
                return -1;
        }
 
@@ -112,7 +112,7 @@ int utils_create_pipe_cloexec_nonblock(int *dst)
 {
        int ret, i;
 
-       if (dst == NULL) {
+       if (dst == nullptr) {
                return -1;
        }
 
@@ -149,7 +149,7 @@ void utils_close_pipe(int *src)
 {
        int i, ret;
 
-       if (src == NULL) {
+       if (src == nullptr) {
                return;
        }
 
@@ -174,7 +174,7 @@ char *utils_strdupdelim(const char *begin, const char *end)
 {
        char *str = zmalloc<char>(end - begin + 1);
 
-       if (str == NULL) {
+       if (str == nullptr) {
                PERROR("zmalloc strdupdelim");
                goto error;
        }
@@ -214,7 +214,7 @@ end:
 int utils_create_pid_file(pid_t pid, const char *filepath)
 {
        int ret, fd = -1;
-       FILE *fp = NULL;
+       FILE *fp = nullptr;
 
        LTTNG_ASSERT(filepath);
 
@@ -226,7 +226,7 @@ int utils_create_pid_file(pid_t pid, const char *filepath)
        }
 
        fp = fdopen(fd, "w");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                PERROR("fdopen file %s", filepath);
                ret = -1;
                if (close(fd)) {
@@ -311,13 +311,13 @@ int utils_mkdir(const char *path, mode_t mode, int uid, int gid)
                .gid = LTTNG_OPTIONAL_INIT_VALUE((gid_t) gid),
        };
 
-       handle = lttng_directory_handle_create(NULL);
+       handle = lttng_directory_handle_create(nullptr);
        if (!handle) {
                ret = -1;
                goto end;
        }
        ret = lttng_directory_handle_create_subdirectory_as_user(
-               handle, path, mode, (uid >= 0 || gid >= 0) ? &creds : NULL);
+               handle, path, mode, (uid >= 0 || gid >= 0) ? &creds : nullptr);
 end:
        lttng_directory_handle_put(handle);
        return ret;
@@ -338,13 +338,13 @@ int utils_mkdir_recursive(const char *path, mode_t mode, int uid, int gid)
                .gid = LTTNG_OPTIONAL_INIT_VALUE((gid_t) gid),
        };
 
-       handle = lttng_directory_handle_create(NULL);
+       handle = lttng_directory_handle_create(nullptr);
        if (!handle) {
                ret = -1;
                goto end;
        }
        ret = lttng_directory_handle_create_subdirectory_recursive_as_user(
-               handle, path, mode, (uid >= 0 || gid >= 0) ? &creds : NULL);
+               handle, path, mode, (uid >= 0 || gid >= 0) ? &creds : nullptr);
 end:
        lttng_directory_handle_put(handle);
        return ret;
@@ -427,7 +427,7 @@ int utils_parse_size_suffix(const char *const str, uint64_t *const size)
        }
 
        /* strtoull will accept a negative number, but we don't want to. */
-       if (strchr(str, '-') != NULL) {
+       if (strchr(str, '-') != nullptr) {
                DBG("utils_parse_size_suffix: invalid size string, should not contain '-'.");
                ret = -1;
                goto end;
@@ -533,7 +533,7 @@ int utils_parse_time_suffix(char const *const str, uint64_t *const time_us)
        }
 
        /* strtoull will accept a negative number, but we don't want to. */
-       if (strchr(str, '-') != NULL) {
+       if (strchr(str, '-') != nullptr) {
                DBG("utils_parse_time_suffix: invalid time string, should not contain '-'.");
                ret = -1;
                goto end;
@@ -756,17 +756,17 @@ int utils_get_count_order_u64(uint64_t x)
  * Obtain the value of LTTNG_HOME environment variable, if exists.
  * Otherwise returns the value of HOME.
  */
-const char *utils_get_home_dir(void)
+const char *utils_get_home_dir()
 {
-       char *val = NULL;
+       char *val = nullptr;
        struct passwd *pwd;
 
        val = lttng_secure_getenv(DEFAULT_LTTNG_HOME_ENV_VAR);
-       if (val != NULL) {
+       if (val != nullptr) {
                goto end;
        }
        val = lttng_secure_getenv(DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR);
-       if (val != NULL) {
+       if (val != nullptr) {
                goto end;
        }
 
@@ -791,8 +791,8 @@ char *utils_get_user_home_dir(uid_t uid)
 {
        struct passwd pwd;
        struct passwd *result;
-       char *home_dir = NULL;
-       char *buf = NULL;
+       char *home_dir = nullptr;
+       char *buf = nullptr;
        long buflen;
        int ret;
 
@@ -978,7 +978,7 @@ int utils_recursive_rmdir(const char *path)
        int ret;
        struct lttng_directory_handle *handle;
 
-       handle = lttng_directory_handle_create(NULL);
+       handle = lttng_directory_handle_create(nullptr);
        if (!handle) {
                ret = -1;
                goto end;
@@ -1009,7 +1009,7 @@ end:
        return ret;
 }
 
-static const char *get_man_bin_path(void)
+static const char *get_man_bin_path()
 {
        char *env_man_path = lttng_secure_getenv(DEFAULT_MAN_BIN_PATH_ENV);
 
@@ -1160,7 +1160,7 @@ enum lttng_error_code utils_user_id_from_name(const char *user_name, uid_t *uid)
        struct passwd p, *pres;
        int ret;
        enum lttng_error_code ret_val = LTTNG_OK;
-       char *buf = NULL;
+       char *buf = nullptr;
        ssize_t buflen;
 
        buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -1196,7 +1196,7 @@ end_loop:
 
        switch (ret) {
        case 0:
-               if (pres == NULL) {
+               if (pres == nullptr) {
                        ret_val = LTTNG_ERR_USER_NOT_FOUND;
                } else {
                        *uid = p.pw_uid;
@@ -1225,7 +1225,7 @@ enum lttng_error_code utils_group_id_from_name(const char *group_name, gid_t *gi
        struct group g, *gres;
        int ret;
        enum lttng_error_code ret_val = LTTNG_OK;
-       char *buf = NULL;
+       char *buf = nullptr;
        ssize_t buflen;
 
        buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
@@ -1261,7 +1261,7 @@ end_loop:
 
        switch (ret) {
        case 0:
-               if (gres == NULL) {
+               if (gres == nullptr) {
                        ret_val = LTTNG_ERR_GROUP_NOT_FOUND;
                } else {
                        *gid = g.gr_gid;
index 0c60a234a93cf5b2bfa60b0fed1b9231f980a7dd..12fafe2e3edef094cf944a80a625a638c794f818 100644 (file)
@@ -37,7 +37,7 @@ int utils_parse_size_suffix(char const * const str, uint64_t * const size);
 int utils_parse_time_suffix(char const * const str, uint64_t * const time_us);
 int utils_get_count_order_u32(uint32_t x);
 int utils_get_count_order_u64(uint64_t x);
-const char *utils_get_home_dir(void);
+const char *utils_get_home_dir();
 char *utils_get_user_home_dir(uid_t uid);
 
 size_t utils_get_current_time_str(const char *format, char *dst, size_t len)
index b1e0adeccba00638a206c9e8171b6af44af6f201..c0ea3392fceea52f1438b6e839c1742e7348503b 100644 (file)
@@ -51,7 +51,8 @@ void lttng_waiter_wait(struct lttng_waiter *waiter)
                caa_cpu_relax();
        }
        while (uatomic_read(&waiter->state) == WAITER_WAITING) {
-               if (!futex_noasync(&waiter->state, FUTEX_WAIT, WAITER_WAITING, NULL, NULL, 0)) {
+               if (!futex_noasync(
+                           &waiter->state, FUTEX_WAIT, WAITER_WAITING, nullptr, nullptr, 0)) {
                        /*
                         * Prior queued wakeups queued by unrelated code
                         * using the same address can cause futex wait to
@@ -91,7 +92,7 @@ skip_futex_wait:
                caa_cpu_relax();
        }
        while (!(uatomic_read(&waiter->state) & WAITER_TEARDOWN)) {
-               poll(NULL, 0, 10);
+               poll(nullptr, 0, 10);
        }
        LTTNG_ASSERT(uatomic_read(&waiter->state) & WAITER_TEARDOWN);
        DBG("End of waiter wait period");
@@ -108,7 +109,7 @@ void lttng_waiter_wake_up(struct lttng_waiter *waiter)
        LTTNG_ASSERT(uatomic_read(&waiter->state) == WAITER_WAITING);
        uatomic_set(&waiter->state, WAITER_WOKEN_UP);
        if (!(uatomic_read(&waiter->state) & WAITER_RUNNING)) {
-               if (futex_noasync(&waiter->state, FUTEX_WAKE, 1, NULL, NULL, 0) < 0) {
+               if (futex_noasync(&waiter->state, FUTEX_WAKE, 1, nullptr, nullptr, 0) < 0) {
                        PERROR("futex_noasync");
                        abort();
                }
index d8827c67046d88feca8b0eb933871e504f9c955e..a5ad2843cee1054c22504acc1db8e1205b1d3265 100644 (file)
@@ -103,7 +103,7 @@ static struct lttng_notification *
 create_notification_from_current_message(struct lttng_notification_channel *channel)
 {
        ssize_t ret;
-       struct lttng_notification *notification = NULL;
+       struct lttng_notification *notification = nullptr;
 
        if (channel->reception_payload.buffer.size <=
            sizeof(struct lttng_notification_channel_message)) {
@@ -123,7 +123,7 @@ create_notification_from_current_message(struct lttng_notification_channel *chan
            channel->reception_payload.buffer.size -
                    sizeof(struct lttng_notification_channel_message)) {
                lttng_notification_destroy(notification);
-               notification = NULL;
+               notification = nullptr;
                goto end;
        }
 end:
@@ -135,8 +135,8 @@ lttng_notification_channel_create(struct lttng_endpoint *endpoint)
 {
        int fd, ret;
        bool is_in_tracing_group = false, is_root = false;
-       char *sock_path = NULL;
-       struct lttng_notification_channel *channel = NULL;
+       char *sock_path = nullptr;
+       struct lttng_notification_channel *channel = nullptr;
 
        if (!endpoint || endpoint != lttng_session_daemon_notification_endpoint) {
                goto end;
@@ -152,7 +152,7 @@ lttng_notification_channel_create(struct lttng_endpoint *endpoint)
                goto end;
        }
        channel->socket = -1;
-       pthread_mutex_init(&channel->lock, NULL);
+       pthread_mutex_init(&channel->lock, nullptr);
        lttng_payload_init(&channel->reception_payload);
        CDS_INIT_LIST_HEAD(&channel->pending_notifications.list);
 
@@ -203,7 +203,7 @@ end:
        return channel;
 error:
        lttng_notification_channel_destroy(channel);
-       channel = NULL;
+       channel = nullptr;
        goto end;
 }
 
@@ -212,7 +212,7 @@ lttng_notification_channel_get_next_notification(struct lttng_notification_chann
                                                 struct lttng_notification **_notification)
 {
        int ret;
-       struct lttng_notification *notification = NULL;
+       struct lttng_notification *notification = nullptr;
        enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        struct lttng_poll_event events;
 
@@ -327,7 +327,7 @@ static int enqueue_dropped_notification(struct lttng_notification_channel *chann
                 * that notifications were dropped at this point.
                 */
                lttng_notification_destroy(pending_notification->notification);
-               pending_notification->notification = NULL;
+               pending_notification->notification = nullptr;
                goto end;
        }
 
index 4b5974612d14b9b5e284c535f3fcd486bf7cdd40..61b2e5041f7bb44f5ee19f28bbb864a329c1d218 100644 (file)
@@ -87,7 +87,7 @@ end:
        return handle;
 error:
        lttng_clear_handle_destroy(handle);
-       return NULL;
+       return nullptr;
 }
 
 static int handle_state_transition(struct lttng_clear_handle *handle)
@@ -270,7 +270,7 @@ enum lttng_error_code lttng_clear_session(const char *session_name,
                                          struct lttng_clear_handle **_handle)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
-       struct lttng_clear_handle *handle = NULL;
+       struct lttng_clear_handle *handle = nullptr;
        struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION,
                .session = {},
@@ -282,7 +282,7 @@ enum lttng_error_code lttng_clear_session(const char *session_name,
        ssize_t comm_ret;
        int ret;
 
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
@@ -314,7 +314,7 @@ error:
        /* Transfer the handle to the caller. */
        if (_handle) {
                *_handle = handle;
-               handle = NULL;
+               handle = nullptr;
        }
        if (sessiond_socket >= 0) {
                ret = close(sessiond_socket);
index d77554a588fb58da04a2db7e066b3c95dedffff0..34f58f7e01187afc2ae5ab1ad326326197abf009 100644 (file)
@@ -90,7 +90,7 @@ end:
        return handle;
 error:
        lttng_destruction_handle_destroy(handle);
-       return NULL;
+       return nullptr;
 }
 
 static int handle_state_transition(struct lttng_destruction_handle *handle)
@@ -377,7 +377,7 @@ enum lttng_error_code lttng_destroy_session_ext(const char *session_name,
                .fd_count = 0,
        };
        int sessiond_socket = -1;
-       struct lttng_destruction_handle *handle = NULL;
+       struct lttng_destruction_handle *handle = nullptr;
 
        if (!session_name) {
                ret_code = LTTNG_ERR_INVALID;
@@ -414,7 +414,7 @@ enum lttng_error_code lttng_destroy_session_ext(const char *session_name,
        /* Transfer the handle to the caller. */
        if (_handle) {
                *_handle = handle;
-               handle = NULL;
+               handle = nullptr;
        }
 error:
        if (sessiond_socket >= 0) {
index 141fb56842ca5723d71444bf61bfd6d8aac3f99e..b136640dfce031a557cec8a01c98e1d754c17c3c 100644 (file)
@@ -41,7 +41,7 @@ end:
        return event;
 error:
        free(event);
-       event = NULL;
+       event = nullptr;
        goto end;
 }
 
@@ -80,7 +80,7 @@ int lttng_event_get_filter_expression(struct lttng_event *event, const char **fi
                 * This can happen since the lttng_event structure is
                 * used for other tasks where this pointer is never set.
                 */
-               *filter_expression = NULL;
+               *filter_expression = nullptr;
                goto end;
        }
 
@@ -157,7 +157,7 @@ end:
 const struct lttng_userspace_probe_location *
 lttng_event_get_userspace_probe_location(const struct lttng_event *event)
 {
-       struct lttng_userspace_probe_location *probe_location = NULL;
+       struct lttng_userspace_probe_location *probe_location = nullptr;
        struct lttng_event_extended *event_extended;
 
        if (!event) {
index 2477e24e3a86cd1eede61254cf5925f8c41941ed..4c04a71f3d99e9787e69173aabd8013c8b77ff8e 100644 (file)
@@ -76,7 +76,7 @@ end:
 
 const char *lttng_load_session_attr_get_session_name(struct lttng_load_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (attr && attr->session_name[0]) {
                ret = attr->session_name;
@@ -87,7 +87,7 @@ const char *lttng_load_session_attr_get_session_name(struct lttng_load_session_a
 
 const char *lttng_load_session_attr_get_input_url(struct lttng_load_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (attr && attr->input_url[0]) {
                ret = attr->input_url;
@@ -103,7 +103,7 @@ int lttng_load_session_attr_get_overwrite(struct lttng_load_session_attr *attr)
 
 const char *lttng_load_session_attr_get_override_ctrl_url(struct lttng_load_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!attr || !attr->override_attr) {
                goto end;
@@ -116,7 +116,7 @@ end:
 
 const char *lttng_load_session_attr_get_override_data_url(struct lttng_load_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!attr || !attr->override_attr) {
                goto end;
@@ -129,7 +129,7 @@ end:
 
 const char *lttng_load_session_attr_get_override_url(struct lttng_load_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!attr || !attr->override_attr) {
                goto end;
@@ -145,7 +145,7 @@ end:
 
 const char *lttng_load_session_attr_get_override_session_name(struct lttng_load_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (!attr || !attr->override_attr) {
                goto end;
@@ -192,7 +192,7 @@ int lttng_load_session_attr_set_input_url(struct lttng_load_session_attr *attr,
        int ret = 0;
        size_t len;
        ssize_t size;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
 
        if (!attr) {
                ret = -LTTNG_ERR_INVALID;
@@ -211,7 +211,7 @@ int lttng_load_session_attr_set_input_url(struct lttng_load_session_attr *attr,
                goto error;
        }
 
-       size = uri_parse_str_urls(url, NULL, &uris);
+       size = uri_parse_str_urls(url, nullptr, &uris);
        if (size <= 0 || uris[0].dtype != LTTNG_DST_PATH) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -249,9 +249,9 @@ int lttng_load_session_attr_set_override_ctrl_url(struct lttng_load_session_attr
 {
        int ret = 0;
        ssize_t ret_size;
-       struct lttng_uri *uri = NULL;
-       char *url_str = NULL;
-       char *raw_str = NULL;
+       struct lttng_uri *uri = nullptr;
+       char *url_str = nullptr;
+       char *raw_str = nullptr;
 
        if (!attr) {
                ret = -LTTNG_ERR_INVALID;
@@ -318,8 +318,8 @@ int lttng_load_session_attr_set_override_ctrl_url(struct lttng_load_session_attr
        attr->raw_override_ctrl_url = raw_str;
 
        /* Ownership passed to attr. */
-       url_str = NULL;
-       raw_str = NULL;
+       url_str = nullptr;
+       raw_str = nullptr;
 
 end:
        free(raw_str);
@@ -333,9 +333,9 @@ int lttng_load_session_attr_set_override_data_url(struct lttng_load_session_attr
 {
        int ret = 0;
        ssize_t ret_size;
-       struct lttng_uri *uri = NULL;
-       char *url_str = NULL;
-       char *raw_str = NULL;
+       struct lttng_uri *uri = nullptr;
+       char *url_str = nullptr;
+       char *raw_str = nullptr;
 
        if (!attr) {
                ret = -LTTNG_ERR_INVALID;
@@ -401,8 +401,8 @@ int lttng_load_session_attr_set_override_data_url(struct lttng_load_session_attr
        attr->raw_override_data_url = raw_str;
 
        /* Ownership passed to attr. */
-       url_str = NULL;
-       raw_str = NULL;
+       url_str = nullptr;
+       raw_str = nullptr;
 end:
        free(raw_str);
        free(url_str);
@@ -414,14 +414,14 @@ int lttng_load_session_attr_set_override_url(struct lttng_load_session_attr *att
 {
        int ret = 0;
        ssize_t ret_size;
-       struct lttng_uri *uri = NULL;
-       char *raw_url_str = NULL;
-       char *raw_path_str = NULL;
-       char *path_str = NULL;
-       char *raw_ctrl_str = NULL;
-       char *ctrl_str = NULL;
-       char *raw_data_str = NULL;
-       char *data_str = NULL;
+       struct lttng_uri *uri = nullptr;
+       char *raw_url_str = nullptr;
+       char *raw_path_str = nullptr;
+       char *path_str = nullptr;
+       char *raw_ctrl_str = nullptr;
+       char *ctrl_str = nullptr;
+       char *raw_data_str = nullptr;
+       char *data_str = nullptr;
        char buffer[PATH_MAX];
 
        if (!attr || !url || strlen(url) >= PATH_MAX) {
@@ -442,7 +442,7 @@ int lttng_load_session_attr_set_override_url(struct lttng_load_session_attr *att
         * type to validate "url". For now only check the parsing goes through;
         * it will fail later on.
         */
-       ret_size = uri_parse_str_urls(url, NULL, &uri);
+       ret_size = uri_parse_str_urls(url, nullptr, &uri);
        if (ret_size < 0 || ret_size > 2) {
                /* Unexpected URL format. */
                ret = -LTTNG_ERR_INVALID;
@@ -534,13 +534,13 @@ int lttng_load_session_attr_set_override_url(struct lttng_load_session_attr *att
        attr->raw_override_data_url = raw_data_str;
 
        /* Pass data ownership to attr. */
-       raw_url_str = NULL;
-       raw_path_str = NULL;
-       path_str = NULL;
-       raw_ctrl_str = NULL;
-       ctrl_str = NULL;
-       raw_data_str = NULL;
-       data_str = NULL;
+       raw_url_str = nullptr;
+       raw_path_str = nullptr;
+       path_str = nullptr;
+       raw_ctrl_str = nullptr;
+       ctrl_str = nullptr;
+       raw_data_str = nullptr;
+       data_str = nullptr;
 
 end:
        free(raw_path_str);
@@ -603,8 +603,8 @@ int lttng_load_session(struct lttng_load_session_attr *attr)
                goto end;
        }
 
-       url = attr->input_url[0] != '\0' ? attr->input_url : NULL;
-       session_name = attr->session_name[0] != '\0' ? attr->session_name : NULL;
+       url = attr->input_url[0] != '\0' ? attr->input_url : nullptr;
+       session_name = attr->session_name[0] != '\0' ? attr->session_name : nullptr;
 
        ret = config_load_session(url, session_name, attr->overwrite, 0, attr->override_attr);
 
index 016e2a8a4b01c068dea859b3435457d8f90051f2..fd6279ade1aaa49110924a7818987305e75e793b 100644 (file)
@@ -201,7 +201,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 +224,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 +242,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 +253,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 +262,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 +282,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 +381,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 +399,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);
index 82f10bec03228f16a5267e899e8c9efe23f11872..b9311a07ef2051bfeb6243e071f381aef3f90379 100644 (file)
@@ -244,7 +244,7 @@ end:
  *
  * If yes return 1, else return -1.
  */
-int lttng_check_tracing_group(void)
+int lttng_check_tracing_group()
 {
        gid_t *grp_list, tracing_gid;
        int grp_list_size, grp_id, i;
@@ -258,7 +258,7 @@ int lttng_check_tracing_group(void)
        }
 
        /* Get number of supplementary group IDs */
-       grp_list_size = getgroups(0, NULL);
+       grp_list_size = getgroups(0, nullptr);
        if (grp_list_size < 0) {
                PERROR("getgroups");
                goto end;
@@ -390,7 +390,7 @@ error:
  * Returns 0 on success, negative value on failure (the sessiond socket path
  * is somehow too long or ENOMEM).
  */
-static int set_session_daemon_path(void)
+static int set_session_daemon_path()
 {
        int in_tgroup = 0; /* In tracing group. */
        uid_t uid;
@@ -451,7 +451,7 @@ error:
  *
  * On success, return the socket's file descriptor. On error, return -1.
  */
-int connect_sessiond(void)
+int connect_sessiond()
 {
        int ret;
 
@@ -472,7 +472,7 @@ error:
        return -1;
 }
 
-static void reset_global_sessiond_connection_state(void)
+static void reset_global_sessiond_connection_state()
 {
        sessiond_socket = -1;
        connected = 0;
@@ -483,7 +483,7 @@ static void reset_global_sessiond_connection_state(void)
  *
  *  On success, return 0. On error, return -1.
  */
-static int disconnect_sessiond(void)
+static int disconnect_sessiond()
 {
        int ret = 0;
 
@@ -498,7 +498,7 @@ static int disconnect_sessiond(void)
 static int recv_sessiond_optional_data(size_t len, void **user_buf, size_t *user_len)
 {
        int ret = 0;
-       char *buf = NULL;
+       char *buf = nullptr;
 
        if (len) {
                if (!user_len) {
@@ -524,7 +524,7 @@ static int recv_sessiond_optional_data(size_t len, void **user_buf, size_t *user
 
                /* Move ownership of command header buffer to user. */
                *user_buf = buf;
-               buf = NULL;
+               buf = nullptr;
                *user_len = len;
        } else {
                /* No command header. */
@@ -533,7 +533,7 @@ static int recv_sessiond_optional_data(size_t len, void **user_buf, size_t *user
                }
 
                if (user_buf) {
-                       *user_buf = NULL;
+                       *user_buf = nullptr;
                }
        }
 
@@ -724,10 +724,10 @@ end:
 struct lttng_handle *lttng_create_handle(const char *session_name, struct lttng_domain *domain)
 {
        int ret;
-       struct lttng_handle *handle = NULL;
+       struct lttng_handle *handle = nullptr;
 
        handle = zmalloc<lttng_handle>();
-       if (handle == NULL) {
+       if (handle == nullptr) {
                PERROR("malloc handle");
                goto end;
        }
@@ -747,7 +747,7 @@ end:
        return handle;
 error:
        free(handle);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -768,7 +768,7 @@ int lttng_register_consumer(struct lttng_handle *handle, const char *socket_path
        int ret;
        struct lttcomm_session_msg lsm;
 
-       if (handle == NULL || socket_path == NULL) {
+       if (handle == nullptr || socket_path == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -789,7 +789,7 @@ int lttng_register_consumer(struct lttng_handle *handle, const char *socket_path
                goto end;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
 end:
        return ret;
 }
@@ -804,7 +804,7 @@ int lttng_start_tracing(const char *session_name)
        int ret;
        struct lttcomm_session_msg lsm;
 
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -818,7 +818,7 @@ int lttng_start_tracing(const char *session_name)
                goto end;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
 end:
        return ret;
 }
@@ -831,7 +831,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait)
        int ret, data_ret;
        struct lttcomm_session_msg lsm;
 
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
@@ -845,7 +845,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait)
                goto error;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
        if (ret < 0 && ret != -LTTNG_ERR_TRACE_ALREADY_STOPPED) {
                goto error;
        }
@@ -919,7 +919,7 @@ int lttng_add_context(struct lttng_handle *handle,
        lttng_payload_init(&payload);
 
        /* Safety check. Both are mandatory. */
-       if (handle == NULL || ctx == NULL) {
+       if (handle == nullptr || ctx == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -986,7 +986,7 @@ int lttng_enable_event(struct lttng_handle *handle,
                       struct lttng_event *ev,
                       const char *channel_name)
 {
-       return lttng_enable_event_with_exclusions(handle, ev, channel_name, NULL, 0, NULL);
+       return lttng_enable_event_with_exclusions(handle, ev, channel_name, nullptr, 0, nullptr);
 }
 
 /*
@@ -1001,7 +1001,7 @@ int lttng_enable_event_with_filter(struct lttng_handle *handle,
                                   const char *filter_expression)
 {
        return lttng_enable_event_with_exclusions(
-               handle, event, channel_name, filter_expression, 0, NULL);
+               handle, event, channel_name, filter_expression, 0, nullptr);
 }
 
 /*
@@ -1013,7 +1013,7 @@ int lttng_enable_event_with_filter(struct lttng_handle *handle,
 static char *set_agent_filter(const char *filter, struct lttng_event *ev)
 {
        int err;
-       char *agent_filter = NULL;
+       char *agent_filter = nullptr;
 
        LTTNG_ASSERT(ev);
 
@@ -1065,7 +1065,7 @@ static char *set_agent_filter(const char *filter, struct lttng_event *ev)
        return agent_filter;
 error:
        free(agent_filter);
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -1093,7 +1093,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
        struct lttng_payload payload;
        int ret = 0;
        unsigned int free_filter_expression = 0;
-       struct filter_parser_ctx *ctx = NULL;
+       struct filter_parser_ctx *ctx = nullptr;
        size_t bytecode_len = 0;
 
        /*
@@ -1109,7 +1109,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
         */
        char *filter_expression = (char *) original_filter_expression;
 
-       if (handle == NULL || ev == NULL) {
+       if (handle == nullptr || ev == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
@@ -1131,7 +1131,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
        }
 
        /* Parse filter expression. */
-       if (filter_expression != NULL || handle->domain.type == LTTNG_DOMAIN_JUL ||
+       if (filter_expression != nullptr || handle->domain.type == LTTNG_DOMAIN_JUL ||
            handle->domain.type == LTTNG_DOMAIN_LOG4J ||
            handle->domain.type == LTTNG_DOMAIN_PYTHON) {
                if (handle->domain.type == LTTNG_DOMAIN_JUL ||
@@ -1183,7 +1183,7 @@ serialize:
                                    exclusion_list,
                                    filter_expression,
                                    bytecode_len,
-                                   (ctx && bytecode_len) ? &ctx->bytecode->b : NULL,
+                                   (ctx && bytecode_len) ? &ctx->bytecode->b : nullptr,
                                    &payload);
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
@@ -1235,13 +1235,14 @@ serialize:
                lsm.fd_count = fd_count;
 
                ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
-                                                       fd_count ? &fd_to_send : NULL,
+                                                       fd_count ? &fd_to_send : nullptr,
                                                        fd_count,
-                                                       view.buffer.size ? view.buffer.data : NULL,
+                                                       view.buffer.size ? view.buffer.data :
+                                                                          nullptr,
                                                        view.buffer.size,
-                                                       NULL,
-                                                       NULL,
-                                                       0);
+                                                       nullptr,
+                                                       nullptr,
+                                                       nullptr);
        }
 
 error:
@@ -1281,7 +1282,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
        struct lttng_payload payload;
        int ret = 0;
        unsigned int free_filter_expression = 0;
-       struct filter_parser_ctx *ctx = NULL;
+       struct filter_parser_ctx *ctx = nullptr;
        size_t bytecode_len = 0;
 
        /*
@@ -1297,7 +1298,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
         */
        char *filter_expression = (char *) original_filter_expression;
 
-       if (handle == NULL || ev == NULL) {
+       if (handle == nullptr || ev == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
@@ -1313,7 +1314,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
        }
 
        /* Parse filter expression. */
-       if (filter_expression != NULL || handle->domain.type == LTTNG_DOMAIN_JUL ||
+       if (filter_expression != nullptr || handle->domain.type == LTTNG_DOMAIN_JUL ||
            handle->domain.type == LTTNG_DOMAIN_LOG4J ||
            handle->domain.type == LTTNG_DOMAIN_PYTHON) {
                if (handle->domain.type == LTTNG_DOMAIN_JUL ||
@@ -1362,10 +1363,10 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
 serialize:
        ret = lttng_event_serialize(ev,
                                    0,
-                                   NULL,
+                                   nullptr,
                                    filter_expression,
                                    bytecode_len,
-                                   (ctx && bytecode_len) ? &ctx->bytecode->b : NULL,
+                                   (ctx && bytecode_len) ? &ctx->bytecode->b : nullptr,
                                    &payload);
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
@@ -1415,13 +1416,14 @@ serialize:
                }
 
                ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
-                                                       fd_count ? &fd_to_send : NULL,
+                                                       fd_count ? &fd_to_send : nullptr,
                                                        fd_count,
-                                                       view.buffer.size ? view.buffer.data : NULL,
+                                                       view.buffer.size ? view.buffer.data :
+                                                                          nullptr,
                                                        view.buffer.size,
-                                                       NULL,
-                                                       NULL,
-                                                       0);
+                                                       nullptr,
+                                                       nullptr,
+                                                       nullptr);
        }
 
 error:
@@ -1466,14 +1468,14 @@ int lttng_disable_event(struct lttng_handle *handle, const char *name, const cha
                goto end;
        }
 
-       ret = lttng_disable_event_ext(handle, &ev, channel_name, NULL);
+       ret = lttng_disable_event_ext(handle, &ev, channel_name, nullptr);
 end:
        return ret;
 }
 
 struct lttng_channel *lttng_channel_create(struct lttng_domain *domain)
 {
-       struct lttng_channel *channel = NULL;
+       struct lttng_channel *channel = nullptr;
 
        if (!domain) {
                goto end;
@@ -1532,12 +1534,12 @@ int lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel *in_c
        struct lttng_dynamic_buffer buffer;
        struct lttcomm_session_msg lsm;
        uint64_t total_buffer_size_needed_per_cpu = 0;
-       struct lttng_channel *channel = NULL;
+       struct lttng_channel *channel = nullptr;
 
        lttng_dynamic_buffer_init(&buffer);
 
        /* NULL arguments are forbidden. No default values. */
-       if (handle == NULL || in_chan == NULL) {
+       if (handle == nullptr || in_chan == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -1599,7 +1601,7 @@ int lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel *in_c
 
        lsm.u.channel.length = buffer.size;
 
-       ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, buffer.data, buffer.size, NULL);
+       ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, buffer.data, buffer.size, nullptr);
 end:
        lttng_channel_destroy(channel);
        lttng_dynamic_buffer_reset(&buffer);
@@ -1616,7 +1618,7 @@ int lttng_disable_channel(struct lttng_handle *handle, const char *name)
        struct lttcomm_session_msg lsm;
 
        /* Safety check. Both are mandatory. */
-       if (handle == NULL || name == NULL) {
+       if (handle == nullptr || name == nullptr) {
                return -LTTNG_ERR_INVALID;
        }
 
@@ -1638,7 +1640,7 @@ int lttng_disable_channel(struct lttng_handle *handle, const char *name)
                goto end;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
 end:
        return ret;
 }
@@ -1653,7 +1655,7 @@ int lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event **eve
 {
        enum lttng_error_code ret_code;
        int ret, total_payload_received;
-       char *reception_buffer = NULL;
+       char *reception_buffer = nullptr;
        struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS,
                .session = {},
@@ -1661,11 +1663,11 @@ int lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event **eve
                .u = {},
                .fd_count = 0,
        };
-       struct lttcomm_list_command_header *cmd_header = NULL;
+       struct lttcomm_list_command_header *cmd_header = nullptr;
        size_t cmd_header_len;
        unsigned int nb_events = 0;
 
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -1673,9 +1675,9 @@ int lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event **eve
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
        ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
-                                               NULL,
+                                               nullptr,
                                                0,
-                                               NULL,
+                                               nullptr,
                                                0,
                                                (void **) &reception_buffer,
                                                (void **) &cmd_header,
@@ -1731,13 +1733,13 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle, struct lttng_event
        enum lttng_error_code ret_code;
        int ret;
        struct lttcomm_session_msg lsm;
-       const struct lttcomm_list_command_header *cmd_header = NULL;
+       const struct lttcomm_list_command_header *cmd_header = nullptr;
        unsigned int nb_event_fields = 0;
        struct lttng_payload reply;
 
        lttng_payload_init(&reply);
 
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -1805,9 +1807,9 @@ int lttng_list_syscalls(struct lttng_event **events)
 {
        enum lttng_error_code ret_code;
        int ret, total_payload_received;
-       char *reception_buffer = NULL;
+       char *reception_buffer = nullptr;
        struct lttcomm_session_msg lsm = {};
-       struct lttcomm_list_command_header *cmd_header = NULL;
+       struct lttcomm_list_command_header *cmd_header = nullptr;
        size_t cmd_header_len;
        uint32_t nb_events = 0;
 
@@ -1821,9 +1823,9 @@ int lttng_list_syscalls(struct lttng_event **events)
        lsm.domain.type = LTTNG_DOMAIN_KERNEL;
 
        ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
-                                               NULL,
+                                               nullptr,
                                                0,
-                                               NULL,
+                                               nullptr,
                                                0,
                                                (void **) &reception_buffer,
                                                (void **) &cmd_header,
@@ -1890,14 +1892,14 @@ enum lttng_error_code lttng_create_session_ext(struct lttng_session_descriptor *
                .u = {},
                .fd_count = 0,
        };
-       void *reply = NULL;
+       void *reply = nullptr;
        struct lttng_buffer_view reply_view;
        int reply_ret;
        bool sessiond_must_generate_ouput;
        struct lttng_dynamic_buffer payload;
        int ret;
        size_t descriptor_size;
-       struct lttng_session_descriptor *descriptor_reply = NULL;
+       struct lttng_session_descriptor *descriptor_reply = nullptr;
 
        lttng_dynamic_buffer_init(&payload);
        if (!session_descriptor) {
@@ -1969,8 +1971,8 @@ int lttng_create_session(const char *name, const char *url)
 {
        int ret;
        ssize_t size;
-       struct lttng_uri *uris = NULL;
-       struct lttng_session_descriptor *descriptor = NULL;
+       struct lttng_uri *uris = nullptr;
+       struct lttng_session_descriptor *descriptor = nullptr;
        enum lttng_error_code ret_code;
 
        if (!name) {
@@ -1978,7 +1980,7 @@ int lttng_create_session(const char *name, const char *url)
                goto end;
        }
 
-       size = uri_parse_str_urls(url, NULL, &uris);
+       size = uri_parse_str_urls(url, nullptr, &uris);
        if (size < 0) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1995,7 +1997,7 @@ int lttng_create_session(const char *name, const char *url)
                descriptor = lttng_session_descriptor_local_create(name, uris[0].dst.path);
                break;
        case 2:
-               descriptor = lttng_session_descriptor_network_create(name, url, NULL);
+               descriptor = lttng_session_descriptor_network_create(name, url, nullptr);
                break;
        default:
                ret = -LTTNG_ERR_INVALID;
@@ -2023,15 +2025,15 @@ int lttng_create_session_snapshot(const char *name, const char *snapshot_url)
        int ret;
        enum lttng_error_code ret_code;
        ssize_t size;
-       struct lttng_uri *uris = NULL;
-       struct lttng_session_descriptor *descriptor = NULL;
+       struct lttng_uri *uris = nullptr;
+       struct lttng_session_descriptor *descriptor = nullptr;
 
        if (!name) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       size = uri_parse_str_urls(snapshot_url, NULL, &uris);
+       size = uri_parse_str_urls(snapshot_url, nullptr, &uris);
        if (size < 0) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -2064,8 +2066,8 @@ int lttng_create_session_snapshot(const char *name, const char *snapshot_url)
                descriptor = lttng_session_descriptor_snapshot_local_create(name, uris[0].dst.path);
                break;
        case 2:
-               descriptor =
-                       lttng_session_descriptor_snapshot_network_create(name, snapshot_url, NULL);
+               descriptor = lttng_session_descriptor_snapshot_network_create(
+                       name, snapshot_url, nullptr);
                break;
        default:
                ret = -LTTNG_ERR_INVALID;
@@ -2092,7 +2094,7 @@ int lttng_create_session_live(const char *name, const char *url, unsigned int ti
 {
        int ret;
        enum lttng_error_code ret_code;
-       struct lttng_session_descriptor *descriptor = NULL;
+       struct lttng_session_descriptor *descriptor = nullptr;
 
        if (!name) {
                ret = -LTTNG_ERR_INVALID;
@@ -2101,7 +2103,7 @@ int lttng_create_session_live(const char *name, const char *url, unsigned int ti
 
        if (url) {
                descriptor = lttng_session_descriptor_live_network_create(
-                       name, url, NULL, timer_interval);
+                       name, url, nullptr, timer_interval);
        } else {
                descriptor = lttng_session_descriptor_live_create(name, timer_interval);
        }
@@ -2126,7 +2128,7 @@ int lttng_destroy_session(const char *session_name)
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_destruction_handle_status status;
-       struct lttng_destruction_handle *handle = NULL;
+       struct lttng_destruction_handle *handle = nullptr;
 
        /*
         * Stop the tracing and wait for the data to be
@@ -2169,7 +2171,7 @@ int lttng_destroy_session_no_wait(const char *session_name)
 {
        enum lttng_error_code ret_code;
 
-       ret_code = lttng_destroy_session_ext(session_name, NULL);
+       ret_code = lttng_destroy_session_ext(session_name, nullptr);
        return ret_code == LTTNG_OK ? 0 : -ret_code;
 }
 
@@ -2187,7 +2189,7 @@ int lttng_list_sessions(struct lttng_session **out_sessions)
                sizeof(struct lttng_session) + sizeof(struct lttng_session_extended);
        size_t session_count, i;
        struct lttng_session_extended *sessions_extended_begin;
-       struct lttng_session *sessions = NULL;
+       struct lttng_session *sessions = nullptr;
 
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS;
@@ -2196,7 +2198,7 @@ int lttng_list_sessions(struct lttng_session **out_sessions)
         * lttng_list_sessions returns 0, thus allowing *out_sessions to
         * be subsequently freed.
         */
-       *out_sessions = NULL;
+       *out_sessions = nullptr;
        ret = lttng_ctl_ask_sessiond(&lsm, (void **) &sessions);
        if (ret <= 0) {
                goto end;
@@ -2255,7 +2257,7 @@ int lttng_set_session_shm_path(const char *session_name, const char *shm_path)
        int ret;
        struct lttcomm_session_msg lsm;
 
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                return -LTTNG_ERR_INVALID;
        }
 
@@ -2275,7 +2277,7 @@ int lttng_set_session_shm_path(const char *session_name, const char *shm_path)
                goto end;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
 end:
        return ret;
 }
@@ -2291,7 +2293,7 @@ int lttng_list_domains(const char *session_name, struct lttng_domain **domains)
        int ret;
        struct lttcomm_session_msg lsm;
 
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
@@ -2325,14 +2327,14 @@ int lttng_list_channels(struct lttng_handle *handle, struct lttng_channel **chan
 {
        int ret, total_payload_received;
        struct lttcomm_session_msg lsm;
-       char *reception_buffer = NULL;
+       char *reception_buffer = nullptr;
        size_t cmd_header_len = 0;
-       struct lttcomm_list_command_header *cmd_header = NULL;
+       struct lttcomm_list_command_header *cmd_header = nullptr;
        struct lttng_dynamic_buffer tmp_buffer;
 
        lttng_dynamic_buffer_init(&tmp_buffer);
 
-       if (handle == NULL) {
+       if (handle == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -2348,9 +2350,9 @@ int lttng_list_channels(struct lttng_handle *handle, struct lttng_channel **chan
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
        ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
-                                               NULL,
+                                               nullptr,
                                                0,
-                                               NULL,
+                                               nullptr,
                                                0,
                                                (void **) &reception_buffer,
                                                (void **) &cmd_header,
@@ -2416,7 +2418,7 @@ int lttng_list_events(struct lttng_handle *handle,
        lttng_payload_init(&reply);
 
        /* Safety check. An handle and channel name are mandatory. */
-       if (handle == NULL || channel_name == NULL) {
+       if (handle == nullptr || channel_name == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -2444,7 +2446,7 @@ int lttng_list_events(struct lttng_handle *handle,
        }
 
        {
-               const struct lttcomm_list_command_header *cmd_reply_header = NULL;
+               const struct lttcomm_list_command_header *cmd_reply_header = nullptr;
                const lttng_payload_view cmd_reply_header_view =
                        lttng_payload_view_from_payload(&reply, 0, sizeof(*cmd_reply_header));
 
@@ -2492,7 +2494,7 @@ int lttng_set_tracing_group(const char *name)
        int ret = 0;
        char *new_group;
 
-       if (name == NULL) {
+       if (name == nullptr) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -2505,7 +2507,7 @@ int lttng_set_tracing_group(const char *name)
 
        free(tracing_group);
        tracing_group = new_group;
-       new_group = NULL;
+       new_group = nullptr;
 
 end:
        return ret;
@@ -2529,7 +2531,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_ch
        struct lttng_channel_extended *extended;
 
        /* Safety check */
-       if (attr == NULL || domain == NULL) {
+       if (attr == nullptr || domain == nullptr) {
                return;
        }
 
@@ -2767,9 +2769,9 @@ int lttng_set_consumer_url(struct lttng_handle *handle,
        int ret;
        ssize_t size;
        struct lttcomm_session_msg lsm;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
 
-       if (handle == NULL || (control_url == NULL && data_url == NULL)) {
+       if (handle == nullptr || (control_url == nullptr && data_url == nullptr)) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
@@ -2795,7 +2797,7 @@ int lttng_set_consumer_url(struct lttng_handle *handle,
        lsm.u.uri.size = size;
 
        ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(
-               &lsm, uris, sizeof(struct lttng_uri) * size, NULL);
+               &lsm, uris, sizeof(struct lttng_uri) * size, nullptr);
 
        free(uris);
 error:
@@ -2841,9 +2843,9 @@ int lttng_data_pending(const char *session_name)
 {
        int ret;
        struct lttcomm_session_msg lsm;
-       uint8_t *pending = NULL;
+       uint8_t *pending = nullptr;
 
-       if (session_name == NULL) {
+       if (session_name == nullptr) {
                return -LTTNG_ERR_INVALID;
        }
 
@@ -2898,7 +2900,7 @@ int lttng_regenerate_metadata(const char *session_name)
                goto end;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
        if (ret < 0) {
                goto end;
        }
@@ -2939,7 +2941,7 @@ int lttng_regenerate_statedump(const char *session_name)
                goto end;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
        if (ret < 0) {
                goto end;
        }
@@ -2964,13 +2966,13 @@ _lttng_register_trigger(struct lttng_trigger *trigger, const char *name, bool ge
        struct lttcomm_session_msg *message_lsm;
        struct lttng_payload message;
        struct lttng_payload reply;
-       struct lttng_trigger *reply_trigger = NULL;
+       struct lttng_trigger *reply_trigger = nullptr;
        enum lttng_domain_type domain_type;
        const struct lttng_credentials user_creds = {
                .uid = LTTNG_OPTIONAL_INIT_VALUE(geteuid()),
                .gid = LTTNG_OPTIONAL_INIT_UNSET,
        };
-       const char *unused_trigger_name = NULL;
+       const char *unused_trigger_name = nullptr;
        enum lttng_trigger_status trigger_status;
 
        lttng_payload_init(&message);
@@ -3084,7 +3086,7 @@ _lttng_register_trigger(struct lttng_trigger *trigger, const char *name, bool ge
        goto end;
 
 end_unset_name:
-       trigger_status = lttng_trigger_set_name(trigger, NULL);
+       trigger_status = lttng_trigger_set_name(trigger, nullptr);
        if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
                ret = -LTTNG_ERR_UNK;
        }
@@ -3098,7 +3100,7 @@ end:
 int lttng_register_trigger(struct lttng_trigger *trigger)
 {
        /* Register an anonymous trigger. */
-       return _lttng_register_trigger(trigger, NULL, false);
+       return _lttng_register_trigger(trigger, nullptr, false);
 }
 
 enum lttng_error_code lttng_register_trigger_with_name(struct lttng_trigger *trigger,
@@ -3200,7 +3202,7 @@ int lttng_unregister_trigger(const struct lttng_trigger *trigger)
        struct lttcomm_session_msg *message_lsm;
        struct lttng_payload message;
        struct lttng_payload reply;
-       struct lttng_trigger *copy = NULL;
+       struct lttng_trigger *copy = nullptr;
        const struct lttng_credentials user_creds = {
                .uid = LTTNG_OPTIONAL_INIT_VALUE(geteuid()),
                .gid = LTTNG_OPTIONAL_INIT_UNSET,
@@ -3312,7 +3314,7 @@ enum lttng_error_code lttng_list_triggers(struct lttng_triggers **triggers)
                .u = {},
                .fd_count = 0,
        };
-       struct lttng_triggers *local_triggers = NULL;
+       struct lttng_triggers *local_triggers = nullptr;
        struct lttng_payload reply;
        struct lttng_payload_view lsm_view =
                lttng_payload_view_init_from_buffer((const char *) &lsm, 0, sizeof(lsm));
@@ -3337,7 +3339,7 @@ enum lttng_error_code lttng_list_triggers(struct lttng_triggers **triggers)
        }
 
        *triggers = local_triggers;
-       local_triggers = NULL;
+       local_triggers = nullptr;
 end:
        lttng_payload_reset(&reply);
        lttng_triggers_destroy(local_triggers);
@@ -3347,7 +3349,7 @@ end:
 /*
  * lib constructor.
  */
-static void __attribute__((constructor)) init(void)
+static void __attribute__((constructor)) init()
 {
        /* Set default session group */
        lttng_set_tracing_group(DEFAULT_TRACING_GROUP);
@@ -3356,7 +3358,7 @@ static void __attribute__((constructor)) init(void)
 /*
  * lib destructor.
  */
-static void __attribute__((destructor)) lttng_ctl_exit(void)
+static void __attribute__((destructor)) lttng_ctl_exit()
 {
        free(tracing_group);
 }
index 68b882686304a076f2d9b3533b7e31e3159a0b54..60ac8669d9defc07a19169a2409496437f1b30f6 100644 (file)
@@ -71,7 +71,7 @@ create_trace_archive_location_from_get_info(const struct lttng_rotation_get_info
                        info->location.relay.relative_path);
                break;
        default:
-               location = NULL;
+               location = nullptr;
                break;
        }
        return location;
@@ -82,7 +82,7 @@ lttng_rotation_handle_get_state(struct lttng_rotation_handle *rotation_handle,
                                enum lttng_rotation_state *state)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
-       struct lttng_rotation_get_info_return *info = NULL;
+       struct lttng_rotation_get_info_return *info = nullptr;
 
        if (!rotation_handle || !state) {
                status = LTTNG_ROTATION_STATUS_INVALID;
@@ -122,7 +122,7 @@ lttng_rotation_handle_get_archive_location(struct lttng_rotation_handle *rotatio
                                           const struct lttng_trace_archive_location **location)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
-       struct lttng_rotation_get_info_return *info = NULL;
+       struct lttng_rotation_get_info_return *info = nullptr;
 
        if (!rotation_handle || !location) {
                status = LTTNG_ROTATION_STATUS_INVALID;
@@ -192,7 +192,7 @@ int lttng_rotate_session(const char *session_name,
                         struct lttng_rotation_handle **rotation_handle)
 {
        struct lttcomm_session_msg lsm;
-       struct lttng_rotate_session_return *rotate_return = NULL;
+       struct lttng_rotate_session_return *rotate_return = nullptr;
        int ret;
        size_t session_name_len;
 
@@ -217,7 +217,7 @@ int lttng_rotate_session(const char *session_name,
 
        ret = lttng_ctl_ask_sessiond(&lsm, (void **) &rotate_return);
        if (ret <= 0) {
-               *rotation_handle = NULL;
+               *rotation_handle = nullptr;
                goto end;
        }
 
@@ -313,7 +313,7 @@ static enum lttng_rotation_status lttng_rotation_update_schedule(
                goto end;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
        if (ret >= 0) {
                goto end;
        }
@@ -332,7 +332,7 @@ end:
        return status;
 }
 
-static struct lttng_rotation_schedules *lttng_rotation_schedules_create(void)
+static struct lttng_rotation_schedules *lttng_rotation_schedules_create()
 {
        return zmalloc<lttng_rotation_schedules>();
 }
@@ -347,9 +347,9 @@ static int get_schedules(const char *session_name, struct lttng_rotation_schedul
 {
        int ret;
        struct lttcomm_session_msg lsm;
-       struct lttng_session_list_schedules_return *schedules_comm = NULL;
-       struct lttng_rotation_schedules *schedules = NULL;
-       struct lttng_rotation_schedule *periodic = NULL, *size = NULL;
+       struct lttng_session_list_schedules_return *schedules_comm = nullptr;
+       struct lttng_rotation_schedules *schedules = nullptr;
+       struct lttng_rotation_schedule *periodic = nullptr, *size = nullptr;
 
        if (!session_name) {
                ret = -LTTNG_ERR_INVALID;
@@ -396,7 +396,7 @@ static int get_schedules(const char *session_name, struct lttng_rotation_schedul
                }
 
                lttng_schedules_add(schedules, periodic);
-               periodic = NULL;
+               periodic = nullptr;
        }
 
        if (schedules_comm->size.set == 1) {
@@ -420,7 +420,7 @@ static int get_schedules(const char *session_name, struct lttng_rotation_schedul
                }
 
                lttng_schedules_add(schedules, size);
-               size = NULL;
+               size = nullptr;
        }
 
        ret = LTTNG_OK;
@@ -599,7 +599,7 @@ const struct lttng_rotation_schedule *
 lttng_rotation_schedules_get_at_index(const struct lttng_rotation_schedules *schedules,
                                      unsigned int index)
 {
-       const struct lttng_rotation_schedule *schedule = NULL;
+       const struct lttng_rotation_schedule *schedule = nullptr;
 
        if (!schedules || index >= schedules->count) {
                goto end;
index e53f5f68c51898085ad78e6941e4d2cfb2e11231..4cc2f8014ccc6c219e1a930ba126152823e079d3 100644 (file)
@@ -30,7 +30,7 @@ void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output)
 
 const char *lttng_save_session_attr_get_session_name(struct lttng_save_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (attr && attr->session_name[0]) {
                ret = attr->session_name;
@@ -41,7 +41,7 @@ const char *lttng_save_session_attr_get_session_name(struct lttng_save_session_a
 
 const char *lttng_save_session_attr_get_output_url(struct lttng_save_session_attr *attr)
 {
-       const char *ret = NULL;
+       const char *ret = nullptr;
 
        if (attr && attr->configuration_url[0]) {
                ret = attr->configuration_url;
@@ -101,7 +101,7 @@ int lttng_save_session_attr_set_output_url(struct lttng_save_session_attr *attr,
        int ret = 0;
        size_t len;
        ssize_t size;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
 
        if (!attr) {
                ret = -LTTNG_ERR_INVALID;
@@ -120,7 +120,7 @@ int lttng_save_session_attr_set_output_url(struct lttng_save_session_attr *attr,
                goto error;
        }
 
-       size = uri_parse_str_urls(url, NULL, &uris);
+       size = uri_parse_str_urls(url, nullptr, &uris);
        if (size <= 0 || uris[0].dtype != LTTNG_DST_PATH) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -201,7 +201,7 @@ int lttng_save_session(struct lttng_save_session_attr *attr)
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION;
 
        memcpy(&lsm.u.save_session.attr, attr, sizeof(struct lttng_save_session_attr));
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
 end:
        return ret;
 }
index dcdbbd130a630f0da9f96ed832473d5d8a6d8d90..4e7df2db39c60888c03b86529f1b0351f9093080 100644 (file)
@@ -81,7 +81,7 @@ int lttng_snapshot_del_output(const char *session_name, struct lttng_snapshot_ou
 
        memcpy(&lsm.u.snapshot_output.output, output, sizeof(lsm.u.snapshot_output.output));
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
 end:
        return ret;
 }
@@ -97,7 +97,7 @@ int lttng_snapshot_list_output(const char *session_name, struct lttng_snapshot_o
 {
        int ret;
        struct lttcomm_session_msg lsm;
-       struct lttng_snapshot_output_list *new_list = NULL;
+       struct lttng_snapshot_output_list *new_list = nullptr;
 
        if (!session_name || !list) {
                ret = -LTTNG_ERR_INVALID;
@@ -144,7 +144,7 @@ error:
 struct lttng_snapshot_output *
 lttng_snapshot_output_list_get_next(struct lttng_snapshot_output_list *list)
 {
-       struct lttng_snapshot_output *output = NULL;
+       struct lttng_snapshot_output *output = nullptr;
 
        if (!list) {
                goto error;
@@ -219,7 +219,7 @@ int lttng_snapshot_record(const char *session_name,
        }
 
        /* The wait param is ignored. */
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
 end:
        return ret;
 }
@@ -365,7 +365,7 @@ end:
 int lttng_snapshot_output_set_local_path(const char *path, struct lttng_snapshot_output *output)
 {
        int ret;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
        ssize_t num_uris;
 
        if (!path || !output) {
@@ -373,7 +373,7 @@ int lttng_snapshot_output_set_local_path(const char *path, struct lttng_snapshot
                goto end;
        }
 
-       num_uris = uri_parse_str_urls(path, NULL, &uris);
+       num_uris = uri_parse_str_urls(path, nullptr, &uris);
        if (num_uris != 1) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -398,7 +398,7 @@ end:
 int lttng_snapshot_output_set_network_url(const char *url, struct lttng_snapshot_output *output)
 {
        int ret;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
        ssize_t num_uris;
 
        if (!url || !output) {
@@ -406,7 +406,7 @@ int lttng_snapshot_output_set_network_url(const char *url, struct lttng_snapshot
                goto end;
        }
 
-       num_uris = uri_parse_str_urls(url, NULL, &uris);
+       num_uris = uri_parse_str_urls(url, nullptr, &uris);
        if (num_uris != 2) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -438,7 +438,7 @@ int lttng_snapshot_output_set_network_urls(const char *ctrl_url,
                                           struct lttng_snapshot_output *output)
 {
        int ret;
-       struct lttng_uri *uris = NULL;
+       struct lttng_uri *uris = nullptr;
        ssize_t num_uris;
 
        if (!ctrl_url || !data_url || !output) {
index cf32a4c33d8f80f7e48f2c7a020dbbfd41b42e62..6b7469fdf75c82412d9f15d39044e0ce2cd5551a 100644 (file)
@@ -41,7 +41,7 @@ lttng_session_get_tracker_handle(const char *session_name,
                                 struct lttng_process_attr_tracker_handle **out_tracker_handle)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
-       struct lttng_process_attr_tracker_handle *handle = NULL;
+       struct lttng_process_attr_tracker_handle *handle = nullptr;
        enum lttng_process_attr_tracker_handle_status status;
        enum lttng_tracking_policy policy;
 
@@ -96,7 +96,7 @@ error:
 enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_get_tracking_policy(
        const struct lttng_process_attr_tracker_handle *tracker, enum lttng_tracking_policy *policy)
 {
-       void *reply = NULL;
+       void *reply = nullptr;
        int reply_ret, copy_ret;
        enum lttng_process_attr_tracker_handle_status status =
                LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
@@ -124,7 +124,7 @@ enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_
                (int32_t) tracker->process_attr;
 
        /* Command returns a session descriptor on success. */
-       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, NULL, 0, &reply);
+       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, nullptr, 0, &reply);
        if (reply_ret != sizeof(uint32_t)) {
                if (reply_ret == -LTTNG_ERR_SESSION_NOT_EXIST ||
                    reply_ret == -LTTNG_ERR_SESS_NOT_FOUND) {
@@ -172,7 +172,7 @@ enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_
        lsm.u.process_attr_tracker_set_tracking_policy.tracking_policy = (int32_t) policy;
 
        /* Command returns a session descriptor on success. */
-       reply_ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+       reply_ret = lttng_ctl_ask_sessiond(&lsm, nullptr);
        if (reply_ret < 0) {
                if (reply_ret == -LTTNG_ERR_SESSION_NOT_EXIST) {
                        status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST;
@@ -358,7 +358,7 @@ enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_
        struct lttng_process_attr_tracker_handle *tracker,
        const struct lttng_process_attr_values **values)
 {
-       char *reply = NULL;
+       char *reply = nullptr;
        int reply_ret, copy_ret;
        enum lttng_process_attr_tracker_handle_status status =
                LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
@@ -378,7 +378,7 @@ enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_
        }
 
        lttng_process_attr_values_destroy(tracker->inclusion_set);
-       tracker->inclusion_set = NULL;
+       tracker->inclusion_set = nullptr;
 
        copy_ret = lttng_strncpy(lsm.session.name, tracker->session_name, sizeof(lsm.session.name));
        if (copy_ret) {
@@ -391,7 +391,7 @@ enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_
                (int32_t) tracker->process_attr;
 
        /* Command returns a session descriptor on success. */
-       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, NULL, 0, (void **) &reply);
+       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, nullptr, 0, (void **) &reply);
        if (reply_ret < 0) {
                if (reply_ret == -LTTNG_ERR_SESSION_NOT_EXIST) {
                        status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST;
@@ -532,7 +532,7 @@ handle_status_to_error_code(enum lttng_process_attr_tracker_handle_status handle
 int lttng_track_pid(struct lttng_handle *handle, int pid)
 {
        enum lttng_error_code ret_code;
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
        enum lttng_process_attr_tracker_handle_status handle_status;
        enum lttng_tracking_policy policy;
        enum lttng_process_attr process_attr;
@@ -592,7 +592,7 @@ end:
 int lttng_untrack_pid(struct lttng_handle *handle, int pid)
 {
        enum lttng_error_code ret_code;
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
        enum lttng_process_attr_tracker_handle_status handle_status;
        enum lttng_tracking_policy policy;
        enum lttng_process_attr process_attr;
@@ -662,12 +662,12 @@ int lttng_list_tracker_pids(struct lttng_handle *handle,
                            size_t *_nr_pids)
 {
        enum lttng_error_code ret_code;
-       struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+       struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
        enum lttng_process_attr_tracker_handle_status handle_status;
        const struct lttng_process_attr_values *values;
        enum lttng_tracking_policy policy;
        unsigned int pid_count, i;
-       int32_t *pid_array = NULL;
+       int32_t *pid_array = nullptr;
 
        if (!handle || !_enabled || !_pids || !_nr_pids) {
                ret_code = LTTNG_ERR_INVALID;
@@ -752,7 +752,7 @@ int lttng_list_tracker_pids(struct lttng_handle *handle,
        }
        *_nr_pids = (size_t) pid_count;
        *_pids = pid_array;
-       pid_array = NULL;
+       pid_array = nullptr;
 end:
        lttng_process_attr_tracker_handle_destroy(tracker_handle);
        free(pid_array);
index 225855ef747f18aa8ceb231009f15e403de4e0a7..f4e947497123b7b5c8e02a32230ad8035e7df095 100644 (file)
@@ -92,7 +92,7 @@ struct ppoll_thread_data {
 };
 } /* namespace */
 
-static void test_select_big(void)
+static void test_select_big()
 {
        fd_set rfds, wfds, exfds;
        struct timeval tv;
@@ -117,7 +117,7 @@ static void test_select_big(void)
        if (timeout > 0) {
                ret = select(fd2 + 1, &rfds, &wfds, &exfds, &tv);
        } else {
-               ret = select(fd2 + 1, &rfds, &wfds, &exfds, NULL);
+               ret = select(fd2 + 1, &rfds, &wfds, &exfds, nullptr);
        }
 
        if (ret == -1) {
@@ -138,7 +138,7 @@ end:
        return;
 }
 
-static void test_pselect(void)
+static void test_pselect()
 {
        fd_set rfds;
        struct timespec tv;
@@ -152,9 +152,9 @@ static void test_pselect(void)
        tv.tv_nsec = timeout * MSEC_PER_NSEC;
 
        if (timeout > 0) {
-               ret = pselect(1, &rfds, NULL, NULL, &tv, NULL);
+               ret = pselect(1, &rfds, nullptr, nullptr, &tv, nullptr);
        } else {
-               ret = pselect(1, &rfds, NULL, NULL, NULL, NULL);
+               ret = pselect(1, &rfds, nullptr, nullptr, nullptr, nullptr);
        }
 
        if (ret == -1) {
@@ -167,7 +167,7 @@ static void test_pselect(void)
        }
 }
 
-static void test_select(void)
+static void test_select()
 {
        fd_set rfds;
        struct timeval tv;
@@ -181,9 +181,9 @@ static void test_select(void)
        tv.tv_usec = timeout * MSEC_PER_USEC;
 
        if (timeout > 0) {
-               ret = select(1, &rfds, NULL, NULL, &tv);
+               ret = select(1, &rfds, nullptr, nullptr, &tv);
        } else {
-               ret = select(1, &rfds, NULL, NULL, NULL);
+               ret = select(1, &rfds, nullptr, nullptr, nullptr);
        }
 
        if (ret == -1) {
@@ -196,7 +196,7 @@ static void test_select(void)
        }
 }
 
-static void test_poll(void)
+static void test_poll()
 {
        struct pollfd ufds[NB_FD];
        char buf[BUF_SIZE];
@@ -217,7 +217,7 @@ static void test_poll(void)
        }
 }
 
-static void test_ppoll(void)
+static void test_ppoll()
 {
        struct pollfd ufds[NB_FD];
        char buf[BUF_SIZE];
@@ -230,9 +230,9 @@ static void test_ppoll(void)
        if (timeout > 0) {
                ts.tv_sec = 0;
                ts.tv_nsec = timeout * MSEC_PER_NSEC;
-               ret = ppoll(ufds, 1, &ts, NULL);
+               ret = ppoll(ufds, 1, &ts, nullptr);
        } else {
-               ret = ppoll(ufds, 1, NULL, NULL);
+               ret = ppoll(ufds, 1, nullptr, nullptr);
        }
 
        if (ret < 0) {
@@ -260,7 +260,7 @@ static void test_ppoll_big(FILE *validation_output_file __attribute__((unused)))
                ufds[i].events = POLLIN | POLLPRI;
        }
 
-       ret = ppoll(ufds, MAX_FDS, NULL, NULL);
+       ret = ppoll(ufds, MAX_FDS, nullptr, nullptr);
 
        if (ret < 0) {
                PERROR("ppoll");
@@ -358,9 +358,9 @@ static void test_epoll_pwait(FILE *validation_output_file)
        }
 
        if (timeout > 0) {
-               ret = epoll_pwait(epollfd, &epoll_event, 1, timeout, NULL);
+               ret = epoll_pwait(epollfd, &epoll_event, 1, timeout, nullptr);
        } else {
-               ret = epoll_pwait(epollfd, &epoll_event, 1, -1, NULL);
+               ret = epoll_pwait(epollfd, &epoll_event, 1, -1, nullptr);
        }
 
        if (ret == 1) {
@@ -665,7 +665,7 @@ static void *ppoll_writer(void *arg)
                usleep(100);
        }
 
-       return NULL;
+       return nullptr;
 }
 
 static void do_ppoll(int *fds, struct pollfd *ufds)
@@ -682,7 +682,7 @@ static void do_ppoll(int *fds, struct pollfd *ufds)
                ufds[i].events = POLLIN | POLLPRI;
        }
 
-       ret = ppoll(ufds, MAX_FDS, &ts, NULL);
+       ret = ppoll(ufds, MAX_FDS, &ts, nullptr);
 
        if (ret < 0) {
                PERROR("ppoll");
@@ -705,7 +705,7 @@ static void stress_ppoll(int *fds, int value)
        thread_data.value = value;
 
        stop_thread = 0;
-       ret = pthread_create(&writer, NULL, &ppoll_writer, (void *) &thread_data);
+       ret = pthread_create(&writer, nullptr, &ppoll_writer, (void *) &thread_data);
        if (ret != 0) {
                fprintf(stderr, "[error] pthread_create\n");
                goto end;
@@ -714,7 +714,7 @@ static void stress_ppoll(int *fds, int value)
                do_ppoll(fds, ufds);
        }
        stop_thread = 1;
-       ret = pthread_join(writer, NULL);
+       ret = pthread_join(writer, nullptr);
        if (ret) {
                fprintf(stderr, "[error] pthread_join\n");
                goto end;
@@ -762,14 +762,14 @@ static void ppoll_concurrent_write(FILE *validation_output_file __attribute__((u
 
 static void *epoll_pwait_writer(void *addr)
 {
-       srand(time(NULL));
+       srand(time(nullptr));
 
        while (!stop_thread) {
                usleep(rand() % 30);
                munmap(addr, MAX_FDS * sizeof(struct epoll_event));
        }
 
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -800,7 +800,7 @@ static void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
                goto error;
        }
 
-       epoll_event = (struct epoll_event *) mmap(NULL,
+       epoll_event = (struct epoll_event *) mmap(nullptr,
                                                  MAX_FDS * sizeof(struct epoll_event),
                                                  PROT_READ | PROT_WRITE,
                                                  MAP_PRIVATE | MAP_ANONYMOUS,
@@ -825,13 +825,13 @@ static void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
                }
        }
        stop_thread = 0;
-       ret = pthread_create(&writer, NULL, &epoll_pwait_writer, (void *) epoll_event);
+       ret = pthread_create(&writer, nullptr, &epoll_pwait_writer, (void *) epoll_event);
        if (ret != 0) {
                fprintf(stderr, "[error] pthread_create\n");
                goto error_unmap;
        }
 
-       ret = epoll_pwait(epollfd, epoll_event, 1, 1, NULL);
+       ret = epoll_pwait(epollfd, epoll_event, 1, 1, nullptr);
 
        if (ret == 1) {
                ret = read(wait_fd, buf, BUF_SIZE);
@@ -843,7 +843,7 @@ static void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
        }
 
        stop_thread = 1;
-       ret = pthread_join(writer, NULL);
+       ret = pthread_join(writer, nullptr);
        if (ret) {
                fprintf(stderr, "[error] pthread_join\n");
                goto error_unmap;
@@ -870,7 +870,7 @@ end:
        return;
 }
 
-static void print_list(void)
+static void print_list()
 {
        fprintf(stderr, "Test list (-t X):\n");
        fprintf(stderr,
@@ -909,23 +909,23 @@ int main(int argc, const char **argv)
        int c, ret, test = -1;
        poptContext optCon;
        struct rlimit open_lim;
-       FILE *test_validation_output_file = NULL;
-       const char *test_validation_output_file_path = NULL;
+       FILE *test_validation_output_file = nullptr;
+       const char *test_validation_output_file_path = nullptr;
        struct poptOption optionsTable[] = {
-               { "test", 't', POPT_ARG_INT, &test, 0, "Test to run", NULL },
-               { "list", 'l', 0, 0, 'l', "List of tests (-t X)", NULL },
+               { "test", 't', POPT_ARG_INT, &test, 0, "Test to run", nullptr },
+               { "list", 'l', 0, nullptr, 'l', "List of tests (-t X)", nullptr },
                { "validation-file",
                  'o',
                  POPT_ARG_STRING,
                  &test_validation_output_file_path,
                  0,
                  "Test case output",
-                 NULL },
-               POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL }
+                 nullptr },
+               POPT_AUTOHELP{ nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
        };
        const struct test_case *test_case;
 
-       optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
+       optCon = poptGetContext(nullptr, argc, argv, optionsTable, 0);
 
        if (argc < 2) {
                poptPrintUsage(optCon, stderr, 0);
@@ -971,7 +971,7 @@ int main(int argc, const char **argv)
         * for the validation, disabling the buffering on the validation file
         * works.
         */
-       setbuf(test_validation_output_file, NULL);
+       setbuf(test_validation_output_file, nullptr);
        wait_fd = STDIN_FILENO;
 
        /* Test case id is 1-based. */
index ab95135e4753d19cea1f5e1e8d9c4d97b54bc56b..9c9838ac7f337f6860ad4fb57519b5e83a6139c9 100644 (file)
@@ -138,7 +138,7 @@ end:
        return ret;
 }
 
-static int establish_connection(void)
+static int establish_connection()
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_connect connect;
@@ -229,7 +229,7 @@ error:
        return -1;
 }
 
-static int create_viewer_session(void)
+static int create_viewer_session()
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_create_session_response resp;
@@ -337,8 +337,12 @@ static int attach_session(uint64_t id)
 
                session->streams[i].ctf_trace_id = be64toh(stream.ctf_trace_id);
                session->streams[i].first_read = 1;
-               session->streams[i].mmap_base = mmap(
-                       NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+               session->streams[i].mmap_base = mmap(nullptr,
+                                                    mmap_size,
+                                                    PROT_READ | PROT_WRITE,
+                                                    MAP_PRIVATE | MAP_ANONYMOUS,
+                                                    -1,
+                                                    0);
                if (session->streams[i].mmap_base == MAP_FAILED) {
                        diag("mmap error");
                        goto error;
@@ -354,7 +358,7 @@ error:
        return -1;
 }
 
-static int get_metadata(void)
+static int get_metadata()
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_get_metadata rq;
@@ -362,7 +366,7 @@ static int get_metadata(void)
        ssize_t ret_len;
        int ret;
        uint64_t i;
-       char *data = NULL;
+       char *data = nullptr;
        uint64_t len = 0;
        int metadata_stream_id = -1;
 
@@ -449,7 +453,7 @@ error:
        return -1;
 }
 
-static int get_next_index(void)
+static int get_next_index()
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_get_next_index rq;
@@ -661,7 +665,7 @@ error:
        return ret;
 }
 
-int main(void)
+int main()
 {
        int ret;
        uint64_t session_id;
index e390fd9721dd2645e0d2e3972a249fe184904e78..d7dc4c21e011401ee09322913d7cc4936517be5b 100644 (file)
@@ -29,7 +29,7 @@ int lttng_opt_verbose;
 int lttng_opt_mi;
 int lttng_opt_quiet;
 
-static void __attribute__((destructor)) pause_pipe_fini(void)
+static void __attribute__((destructor)) pause_pipe_fini()
 {
        int ret;
 
@@ -67,9 +67,10 @@ int __testpoint_consumerd_thread_data(void)
         * dynamically would not allow this shared object to be LD_PRELOAD-ed
         * when launching the session daemon.
         */
-       data_consumption_state = (int *) dlsym(NULL, "data_consumption_paused");
+       data_consumption_state = (int *) dlsym(nullptr, "data_consumption_paused");
        LTTNG_ASSERT(data_consumption_state);
-       lttng_consumer_get_type = (lttng_consumer_type(*)()) dlsym(NULL, "lttng_consumer_get_type");
+       lttng_consumer_get_type =
+               (lttng_consumer_type(*)()) dlsym(nullptr, "lttng_consumer_get_type");
        LTTNG_ASSERT(lttng_consumer_get_type);
 
        switch (lttng_consumer_get_type()) {
index 8902774b3100c6125ccbf6cce3ca28c02c2be4bf..34eb3cdd35fd514498f1169da196239d7d1c0ecb 100644 (file)
@@ -30,7 +30,7 @@ namespace {
 /*
  * Return the default pipe buffer size or a negative error.
  */
-int get_pipe_size(void)
+int get_pipe_size()
 {
        int ret;
        /*
@@ -66,7 +66,7 @@ int get_pipe_size(void)
 #endif
 } /* namespace */
 
-int main(void)
+int main()
 {
        int ret;
 
index fe138c0b614e5c0c4e9d9c760369bd46f5705b9f..8eae08460a016034423b0ed2f6fd70c23a27e269 100644 (file)
@@ -39,7 +39,7 @@ using validate_cb = int (*)(const struct lttng_event_field_value *, unsigned int
 int nb_args = 0;
 int named_pipe_args_start = 0;
 pid_t app_pid = 0;
-const char *app_state_file = NULL;
+const char *app_state_file = nullptr;
 
 enum field_type {
        FIELD_TYPE_PAYLOAD,
@@ -335,7 +335,7 @@ end:
 static int validate_string(const struct lttng_event_field_value *event_field, const char *expect)
 {
        int ret;
-       const char *value = NULL;
+       const char *value = nullptr;
        enum lttng_event_field_value_status status;
 
        ret = validate_type(event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_STRING);
@@ -532,7 +532,7 @@ static int validate_context_procname_kernel(const struct lttng_event_field_value
 }
 
 struct capture_base_field_tuple test_capture_base_fields[] = {
-       { "DOESNOTEXIST", FIELD_TYPE_PAYLOAD, false, false, NULL, NULL },
+       { "DOESNOTEXIST", FIELD_TYPE_PAYLOAD, false, false, nullptr, nullptr },
        { "intfield",
          FIELD_TYPE_PAYLOAD,
          true,
@@ -615,7 +615,7 @@ struct capture_base_field_tuple test_capture_base_fields[] = {
 
 static const char *get_notification_trigger_name(struct lttng_notification *notification)
 {
-       const char *trigger_name = NULL;
+       const char *trigger_name = nullptr;
        enum lttng_trigger_status trigger_status;
        const struct lttng_trigger *trigger;
 
@@ -652,7 +652,7 @@ static int validator_notification_trigger_name(struct lttng_notification *notifi
        LTTNG_ASSERT(trigger_name);
 
        name = get_notification_trigger_name(notification);
-       if (name == NULL) {
+       if (name == nullptr) {
                ret = 1;
                goto end;
        }
@@ -682,7 +682,7 @@ static void wait_on_file(const char *path, bool file_exist)
                                 * The file does not exist. wait a bit and
                                 * continue looping until it does.
                                 */
-                               (void) poll(NULL, 0, 10);
+                               (void) poll(nullptr, 0, 10);
                                continue;
                        }
 
@@ -757,7 +757,7 @@ static int resume_consumer(const char **argv)
        return ret;
 }
 
-static int suspend_application(void)
+static int suspend_application()
 {
        int ret;
        struct stat buf;
@@ -786,7 +786,7 @@ error:
        return ret;
 }
 
-static int resume_application(void)
+static int resume_application()
 {
        int ret;
        struct stat buf;
@@ -832,14 +832,14 @@ static void test_triggers_buffer_usage_condition(const char *session_name,
        }
 
        /* Test lttng_register_trigger with null value */
-       ok(lttng_register_trigger(NULL) == -LTTNG_ERR_INVALID,
+       ok(lttng_register_trigger(nullptr) == -LTTNG_ERR_INVALID,
           "Registering a NULL trigger fails as expected");
 
        /* Test: register a trigger */
 
        for (i = 0; i < pow(2, test_vector_size); i++) {
                int loop_ret = 0;
-               char *test_tuple_string = NULL;
+               char *test_tuple_string = nullptr;
                unsigned int mask_position = 0;
                bool session_name_set = false;
                bool channel_name_set = false;
@@ -847,8 +847,8 @@ static void test_triggers_buffer_usage_condition(const char *session_name,
                bool threshold_byte_set = false;
                bool domain_type_set = false;
 
-               struct lttng_trigger *trigger = NULL;
-               struct lttng_condition *condition = NULL;
+               struct lttng_trigger *trigger = nullptr;
+               struct lttng_condition *condition = nullptr;
 
                /* Create base condition */
                switch (condition_type) {
@@ -1051,9 +1051,9 @@ static void test_invalid_channel_subscription(const enum lttng_domain_type domai
 {
        enum lttng_condition_status condition_status;
        enum lttng_notification_channel_status nc_status;
-       struct lttng_condition *dummy_condition = NULL;
-       struct lttng_condition *dummy_invalid_condition = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
+       struct lttng_condition *dummy_condition = nullptr;
+       struct lttng_condition *dummy_invalid_condition = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
        int ret = 0;
 
        notification_channel =
@@ -1110,15 +1110,15 @@ static void test_invalid_channel_subscription(const enum lttng_domain_type domai
         * Test subscription and unsubscription to/from a channel with invalid
         * parameters.
         */
-       nc_status = lttng_notification_channel_subscribe(NULL, NULL);
+       nc_status = lttng_notification_channel_subscribe(nullptr, nullptr);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
           "Notification channel subscription is invalid: NULL, NULL");
 
-       nc_status = lttng_notification_channel_subscribe(notification_channel, NULL);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, nullptr);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
           "Notification channel subscription is invalid: NON-NULL, NULL");
 
-       nc_status = lttng_notification_channel_subscribe(NULL, dummy_condition);
+       nc_status = lttng_notification_channel_subscribe(nullptr, dummy_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
           "Notification channel subscription is invalid: NULL, NON-NULL");
 
@@ -1148,9 +1148,9 @@ static int register_buffer_usage_notify_trigger(const char *session_name,
                                                struct lttng_trigger **trigger)
 {
        enum lttng_condition_status condition_status;
-       struct lttng_action *tmp_action = NULL;
-       struct lttng_condition *tmp_condition = NULL;
-       struct lttng_trigger *tmp_trigger = NULL;
+       struct lttng_action *tmp_action = nullptr;
+       struct lttng_condition *tmp_condition = nullptr;
+       struct lttng_trigger *tmp_trigger = nullptr;
        int ret = 0;
 
        /* Set-up */
@@ -1225,11 +1225,11 @@ static void test_subscription_twice(const char *session_name,
        int ret = 0;
        enum lttng_notification_channel_status nc_status;
 
-       struct lttng_action *action = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_action *action = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_trigger *trigger = nullptr;
 
-       struct lttng_condition *condition = NULL;
+       struct lttng_condition *condition = nullptr;
 
        ret = register_buffer_usage_notify_trigger(session_name,
                                                   channel_name,
@@ -1281,15 +1281,15 @@ static void test_buffer_usage_notification_channel(const char *session_name,
        int ret = 0;
        enum lttng_notification_channel_status nc_status;
 
-       struct lttng_action *low_action = NULL;
-       struct lttng_action *high_action = NULL;
-       struct lttng_notification *notification = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_trigger *low_trigger = NULL;
-       struct lttng_trigger *high_trigger = NULL;
+       struct lttng_action *low_action = nullptr;
+       struct lttng_action *high_action = nullptr;
+       struct lttng_notification *notification = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_trigger *low_trigger = nullptr;
+       struct lttng_trigger *high_trigger = nullptr;
 
-       struct lttng_condition *low_condition = NULL;
-       struct lttng_condition *high_condition = NULL;
+       struct lttng_condition *low_condition = nullptr;
+       struct lttng_condition *high_condition = nullptr;
 
        const double low_ratio = 0.0;
        const double high_ratio = 0.90;
@@ -1352,7 +1352,7 @@ static void test_buffer_usage_notification_channel(const char *session_name,
                           LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
           "High notification received after intermediary communication");
        lttng_notification_destroy(notification);
-       notification = NULL;
+       notification = nullptr;
 
        suspend_application();
        lttng_stop_tracing_no_wait(session_name);
@@ -1381,7 +1381,7 @@ static void test_buffer_usage_notification_channel(const char *session_name,
                           LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW,
           "Low notification received after intermediary communication");
        lttng_notification_destroy(notification);
-       notification = NULL;
+       notification = nullptr;
 
        /* Stop consumer to force a high notification */
        stop_consumer(argv);
@@ -1397,7 +1397,7 @@ static void test_buffer_usage_notification_channel(const char *session_name,
                           LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
           "High notification received after intermediary communication");
        lttng_notification_destroy(notification);
-       notification = NULL;
+       notification = nullptr;
 
        suspend_application();
        lttng_stop_tracing_no_wait(session_name);
@@ -1413,7 +1413,7 @@ static void test_buffer_usage_notification_channel(const char *session_name,
                           LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW,
           "Low notification received after re-subscription");
        lttng_notification_destroy(notification);
-       notification = NULL;
+       notification = nullptr;
 
        stop_consumer(argv);
        resume_application();
@@ -1429,7 +1429,7 @@ static void test_buffer_usage_notification_channel(const char *session_name,
                           LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
           "High notification");
        lttng_notification_destroy(notification);
-       notification = NULL;
+       notification = nullptr;
 
        suspend_application();
 
@@ -1475,10 +1475,10 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                enum lttng_event_rule_status (*)(struct lttng_event_rule *, const char *);
 
        enum lttng_event_rule_status event_rule_status;
-       struct lttng_action *tmp_action = NULL;
-       struct lttng_event_rule *event_rule = NULL;
-       struct lttng_condition *tmp_condition = NULL;
-       struct lttng_trigger *tmp_trigger = NULL;
+       struct lttng_action *tmp_action = nullptr;
+       struct lttng_event_rule *event_rule = nullptr;
+       struct lttng_condition *tmp_condition = nullptr;
+       struct lttng_trigger *tmp_trigger = nullptr;
        int ret;
        enum lttng_error_code ret_code;
        event_rule_create create;
@@ -1504,7 +1504,7 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                create = lttng_event_rule_kernel_tracepoint_create;
                set_name_pattern = lttng_event_rule_kernel_tracepoint_set_name_pattern;
                set_filter = lttng_event_rule_kernel_tracepoint_set_filter;
-               add_name_pattern_exclusion = NULL;
+               add_name_pattern_exclusion = nullptr;
                break;
        default:
                abort();
@@ -1531,7 +1531,7 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                bool success = true;
 
                LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_UST);
-               LTTNG_ASSERT(add_name_pattern_exclusion != NULL);
+               LTTNG_ASSERT(add_name_pattern_exclusion != nullptr);
                LTTNG_ASSERT(exclusion_count > 0);
 
                for (i = 0; i < exclusion_count; i++) {
@@ -1577,7 +1577,7 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
 static struct lttng_notification *
 get_next_notification(struct lttng_notification_channel *notification_channel)
 {
-       struct lttng_notification *local_notification = NULL;
+       struct lttng_notification *local_notification = nullptr;
        enum lttng_notification_channel_status status;
 
        /* Receive the next notification. */
@@ -1589,13 +1589,13 @@ get_next_notification(struct lttng_notification_channel *notification_channel)
                break;
        case LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED:
                fail("Notifications have been dropped");
-               local_notification = NULL;
+               local_notification = nullptr;
                break;
        default:
                /* Unhandled conditions / errors. */
                fail("Failed to get next notification (unknown notification channel status): status = %d",
                     (int) status);
-               local_notification = NULL;
+               local_notification = nullptr;
                break;
        }
 
@@ -1608,10 +1608,10 @@ static void test_tracepoint_event_rule_notification(enum lttng_domain_type domai
        int ret;
        const int notification_count = 3;
        enum lttng_notification_channel_status nc_status;
-       struct lttng_action *action = NULL;
-       struct lttng_condition *condition = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_action *action = nullptr;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_trigger *trigger = nullptr;
        const char *const trigger_name = "my_precious";
        const char *pattern;
 
@@ -1621,8 +1621,15 @@ static void test_tracepoint_event_rule_notification(enum lttng_domain_type domai
                pattern = "lttng_test_filter_event";
        }
 
-       create_tracepoint_event_rule_trigger(
-               pattern, trigger_name, NULL, 0, NULL, domain_type, NULL, &condition, &trigger);
+       create_tracepoint_event_rule_trigger(pattern,
+                                            trigger_name,
+                                            nullptr,
+                                            0,
+                                            nullptr,
+                                            domain_type,
+                                            nullptr,
+                                            &condition,
+                                            &trigger);
 
        notification_channel =
                lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
@@ -1642,7 +1649,7 @@ static void test_tracepoint_event_rule_notification(enum lttng_domain_type domai
                ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
@@ -1668,9 +1675,9 @@ static void test_tracepoint_event_rule_notification_filter(enum lttng_domain_typ
        int i;
        const int notification_count = 3;
        enum lttng_notification_channel_status nc_status;
-       struct lttng_condition *ctrl_condition = NULL, *condition = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_trigger *ctrl_trigger = NULL, *trigger = NULL;
+       struct lttng_condition *ctrl_condition = nullptr, *condition = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_trigger *ctrl_trigger = nullptr, *trigger = nullptr;
        const char *const ctrl_trigger_name = "control_trigger";
        const char *const trigger_name = "trigger";
        const char *pattern;
@@ -1688,11 +1695,11 @@ static void test_tracepoint_event_rule_notification_filter(enum lttng_domain_typ
 
        create_tracepoint_event_rule_trigger(pattern,
                                             ctrl_trigger_name,
-                                            NULL,
+                                            nullptr,
                                             0,
-                                            NULL,
+                                            nullptr,
                                             domain_type,
-                                            NULL,
+                                            nullptr,
                                             &ctrl_condition,
                                             &ctrl_trigger);
 
@@ -1708,9 +1715,9 @@ static void test_tracepoint_event_rule_notification_filter(enum lttng_domain_typ
                                             trigger_name,
                                             "(intfield & 1) == 0",
                                             0,
-                                            NULL,
+                                            nullptr,
                                             domain_type,
-                                            NULL,
+                                            nullptr,
                                             &condition,
                                             &trigger);
 
@@ -1739,12 +1746,12 @@ static void test_tracepoint_event_rule_notification_filter(enum lttng_domain_typ
                ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
                name = get_notification_trigger_name(notification);
-               if (name == NULL) {
+               if (name == nullptr) {
                        lttng_notification_destroy(notification);
                        goto end;
                }
@@ -1775,9 +1782,9 @@ end:
 static void test_tracepoint_event_rule_notification_exclusion(enum lttng_domain_type domain_type)
 {
        enum lttng_notification_channel_status nc_status;
-       struct lttng_condition *ctrl_condition = NULL, *condition = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_trigger *ctrl_trigger = NULL, *trigger = NULL;
+       struct lttng_condition *ctrl_condition = nullptr, *condition = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_trigger *ctrl_trigger = nullptr, *trigger = nullptr;
        int ctrl_count = 0, count = 0, i;
        const int notification_count = 6;
        const char *const ctrl_trigger_name = "control_exclusion_trigger";
@@ -1791,11 +1798,11 @@ static void test_tracepoint_event_rule_notification_exclusion(enum lttng_domain_
 
        create_tracepoint_event_rule_trigger(pattern,
                                             ctrl_trigger_name,
-                                            NULL,
+                                            nullptr,
                                             0,
-                                            NULL,
+                                            nullptr,
                                             domain_type,
-                                            NULL,
+                                            nullptr,
                                             &ctrl_condition,
                                             &ctrl_trigger);
 
@@ -1803,8 +1810,15 @@ static void test_tracepoint_event_rule_notification_exclusion(enum lttng_domain_
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
           "Subscribe to tracepoint event rule condition");
 
-       create_tracepoint_event_rule_trigger(
-               pattern, trigger_name, NULL, 4, exclusions, domain_type, NULL, &condition, &trigger);
+       create_tracepoint_event_rule_trigger(pattern,
+                                            trigger_name,
+                                            nullptr,
+                                            4,
+                                            exclusions,
+                                            domain_type,
+                                            nullptr,
+                                            &condition,
+                                            &trigger);
 
        nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
@@ -1835,12 +1849,12 @@ static void test_tracepoint_event_rule_notification_exclusion(enum lttng_domain_
                ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
                name = get_notification_trigger_name(notification);
-               if (name == NULL) {
+               if (name == nullptr) {
                        lttng_notification_destroy(notification);
                        goto end;
                }
@@ -1869,19 +1883,19 @@ end:
        return;
 }
 
-static void test_kprobe_event_rule_notification(void)
+static void test_kprobe_event_rule_notification()
 {
        int i, ret;
        enum lttng_error_code ret_code;
        const int notification_count = 3;
        enum lttng_notification_channel_status nc_status;
        enum lttng_event_rule_status event_rule_status;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_condition *condition = NULL;
-       struct lttng_kernel_probe_location *location = NULL;
-       struct lttng_event_rule *event_rule = NULL;
-       struct lttng_action *action = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_kernel_probe_location *location = nullptr;
+       struct lttng_event_rule *event_rule = nullptr;
+       struct lttng_action *action = nullptr;
+       struct lttng_trigger *trigger = nullptr;
        const char *const trigger_name = "kprobe_trigger";
        const char *const symbol_name = "lttng_test_filter_event_write";
 
@@ -1938,7 +1952,7 @@ static void test_kprobe_event_rule_notification(void)
                ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
@@ -1969,13 +1983,13 @@ static void test_uprobe_event_rule_notification(const char *testapp_path,
        const int notification_count = 3;
        enum lttng_notification_channel_status nc_status;
        enum lttng_event_rule_status event_rule_status;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_userspace_probe_location *probe_location = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
-       struct lttng_condition *condition = NULL;
-       struct lttng_event_rule *event_rule = NULL;
-       struct lttng_action *action = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_userspace_probe_location *probe_location = nullptr;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_event_rule *event_rule = nullptr;
+       struct lttng_action *action = nullptr;
+       struct lttng_trigger *trigger = nullptr;
        const char *const trigger_name = "uprobe_trigger";
 
        action = lttng_action_notify_create();
@@ -2038,7 +2052,7 @@ static void test_uprobe_event_rule_notification(const char *testapp_path,
                ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
@@ -2061,18 +2075,18 @@ end:
        return;
 }
 
-static void test_syscall_event_rule_notification(void)
+static void test_syscall_event_rule_notification()
 {
        int i, ret;
        enum lttng_error_code ret_code;
        const int notification_count = 3;
        enum lttng_notification_channel_status nc_status;
        enum lttng_event_rule_status event_rule_status;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_condition *condition = NULL;
-       struct lttng_event_rule *event_rule = NULL;
-       struct lttng_action *action = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_event_rule *event_rule = nullptr;
+       struct lttng_action *action = nullptr;
+       struct lttng_trigger *trigger = nullptr;
        const char *const trigger_name = "syscall_trigger";
        const char *const syscall_name = "openat";
 
@@ -2125,7 +2139,7 @@ static void test_syscall_event_rule_notification(void)
                ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
@@ -2145,18 +2159,18 @@ end:
        return;
 }
 
-static void test_syscall_event_rule_notification_filter(void)
+static void test_syscall_event_rule_notification_filter()
 {
        int i, ret;
        enum lttng_error_code ret_code;
        const int notification_count = 3;
        enum lttng_notification_channel_status nc_status;
        enum lttng_event_rule_status event_rule_status;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_condition *condition = NULL;
-       struct lttng_event_rule *event_rule = NULL;
-       struct lttng_action *action = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_event_rule *event_rule = nullptr;
+       struct lttng_action *action = nullptr;
+       struct lttng_trigger *trigger = nullptr;
        const char *const trigger_name = "syscall_trigger";
        const char *const syscall_name = "openat";
        const char *const filter_pattern = "filename == \"/proc/cpuinfo\"";
@@ -2213,7 +2227,7 @@ static void test_syscall_event_rule_notification_filter(void)
                ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
@@ -2238,7 +2252,7 @@ end:
 static int generate_capture_descr(struct lttng_condition *condition)
 {
        int ret, i;
-       struct lttng_event_expr *expr = NULL;
+       struct lttng_event_expr *expr = nullptr;
        const unsigned int basic_field_count =
                sizeof(test_capture_base_fields) / sizeof(*test_capture_base_fields);
        enum lttng_condition_status cond_status;
@@ -2260,7 +2274,7 @@ static int generate_capture_descr(struct lttng_condition *condition)
                        int nb_matches;
                        unsigned int index;
                        char field_name[FIELD_NAME_MAX_LEN];
-                       struct lttng_event_expr *array_expr = NULL;
+                       struct lttng_event_expr *array_expr = nullptr;
 
                        nb_matches = sscanf(test_capture_base_fields[i].field_name,
                                            "%[^[][%u]",
@@ -2286,7 +2300,7 @@ static int generate_capture_descr(struct lttng_condition *condition)
                        goto end;
                }
 
-               if (expr == NULL) {
+               if (expr == nullptr) {
                        fail("Failed to create capture expression");
                        ret = -1;
                        goto end;
@@ -2321,7 +2335,7 @@ static int validator_notification_trigger_capture(enum lttng_domain_type domain,
        bool at_least_one_error = false;
 
        evaluation = lttng_notification_get_evaluation(notification);
-       if (evaluation == NULL) {
+       if (evaluation == nullptr) {
                fail("Failed to get evaluation from notification during trigger capture test");
                ret = 1;
                goto end;
@@ -2346,7 +2360,7 @@ static int validator_notification_trigger_capture(enum lttng_domain_type domain,
        }
 
        for (i = 0; i < capture_count; i++) {
-               const struct lttng_event_field_value *captured_field = NULL;
+               const struct lttng_event_field_value *captured_field = nullptr;
                validate_cb validate;
                bool expected;
 
@@ -2413,9 +2427,9 @@ static void test_tracepoint_event_rule_notification_capture(enum lttng_domain_ty
        enum lttng_notification_channel_status nc_status;
 
        int i, ret;
-       struct lttng_condition *condition = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
+       struct lttng_trigger *trigger = nullptr;
        const char *trigger_name = "my_precious";
        const char *pattern;
 
@@ -2427,9 +2441,9 @@ static void test_tracepoint_event_rule_notification_capture(enum lttng_domain_ty
 
        create_tracepoint_event_rule_trigger(pattern,
                                             trigger_name,
-                                            NULL,
+                                            nullptr,
                                             0,
-                                            NULL,
+                                            nullptr,
                                             domain_type,
                                             generate_capture_descr,
                                             &condition,
@@ -2452,7 +2466,7 @@ static void test_tracepoint_event_rule_notification_capture(enum lttng_domain_ty
                ok(notification, "Received notification");
 
                /* Error */
-               if (notification == NULL) {
+               if (notification == nullptr) {
                        goto end;
                }
 
@@ -2483,7 +2497,7 @@ end:
 int main(int argc, const char *argv[])
 {
        int test_scenario;
-       const char *domain_type_string = NULL;
+       const char *domain_type_string = nullptr;
        enum lttng_domain_type domain_type = LTTNG_DOMAIN_NONE;
 
        if (argc < 5) {
index 3baea63230dcfc27cf3d85bea7d113155295ed15..44e6b6e7b7a2ffee9d721aeaaa1e6ac4124b985a 100644 (file)
@@ -29,7 +29,7 @@ int lttng_opt_verbose;
 int lttng_opt_mi;
 int lttng_opt_quiet;
 
-static void __attribute__((destructor)) pause_pipe_fini(void)
+static void __attribute__((destructor)) pause_pipe_fini()
 {
        int ret;
 
@@ -56,7 +56,7 @@ int __testpoint_sessiond_thread_notification(void)
                goto end;
        }
 
-       notifier_notif_consumption_state = (int *) dlsym(NULL, "notifier_consumption_paused");
+       notifier_notif_consumption_state = (int *) dlsym(nullptr, "notifier_consumption_paused");
        LTTNG_ASSERT(notifier_notif_consumption_state);
 
        ret = asprintf(&pause_pipe_path, "%s", pause_pipe_path_prefix);
index 13148524814b43362922eb28da23e025b5e07977..a7d0d149d45cf8014d64f20c30a672afbc8ccecd 100644 (file)
 #define TEST_SESSION_NAME "test_session"
 #define TEST_CHANNEL_NAME "test_channel"
 
-static int get_registered_triggers_count(void)
+static int get_registered_triggers_count()
 {
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_trigger_status trigger_status;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int trigger_count;
 
        ret_code = lttng_list_triggers(&triggers);
@@ -57,7 +57,7 @@ end:
 static int setup_session_with_size_rotation_schedule(const char *session_output_path)
 {
        int ret;
-       struct lttng_session_descriptor *session_desriptor = NULL;
+       struct lttng_session_descriptor *session_desriptor = nullptr;
        enum lttng_error_code ret_code;
        struct lttng_handle ust_channel_handle = { TEST_SESSION_NAME,
                                                   {
@@ -77,7 +77,7 @@ static int setup_session_with_size_rotation_schedule(const char *session_output_
        channel_cfg.attr.output = LTTNG_EVENT_MMAP;
 
        enum lttng_rotation_status rotation_status;
-       struct lttng_rotation_schedule *rotation_schedule = NULL;
+       struct lttng_rotation_schedule *rotation_schedule = nullptr;
 
        session_desriptor =
                lttng_session_descriptor_local_create(TEST_SESSION_NAME, session_output_path);
index 039b7bf3a239f99cf53bdc6d7da22f783119b252..b878af48639771979821777821aec3df4548183e 100644 (file)
@@ -71,12 +71,12 @@ unregistration_trigger_instance_name(enum unregistration_trigger_instance unregi
  * Returns a negative error code on error, else the number of unregistered
  * triggers.
  */
-static int unregister_all_triggers(void)
+static int unregister_all_triggers()
 {
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_trigger_status trigger_status;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int trigger_count, i, unregistered_trigger_count = 0;
 
        ret_code = lttng_list_triggers(&triggers);
@@ -122,12 +122,12 @@ end:
        return ret;
 }
 
-static int get_registered_triggers_count(void)
+static int get_registered_triggers_count()
 {
        int ret;
        enum lttng_error_code ret_code;
        enum lttng_trigger_status trigger_status;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int trigger_count;
 
        ret_code = lttng_list_triggers(&triggers);
@@ -157,9 +157,9 @@ end:
  */
 static struct lttng_trigger *create_trigger(uint64_t threshold)
 {
-       struct lttng_condition *condition = NULL;
-       struct lttng_action *action = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_action *action = nullptr;
+       struct lttng_trigger *trigger = nullptr;
        enum lttng_condition_status condition_status;
        const char *const session_name = "test session";
 
@@ -207,7 +207,7 @@ static void register_anonymous_trigger(enum unregistration_trigger_instance unre
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
        enum lttng_trigger_status trigger_status;
        const char *trigger_name;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int trigger_count, i;
        enum lttng_error_code ret_code;
 
@@ -278,7 +278,7 @@ static void register_named_trigger(enum unregistration_trigger_instance unregist
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
        enum lttng_trigger_status trigger_status;
        const char *returned_trigger_name;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int trigger_count, i;
        enum lttng_error_code ret_code;
        const char *const trigger_name = "some name that is hopefully unique";
@@ -362,7 +362,7 @@ register_automatic_name_trigger(enum unregistration_trigger_instance unregistrat
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
        enum lttng_trigger_status trigger_status;
        const char *returned_trigger_name;
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int trigger_count, i;
        enum lttng_error_code ret_code;
 
@@ -436,7 +436,7 @@ double_register_anonymous_trigger(enum unregistration_trigger_instance unregistr
 {
        int ret;
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
 
        diag("Register duplicate anonymous trigger (Unregistration performed with the trigger instance %s)",
             unregistration_trigger_instance_name(unregistration_trigger));
@@ -474,7 +474,7 @@ double_register_named_trigger(enum unregistration_trigger_instance unregistratio
        int ret;
        struct lttng_trigger *trigger_a = create_trigger(0xbadc0ffee);
        struct lttng_trigger *trigger_b = create_trigger(0xbadc0ffee);
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        const char *const trigger_name = "a unique trigger name";
        enum lttng_error_code ret_code;
 
@@ -527,7 +527,7 @@ double_register_automatic_name_trigger(enum unregistration_trigger_instance unre
        int ret;
        struct lttng_trigger *trigger_a = create_trigger(0xbadc0ffee);
        struct lttng_trigger *trigger_b = create_trigger(0xbadc0ffee);
-       struct lttng_triggers *triggers = NULL;
+       struct lttng_triggers *triggers = nullptr;
        enum lttng_error_code ret_code;
 
        diag("Register duplicate automatic name trigger (Unregistration performed with the trigger instance %s)",
@@ -571,7 +571,7 @@ end:
        lttng_trigger_destroy(trigger_b);
 }
 
-static void register_multiple_anonymous_triggers(void)
+static void register_multiple_anonymous_triggers()
 {
        int ret;
        struct lttng_trigger *trigger_a = create_trigger(0xbadc0ffee);
@@ -604,7 +604,7 @@ const test_function test_functions[] = {
        double_register_named_trigger,   double_register_automatic_name_trigger,
 };
 
-int main(void)
+int main()
 {
        size_t i;
 
index 1e21c79978c02917106a86d63cc4802e57e6cb56..97257cf12507b37859feb3284e93fdd1cfde55ef 100644 (file)
@@ -67,7 +67,7 @@ static struct lttng_condition *create_session_consumed_size_condition(const char
        return condition;
 }
 
-static void test_session_consumed_size_condition(void)
+static void test_session_consumed_size_condition()
 {
        register_trigger_action_list_notify(
                "trigger-with-session-consumed-size-condition",
@@ -175,7 +175,7 @@ create_buffer_usage_low_ratio_condition(const char *session_name,
        return condition;
 }
 
-static void test_buffer_usage_conditions(void)
+static void test_buffer_usage_conditions()
 {
        register_trigger_action_list_notify(
                "trigger-with-buffer-usage-high-bytes-condition",
@@ -230,7 +230,7 @@ static struct lttng_condition *create_session_rotation_completed_condition(const
        return condition;
 }
 
-static void test_session_rotation_conditions(void)
+static void test_session_rotation_conditions()
 {
        register_trigger_action_list_notify(
                "trigger-with-session-rotation-ongoing-condition",
@@ -243,7 +243,7 @@ static void test_session_rotation_conditions(void)
 
 static struct {
        const char *name;
-       void (*callback)(void);
+       void (*callback)();
 } tests[] = {
        {
                "test_session_consumed_size_condition",
@@ -253,7 +253,7 @@ static struct {
        { "test_session_rotation_conditions", test_session_rotation_conditions },
 };
 
-static void show_known_tests(void)
+static void show_known_tests()
 {
        size_t i;
 
index 976a32db6056cfae23a0b52fb432363e74a54846..4cc22119b63e3148881beebfde86a78ecab21df8 100644 (file)
@@ -66,7 +66,7 @@ end:
 
 int main(int argc, char **argv)
 {
-       char *path = NULL;
+       char *path = nullptr;
        int ret;
        struct state state = {};
 
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
 
        plan_no_plan();
        ret = config_get_section_entries(
-               path, NULL, (config_entry_handler_cb) entry_handler, &state);
+               path, nullptr, (config_entry_handler_cb) entry_handler, &state);
        ok(ret == 0, "Successfully opened a config file, registered to all sections");
        ok(state.section_1 && state.section_2 && state.section_3 && state.section_global,
           "Processed entries from each sections");
index 5256a4fca2b54c4f365c15a9ed1ebde360cc4344..c54b0278dbc4d92b9570160bda86384b954e5248 100644 (file)
@@ -35,12 +35,12 @@ int lttng_opt_mi;
 
 #define NUM_TESTS 60
 
-static void test_action_notify(void)
+static void test_action_notify()
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *notify_action = NULL, *notify_action_from_buffer = NULL;
-       struct lttng_rate_policy *policy = NULL, *default_policy;
+       struct lttng_action *notify_action = nullptr, *notify_action_from_buffer = nullptr;
+       struct lttng_rate_policy *policy = nullptr, *default_policy;
        struct lttng_payload payload;
 
        lttng_payload_init(&payload);
@@ -59,7 +59,7 @@ static void test_action_notify(void)
 
        /* Validate the default policy for a notify action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_notify_get_rate_policy(notify_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
                           lttng_rate_policy_is_equal(default_policy, cur_policy),
@@ -72,7 +72,7 @@ static void test_action_notify(void)
 
        /* Validate the custom policy for a notify action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_notify_get_rate_policy(notify_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
                           lttng_rate_policy_is_equal(policy, cur_policy),
@@ -98,13 +98,13 @@ static void test_action_notify(void)
        lttng_payload_reset(&payload);
 }
 
-static void test_action_rotate_session(void)
+static void test_action_rotate_session()
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *rotate_session_action = NULL,
-                           *rotate_session_action_from_buffer = NULL;
-       struct lttng_rate_policy *policy = NULL, *default_policy;
+       struct lttng_action *rotate_session_action = nullptr,
+                           *rotate_session_action_from_buffer = nullptr;
+       struct lttng_rate_policy *policy = nullptr, *default_policy;
        struct lttng_payload payload;
        const char *session_name = "my_session_name";
        const char *get_session_name;
@@ -124,11 +124,11 @@ static void test_action_rotate_session(void)
           "Action has type LTTNG_ACTION_TYPE_ROTATE_SESSION");
 
        /* Session name setter. */
-       status = lttng_action_rotate_session_set_session_name(NULL, NULL);
+       status = lttng_action_rotate_session_set_session_name(nullptr, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_rotate_session_set_session_name(rotate_session_action, NULL);
+       status = lttng_action_rotate_session_set_session_name(rotate_session_action, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
-       status = lttng_action_rotate_session_set_session_name(NULL, session_name);
+       status = lttng_action_rotate_session_set_session_name(nullptr, session_name);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
@@ -144,7 +144,7 @@ static void test_action_rotate_session(void)
 
        /* Validate the default policy for a rotate_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_rotate_session_get_rate_policy(rotate_session_action,
                                                                     &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -158,7 +158,7 @@ static void test_action_rotate_session(void)
 
        /* Validate the custom policy for a rotate_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_rotate_session_get_rate_policy(rotate_session_action,
                                                                     &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -187,12 +187,13 @@ static void test_action_rotate_session(void)
        lttng_payload_reset(&payload);
 }
 
-static void test_action_start_session(void)
+static void test_action_start_session()
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *start_session_action = NULL, *start_session_action_from_buffer = NULL;
-       struct lttng_rate_policy *policy = NULL, *default_policy;
+       struct lttng_action *start_session_action = nullptr,
+                           *start_session_action_from_buffer = nullptr;
+       struct lttng_rate_policy *policy = nullptr, *default_policy;
        struct lttng_payload payload;
        const char *session_name = "my_session_name";
        const char *get_session_name;
@@ -212,11 +213,11 @@ static void test_action_start_session(void)
           "Action has type LTTNG_ACTION_TYPE_START_SESSION");
 
        /* Session name setter. */
-       status = lttng_action_start_session_set_session_name(NULL, NULL);
+       status = lttng_action_start_session_set_session_name(nullptr, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_start_session_set_session_name(start_session_action, NULL);
+       status = lttng_action_start_session_set_session_name(start_session_action, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
-       status = lttng_action_start_session_set_session_name(NULL, session_name);
+       status = lttng_action_start_session_set_session_name(nullptr, session_name);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
@@ -232,7 +233,7 @@ static void test_action_start_session(void)
 
        /* Validate the default policy for a start_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_start_session_get_rate_policy(start_session_action,
                                                                    &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -246,7 +247,7 @@ static void test_action_start_session(void)
 
        /* Validate the custom policy for a start_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_start_session_get_rate_policy(start_session_action,
                                                                    &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -275,12 +276,13 @@ static void test_action_start_session(void)
        lttng_payload_reset(&payload);
 }
 
-static void test_action_stop_session(void)
+static void test_action_stop_session()
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *stop_session_action = NULL, *stop_session_action_from_buffer = NULL;
-       struct lttng_rate_policy *policy = NULL, *default_policy;
+       struct lttng_action *stop_session_action = nullptr,
+                           *stop_session_action_from_buffer = nullptr;
+       struct lttng_rate_policy *policy = nullptr, *default_policy;
        struct lttng_payload payload;
        const char *session_name = "my_session_name";
        const char *get_session_name;
@@ -300,11 +302,11 @@ static void test_action_stop_session(void)
           "Action has type LTTNG_ACTION_TYPE_STOP_SESSION");
 
        /* Session name setter. */
-       status = lttng_action_stop_session_set_session_name(NULL, NULL);
+       status = lttng_action_stop_session_set_session_name(nullptr, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_stop_session_set_session_name(stop_session_action, NULL);
+       status = lttng_action_stop_session_set_session_name(stop_session_action, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
-       status = lttng_action_stop_session_set_session_name(NULL, session_name);
+       status = lttng_action_stop_session_set_session_name(nullptr, session_name);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
@@ -319,7 +321,7 @@ static void test_action_stop_session(void)
 
        /* Validate the default policy for a stop_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status =
                        lttng_action_stop_session_get_rate_policy(stop_session_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -333,7 +335,7 @@ static void test_action_stop_session(void)
 
        /* Validate the custom policy for a stop_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status =
                        lttng_action_stop_session_get_rate_policy(stop_session_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -361,13 +363,13 @@ static void test_action_stop_session(void)
        lttng_payload_reset(&payload);
 }
 
-static void test_action_snapshot_session(void)
+static void test_action_snapshot_session()
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *snapshot_session_action = NULL,
-                           *snapshot_session_action_from_buffer = NULL;
-       struct lttng_rate_policy *policy = NULL, *default_policy;
+       struct lttng_action *snapshot_session_action = nullptr,
+                           *snapshot_session_action_from_buffer = nullptr;
+       struct lttng_rate_policy *policy = nullptr, *default_policy;
        struct lttng_payload payload;
        const char *session_name = "my_session_name";
        const char *get_session_name;
@@ -387,11 +389,11 @@ static void test_action_snapshot_session(void)
           "Action has type LTTNG_ACTION_TYPE_SNAPSHOT_SESSION");
 
        /* Session name setter. */
-       status = lttng_action_snapshot_session_set_session_name(NULL, NULL);
+       status = lttng_action_snapshot_session_set_session_name(nullptr, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_snapshot_session_set_session_name(snapshot_session_action, NULL);
+       status = lttng_action_snapshot_session_set_session_name(snapshot_session_action, nullptr);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
-       status = lttng_action_snapshot_session_set_session_name(NULL, session_name);
+       status = lttng_action_snapshot_session_set_session_name(nullptr, session_name);
        ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
@@ -408,7 +410,7 @@ static void test_action_snapshot_session(void)
 
        /* Validate the default policy for a snapshot_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_snapshot_session_get_rate_policy(snapshot_session_action,
                                                                       &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -422,7 +424,7 @@ static void test_action_snapshot_session(void)
 
        /* Validate the custom policy for a snapshot_session action. */
        {
-               const struct lttng_rate_policy *cur_policy = NULL;
+               const struct lttng_rate_policy *cur_policy = nullptr;
                status = lttng_action_snapshot_session_get_rate_policy(snapshot_session_action,
                                                                       &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
@@ -452,7 +454,7 @@ static void test_action_snapshot_session(void)
        lttng_payload_reset(&payload);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        test_action_notify();
index d62f15e4d5192e100852843019e8a0bd051db3fa..69812de43301952434d9ea8334a9cef0a0d05946 100644 (file)
@@ -16,7 +16,7 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
 int lttng_opt_mi;
 
-static void test_contains_string(void)
+static void test_contains_string()
 {
        const char buf[] = { 'A', 'l', 'l', 'o', '\0' };
        struct lttng_buffer_view view = lttng_buffer_view_init(buf, 0, 5);
@@ -30,7 +30,7 @@ static void test_contains_string(void)
        ok1(!lttng_buffer_view_contains_string(&view_minus_one, buf, 5));
 }
 
-int main(void)
+int main()
 {
        plan_tests(TEST_COUNT);
 
index ce54abc9a448b7caf1c06d4e84c928b48e68c8fc..45dbe2acbcbba37d4e1a7a94a76bee3a36a374b7 100644 (file)
@@ -33,19 +33,19 @@ int lttng_opt_mi;
 
 #define NUM_TESTS 13
 
-static void test_condition_event_rule(void)
+static void test_condition_event_rule()
 {
        int ret, i;
-       struct lttng_event_rule *tracepoint = NULL;
-       const struct lttng_event_rule *tracepoint_tmp = NULL;
+       struct lttng_event_rule *tracepoint = nullptr;
+       const struct lttng_event_rule *tracepoint_tmp = nullptr;
        enum lttng_event_rule_status status;
-       struct lttng_condition *condition = NULL;
-       struct lttng_condition *condition_from_buffer = NULL;
+       struct lttng_condition *condition = nullptr;
+       struct lttng_condition *condition_from_buffer = nullptr;
        enum lttng_condition_status condition_status;
        const char *pattern = "my_event_*";
        const char *filter = "msg_id == 23 && size >= 2048";
        const char *exclusions[] = { "my_event_test1", "my_event_test2", "my_event_test3" };
-       struct lttng_log_level_rule *log_level_rule_at_least_as_severe = NULL;
+       struct lttng_log_level_rule *log_level_rule_at_least_as_severe = nullptr;
        struct lttng_payload buffer;
 
        lttng_payload_init(&buffer);
@@ -104,7 +104,7 @@ static void test_condition_event_rule(void)
        lttng_log_level_rule_destroy(log_level_rule_at_least_as_severe);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        test_condition_event_rule();
index fb8c1555301c6052a0a744ca84fcdaee7eccab9a..05a276db0b1b10b79f7e24851affc04c7f21687f 100644 (file)
@@ -69,7 +69,7 @@ static int create_non_empty_hierarchy_with_root(struct lttng_directory_handle *t
        int ret;
        const int file_flags = O_WRONLY | O_CREAT | O_TRUNC;
        const mode_t file_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
-       char *branch_name = NULL;
+       char *branch_name = nullptr;
 
        ret = asprintf(&branch_name, "%s/%s", test_root_name, "a/b/c/d");
        if (ret < 0) {
@@ -122,7 +122,7 @@ static int remove_file_from_hierarchy(struct lttng_directory_handle *test_dir_ha
                                      const char *test_root_name)
 {
        int ret;
-       char *file_name = NULL;
+       char *file_name = nullptr;
 
        ret = asprintf(&file_name, "%s/%s", test_root_name, "a/b/e/file1");
        if (ret < 0) {
@@ -144,9 +144,9 @@ static int test_rmdir_fail_non_empty(const char *test_dir)
 {
        int ret, tests_ran = 0;
        struct lttng_directory_handle *test_dir_handle;
-       char *created_dir = NULL;
+       char *created_dir = nullptr;
        const char test_root_name[] = "fail_non_empty";
-       char *test_dir_path = NULL;
+       char *test_dir_path = nullptr;
 
        diag("rmdir (fail if non-empty)");
 
@@ -203,9 +203,9 @@ static int test_rmdir_skip_non_empty(const char *test_dir)
 {
        int ret, tests_ran = 0;
        struct lttng_directory_handle *test_dir_handle;
-       char *created_dir = NULL;
+       char *created_dir = nullptr;
        const char test_root_name[] = "skip_non_empty";
-       char *test_dir_path = NULL;
+       char *test_dir_path = nullptr;
 
        diag("rmdir (skip if non-empty)");
 
@@ -261,7 +261,7 @@ end:
        return ret == 0 ? tests_ran : ret;
 }
 
-int main(void)
+int main()
 {
        int ret;
        char test_dir[] = "/tmp/lttng-XXXXXX";
index 48f13e71ee0d9c189bad28aa3580ca10ef2978f3..a0d04357ddcf2db9d7019bdb3e26d906441f1e4f 100644 (file)
 
 #define NR_TESTS 4
 
-static void test_event_payload_field(void)
+static void test_event_payload_field()
 {
        struct lttng_event_expr *event_expr;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
        int ret;
 
        event_expr = lttng_event_expr_event_payload_field_create("tourlou");
@@ -29,10 +29,10 @@ static void test_event_payload_field(void)
        free(bytecode);
 }
 
-static void test_channel_context_field(void)
+static void test_channel_context_field()
 {
        struct lttng_event_expr *event_expr;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
        int ret;
 
        event_expr = lttng_event_expr_channel_context_field_create("tourlou");
@@ -44,10 +44,10 @@ static void test_channel_context_field(void)
        free(bytecode);
 }
 
-static void test_app_specific_context_field(void)
+static void test_app_specific_context_field()
 {
        struct lttng_event_expr *event_expr;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
        int ret;
 
        event_expr = lttng_event_expr_app_specific_context_field_create("Bob", "Leponge");
@@ -59,10 +59,10 @@ static void test_app_specific_context_field(void)
        free(bytecode);
 }
 
-static void test_array_field_element(void)
+static void test_array_field_element()
 {
        struct lttng_event_expr *event_expr;
-       struct lttng_bytecode *bytecode = NULL;
+       struct lttng_bytecode *bytecode = nullptr;
        int ret;
 
        event_expr = lttng_event_expr_event_payload_field_create("allo");
@@ -75,7 +75,7 @@ static void test_array_field_element(void)
        free(bytecode);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NR_TESTS);
 
index d56116aae86d5ccfbd0eb1bff74e09281f5b1094..654d4903e5e76bb393222c6f291bdcd75ed2eed7 100644 (file)
@@ -65,10 +65,10 @@ using event_rule_create = struct lttng_event_rule *(*) ();
 using event_rule_set_log_level = enum lttng_event_rule_status (*)(
        struct lttng_event_rule *, const struct lttng_log_level_rule *);
 
-static void test_event_rule_kernel_tracepoint(void)
+static void test_event_rule_kernel_tracepoint()
 {
-       struct lttng_event_rule *tracepoint = NULL;
-       struct lttng_event_rule *tracepoint_from_buffer = NULL;
+       struct lttng_event_rule *tracepoint = nullptr;
+       struct lttng_event_rule *tracepoint_from_buffer = nullptr;
        enum lttng_event_rule_status status;
        const char *pattern = "my_event_*";
        const char *filter = "msg_id == 23 && size >= 2048";
@@ -111,12 +111,12 @@ static void test_event_rule_kernel_tracepoint(void)
        lttng_event_rule_destroy(tracepoint_from_buffer);
 }
 
-static void test_event_rule_user_tracepoint(void)
+static void test_event_rule_user_tracepoint()
 {
        int i;
        unsigned int count;
-       struct lttng_event_rule *tracepoint = NULL;
-       struct lttng_event_rule *tracepoint_from_buffer = NULL;
+       struct lttng_event_rule *tracepoint = nullptr;
+       struct lttng_event_rule *tracepoint_from_buffer = nullptr;
        enum lttng_event_rule_status status;
        const char *pattern = "my_event_*";
        const char *filter = "msg_id == 23 && size >= 2048";
@@ -124,8 +124,8 @@ static void test_event_rule_user_tracepoint(void)
        const char *name_pattern_exclusions[] = { "my_event_test1",
                                                  "my_event_test2",
                                                  "my_event_test3" };
-       struct lttng_log_level_rule *log_level_rule = NULL;
-       const struct lttng_log_level_rule *log_level_rule_return = NULL;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
+       const struct lttng_log_level_rule *log_level_rule_return = nullptr;
        struct lttng_payload payload;
 
        diag("Testing lttng_event_rule_user_tracepoint.");
@@ -204,10 +204,10 @@ static void test_event_rule_user_tracepoint(void)
        lttng_log_level_rule_destroy(log_level_rule);
 }
 
-static void test_event_rule_syscall(void)
+static void test_event_rule_syscall()
 {
-       struct lttng_event_rule *syscall = NULL;
-       struct lttng_event_rule *syscall_from_buffer = NULL;
+       struct lttng_event_rule *syscall = nullptr;
+       struct lttng_event_rule *syscall_from_buffer = nullptr;
        enum lttng_event_rule_status status;
        const char *pattern = "my_event_*";
        const char *filter = "msg_id == 23 && size >= 2048";
@@ -251,16 +251,16 @@ static void test_event_rule_syscall(void)
        lttng_event_rule_destroy(syscall_from_buffer);
 }
 
-static void test_event_rule_jul_logging(void)
+static void test_event_rule_jul_logging()
 {
-       struct lttng_event_rule *jul_logging = NULL;
-       struct lttng_event_rule *jul_logging_from_buffer = NULL;
+       struct lttng_event_rule *jul_logging = nullptr;
+       struct lttng_event_rule *jul_logging_from_buffer = nullptr;
        enum lttng_event_rule_status status;
        const char *pattern = "my_event_*";
        const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
-       struct lttng_log_level_rule *log_level_rule = NULL;
-       const struct lttng_log_level_rule *log_level_rule_return = NULL;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
+       const struct lttng_log_level_rule *log_level_rule_return = nullptr;
        struct lttng_payload payload;
 
        diag("Testing lttng_event_rule_user_jul_logging.");
@@ -313,16 +313,16 @@ static void test_event_rule_jul_logging(void)
        lttng_log_level_rule_destroy(log_level_rule);
 }
 
-static void test_event_rule_log4j_logging(void)
+static void test_event_rule_log4j_logging()
 {
-       struct lttng_event_rule *log4j_logging = NULL;
-       struct lttng_event_rule *log4j_logging_from_buffer = NULL;
+       struct lttng_event_rule *log4j_logging = nullptr;
+       struct lttng_event_rule *log4j_logging_from_buffer = nullptr;
        enum lttng_event_rule_status status;
        const char *pattern = "my_event_*";
        const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
-       struct lttng_log_level_rule *log_level_rule = NULL;
-       const struct lttng_log_level_rule *log_level_rule_return = NULL;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
+       const struct lttng_log_level_rule *log_level_rule_return = nullptr;
        struct lttng_payload payload;
 
        diag("Testing lttng_event_rule_user_log4j_logging.");
@@ -375,16 +375,16 @@ static void test_event_rule_log4j_logging(void)
        lttng_log_level_rule_destroy(log_level_rule);
 }
 
-static void test_event_rule_python_logging(void)
+static void test_event_rule_python_logging()
 {
-       struct lttng_event_rule *python_logging = NULL;
-       struct lttng_event_rule *python_logging_from_buffer = NULL;
+       struct lttng_event_rule *python_logging = nullptr;
+       struct lttng_event_rule *python_logging_from_buffer = nullptr;
        enum lttng_event_rule_status status;
        const char *pattern = "my_event_*";
        const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
-       struct lttng_log_level_rule *log_level_rule = NULL;
-       const struct lttng_log_level_rule *log_level_rule_return = NULL;
+       struct lttng_log_level_rule *log_level_rule = nullptr;
+       const struct lttng_log_level_rule *log_level_rule_return = nullptr;
        struct lttng_payload payload;
 
        diag("Testing lttng_event_rule_user_python_logging.");
@@ -438,13 +438,13 @@ static void test_event_rule_python_logging(void)
 }
 
 #ifdef __linux__
-static void test_event_rule_userspace_probe(void)
+static void test_event_rule_userspace_probe()
 {
-       struct lttng_event_rule *uprobe = NULL;
-       struct lttng_event_rule *uprobe_from_buffer = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
-       struct lttng_userspace_probe_location *probe_location = NULL;
-       const struct lttng_userspace_probe_location *probe_location_tmp = NULL;
+       struct lttng_event_rule *uprobe = nullptr;
+       struct lttng_event_rule *uprobe_from_buffer = nullptr;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
+       struct lttng_userspace_probe_location *probe_location = nullptr;
+       const struct lttng_userspace_probe_location *probe_location_tmp = nullptr;
        enum lttng_event_rule_status status;
 
        const char *probe_name = "my_probe.";
@@ -470,7 +470,7 @@ static void test_event_rule_userspace_probe(void)
        }
 
        /* Ownership transferred to the probe location function object. */
-       lookup_method = NULL;
+       lookup_method = nullptr;
 
        lttng_payload_init(&payload);
 
@@ -516,8 +516,8 @@ static void test_event_rule_userspace_probe(void)
 static void
 test_event_rule_kernel_probe_by_location(const struct lttng_kernel_probe_location *location)
 {
-       struct lttng_event_rule *kprobe = NULL;
-       struct lttng_event_rule *kprobe_from_buffer = NULL;
+       struct lttng_event_rule *kprobe = nullptr;
+       struct lttng_event_rule *kprobe_from_buffer = nullptr;
        enum lttng_event_rule_status status;
        const struct lttng_kernel_probe_location *_location;
 
@@ -560,10 +560,10 @@ test_event_rule_kernel_probe_by_location(const struct lttng_kernel_probe_locatio
        lttng_event_rule_destroy(kprobe_from_buffer);
 }
 
-static void test_event_rule_kernel_probe(void)
+static void test_event_rule_kernel_probe()
 {
-       struct lttng_kernel_probe_location *address_location = NULL;
-       struct lttng_kernel_probe_location *symbol_location = NULL;
+       struct lttng_kernel_probe_location *address_location = nullptr;
+       struct lttng_kernel_probe_location *symbol_location = nullptr;
 
        address_location = lttng_kernel_probe_location_address_create(50);
        symbol_location = lttng_kernel_probe_location_symbol_create("une_bonne", 50);
@@ -676,7 +676,7 @@ static void test_event_rule_log_level_generic(enum lttng_event_rule_type event_r
        lttng_event_rule_destroy(rule);
 }
 
-static void test_event_rule_log_level_ust(void)
+static void test_event_rule_log_level_ust()
 {
        const int tagged_log_level_values[] = {
                LTTNG_LOGLEVEL_EMERG,          LTTNG_LOGLEVEL_ALERT,
@@ -701,13 +701,13 @@ static void test_event_rule_log_level_ust(void)
                                          lttng_event_rule_user_tracepoint_set_log_level_rule,
                                          tagged_log_level_values,
                                          ARRAY_SIZE(tagged_log_level_values),
-                                         NULL,
+                                         nullptr,
                                          0,
                                          invalid_log_level_values,
                                          ARRAY_SIZE(invalid_log_level_values));
 }
 
-static void test_event_rule_log_level_jul(void)
+static void test_event_rule_log_level_jul()
 {
        const int tagged_log_level_values[] = {
                LTTNG_LOGLEVEL_JUL_OFF,   LTTNG_LOGLEVEL_JUL_SEVERE, LTTNG_LOGLEVEL_JUL_WARNING,
@@ -724,11 +724,11 @@ static void test_event_rule_log_level_jul(void)
                                          ARRAY_SIZE(tagged_log_level_values),
                                          valid_log_level_values,
                                          ARRAY_SIZE(valid_log_level_values),
-                                         NULL,
+                                         nullptr,
                                          0);
 }
 
-static void test_event_rule_log_level_log4j(void)
+static void test_event_rule_log_level_log4j()
 {
        const int tagged_log_level_values[] = {
                LTTNG_LOGLEVEL_LOG4J_OFF,   LTTNG_LOGLEVEL_LOG4J_FATAL, LTTNG_LOGLEVEL_LOG4J_ERROR,
@@ -745,11 +745,11 @@ static void test_event_rule_log_level_log4j(void)
                                          ARRAY_SIZE(tagged_log_level_values),
                                          valid_log_level_values,
                                          ARRAY_SIZE(valid_log_level_values),
-                                         NULL,
+                                         nullptr,
                                          0);
 }
 
-static void test_event_rule_log_level_python(void)
+static void test_event_rule_log_level_python()
 {
        const int tagged_log_level_values[] = {
                LTTNG_LOGLEVEL_PYTHON_CRITICAL, LTTNG_LOGLEVEL_PYTHON_ERROR,
@@ -771,11 +771,11 @@ static void test_event_rule_log_level_python(void)
                                          ARRAY_SIZE(tagged_log_level_values),
                                          valid_log_level_values,
                                          ARRAY_SIZE(valid_log_level_values),
-                                         NULL,
+                                         nullptr,
                                          0);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        test_event_rule_kernel_tracepoint();
index d86cb4126b0584c53f0a2a41d002a391521a0905..9e40c83c2ab5499893a8139f74468b4b014d4730 100644 (file)
@@ -79,7 +79,7 @@ static void get_temporary_directories(char **_test_directory, char **_unlink_dir
        }
 }
 
-static int fd_count(void)
+static int fd_count()
 {
        DIR *dir;
        struct dirent *entry;
@@ -93,7 +93,7 @@ static int fd_count(void)
                goto end;
        }
 
-       while ((entry = readdir(dir)) != NULL) {
+       while ((entry = readdir(dir)) != nullptr) {
                if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) {
                        continue;
                }
@@ -169,7 +169,7 @@ static void untrack_std_fds(struct fd_tracker *tracker)
        for (i = 0; i < sizeof(files) / sizeof(*files); i++) {
                int fd = files[i].fd;
                int ret = fd_tracker_close_unsuspendable_fd(
-                       tracker, &files[i].fd, 1, noop_close, NULL);
+                       tracker, &files[i].fd, 1, noop_close, nullptr);
 
                ok(ret == 0, "Untrack unsuspendable fd %d (%s)", fd, files[i].name);
        }
@@ -178,11 +178,11 @@ static void untrack_std_fds(struct fd_tracker *tracker)
 /*
  * Basic test opening and closing three unsuspendable fds.
  */
-static void test_unsuspendable_basic(void)
+static void test_unsuspendable_basic()
 {
        int ret;
        struct fd_tracker *tracker;
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
@@ -219,12 +219,12 @@ static int error_close(void *data, int *fds __attribute__((unused)))
  * Validate that user callback return values are returned to the
  * caller of the fd tracker.
  */
-static void test_unsuspendable_cb_return(void)
+static void test_unsuspendable_cb_return()
 {
        int ret, stdout_fd = fileno(stdout), out_fd = 42;
        struct fd_tracker *tracker;
        int expected_error = -ENETDOWN;
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
@@ -233,7 +233,7 @@ static void test_unsuspendable_cb_return(void)
 
        /* The error_open callback should fail and return 'expected_error'. */
        ret = fd_tracker_open_unsuspendable_fd(
-               tracker, &out_fd, NULL, 1, error_open, &expected_error);
+               tracker, &out_fd, nullptr, 1, error_open, &expected_error);
        ok(ret == expected_error,
           "fd_tracker_open_unsuspendable_fd() forwards the user callback's error code");
        ok(out_fd == 42,
@@ -243,7 +243,7 @@ static void test_unsuspendable_cb_return(void)
         * Track a valid fd since we don't want the tracker to fail with an
         * invalid fd error for this test.
         */
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, nullptr, 1, noop_open, &stdout_fd);
        ok(out_fd == stdout_fd,
           "fd_tracker_open_unsuspendable_fd() sets the output fd parameter to the newly-tracked fd's value");
        LTTNG_ASSERT(!ret);
@@ -267,23 +267,23 @@ static void test_unsuspendable_cb_return(void)
  * Validate that the tracker refuses to track two identical unsuspendable
  * file descriptors.
  */
-static void test_unsuspendable_duplicate(void)
+static void test_unsuspendable_duplicate()
 {
        int ret, stdout_fd = fileno(stdout), out_fd;
        struct fd_tracker *tracker;
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        LTTNG_ASSERT(tracker);
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, nullptr, 1, noop_open, &stdout_fd);
        LTTNG_ASSERT(!ret);
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, nullptr, 1, noop_open, &stdout_fd);
        ok(ret == -EEXIST, "EEXIST reported on open of an already tracked file descriptor");
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker, &stdout_fd, 1, noop_close, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(tracker, &stdout_fd, 1, noop_close, nullptr);
        LTTNG_ASSERT(!ret);
 
        fd_tracker_destroy(tracker);
@@ -327,12 +327,12 @@ static int close_pipes(void *data __attribute__((unused)), int *fds)
  * Validate that the tracker enforces the open file descriptor limit
  * when unsuspendable file descriptors are being opened.
  */
-static void test_unsuspendable_limit(void)
+static void test_unsuspendable_limit()
 {
        struct fd_tracker *tracker;
        int ret, stdout_fd = fileno(stdout), out_fd;
        int fds[TRACKER_FD_LIMIT];
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
@@ -343,16 +343,17 @@ static void test_unsuspendable_limit(void)
        LTTNG_ASSERT(tracker);
 
        ret = fd_tracker_open_unsuspendable_fd(
-               tracker, fds, NULL, TRACKER_FD_LIMIT, open_pipes, NULL);
+               tracker, fds, nullptr, TRACKER_FD_LIMIT, open_pipes, nullptr);
        ok(ret == 0,
           "File descriptor tracker allowed the user to meet its limit with unsuspendable file descriptors (%d)",
           TRACKER_FD_LIMIT);
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, nullptr, 1, noop_open, &stdout_fd);
        ok(ret == -EMFILE,
           "EMFILE reported when exceeding the file descriptor limit while opening an unsuspendable fd");
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker, fds, TRACKER_FD_LIMIT, close_pipes, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(
+               tracker, fds, TRACKER_FD_LIMIT, close_pipes, nullptr);
        LTTNG_ASSERT(!ret);
 
        fd_tracker_destroy(tracker);
@@ -366,11 +367,11 @@ static void test_unsuspendable_limit(void)
  * Validate that the tracker refuses to track two identical unsuspendable
  * file descriptors.
  */
-static void test_unsuspendable_close_untracked(void)
+static void test_unsuspendable_close_untracked()
 {
        int ret, stdout_fd = fileno(stdout), unknown_fds[2], out_fd;
        struct fd_tracker *tracker;
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
@@ -387,13 +388,13 @@ static void test_unsuspendable_close_untracked(void)
        ret = close(unknown_fds[1]);
        LTTNG_ASSERT(ret == 0);
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, nullptr, 1, noop_open, &stdout_fd);
        LTTNG_ASSERT(!ret);
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker, unknown_fds, 1, noop_close, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(tracker, unknown_fds, 1, noop_close, nullptr);
        ok(ret == -EINVAL, "EINVAL reported on close of an untracked file descriptor");
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker, &stdout_fd, 1, noop_close, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(tracker, &stdout_fd, 1, noop_close, nullptr);
        LTTNG_ASSERT(!ret);
 
        fd_tracker_destroy(tracker);
@@ -486,15 +487,15 @@ static int cleanup_files(struct fd_tracker *tracker __attribute__((unused)),
        return ret;
 }
 
-static void test_suspendable_limit(void)
+static void test_suspendable_limit()
 {
        int ret;
        const int files_to_create = TRACKER_FD_LIMIT * 10;
        struct fd_tracker *tracker;
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
        char *output_files[files_to_create];
        struct fs_handle *handles[files_to_create];
-       struct lttng_directory_handle *dir_handle = NULL;
+       struct lttng_directory_handle *dir_handle = nullptr;
        int dir_handle_fd_count;
 
        memset(output_files, 0, sizeof(output_files));
@@ -529,15 +530,15 @@ end:
        free(unlinked_files_directory);
 }
 
-static void test_mixed_limit(void)
+static void test_mixed_limit()
 {
        int ret;
        const int files_to_create = TRACKER_FD_LIMIT;
        struct fd_tracker *tracker;
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
        char *output_files[files_to_create];
        struct fs_handle *handles[files_to_create];
-       struct lttng_directory_handle *dir_handle = NULL;
+       struct lttng_directory_handle *dir_handle = nullptr;
        int dir_handle_fd_count;
 
        memset(output_files, 0, sizeof(output_files));
@@ -592,7 +593,7 @@ end:
  *
  * The content of the files is also verified at the end.
  */
-static void test_suspendable_restore(void)
+static void test_suspendable_restore()
 {
        int ret;
        const int files_to_create = TRACKER_FD_LIMIT * 10;
@@ -604,9 +605,9 @@ static void test_suspendable_restore(void)
        bool write_success = true;
        bool fd_cap_respected = true;
        bool content_ok = true;
-       struct lttng_directory_handle *dir_handle = NULL;
+       struct lttng_directory_handle *dir_handle = nullptr;
        int dir_handle_fd_count;
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
 
        memset(output_files, 0, sizeof(output_files));
        memset(handles, 0, sizeof(handles));
@@ -723,18 +724,18 @@ end:
        free(unlinked_files_directory);
 }
 
-static void test_unlink(void)
+static void test_unlink()
 {
        int ret;
        struct fd_tracker *tracker;
        const int handles_to_open = 2;
        struct fs_handle *handles[handles_to_open];
-       struct fs_handle *new_handle = NULL;
+       struct fs_handle *new_handle = nullptr;
        struct stat statbuf;
-       struct lttng_directory_handle *dir_handle = NULL;
+       struct lttng_directory_handle *dir_handle = nullptr;
        const char file_name[] = "my_file";
-       char *test_directory = NULL, *unlinked_files_directory = NULL;
-       char *unlinked_file_zero = NULL, *unlinked_file_one = NULL;
+       char *test_directory = nullptr, *unlinked_files_directory = nullptr;
+       char *unlinked_file_zero = nullptr, *unlinked_file_one = nullptr;
        int fd;
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
@@ -853,7 +854,7 @@ end:
        lttng_directory_handle_put(dir_handle);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        diag("File descriptor tracker unit tests");
index b7a882cfcacb5602c59102d94b5dfad62374357e..3814daa6fae490aa34d4a86bd78196359c5ddbd7 100644 (file)
@@ -38,7 +38,7 @@ static char random_string[RANDOM_STRING_LEN];
  * Return random string of 10 characters.
  * Not thread-safe.
  */
-static char *get_random_string(void)
+static char *get_random_string()
 {
        int i;
 
@@ -51,10 +51,10 @@ static char *get_random_string(void)
        return random_string;
 }
 
-static void test_create_one_kernel_session(void)
+static void test_create_one_kernel_session()
 {
        kern = trace_kernel_create_session();
-       ok(kern != NULL, "Create kernel session");
+       ok(kern != nullptr, "Create kernel session");
 
        if (!kern) {
                skip(1, "Kernel session is null");
@@ -62,18 +62,18 @@ static void test_create_one_kernel_session(void)
        }
        ok(kern->fd == -1 && kern->metadata_stream_fd == -1 && kern->consumer_fds_sent == 0 &&
                   kern->channel_count == 0 && kern->stream_count_global == 0 &&
-                  kern->metadata == NULL,
+                  kern->metadata == nullptr,
           "Validate kernel session");
 }
 
-static void test_create_kernel_metadata(void)
+static void test_create_kernel_metadata()
 {
-       LTTNG_ASSERT(kern != NULL);
+       LTTNG_ASSERT(kern != nullptr);
 
        kern->metadata = trace_kernel_create_metadata();
-       ok(kern->metadata != NULL, "Create kernel metadata");
+       ok(kern->metadata != nullptr, "Create kernel metadata");
 
-       ok(kern->metadata->fd == -1 && kern->metadata->conf != NULL &&
+       ok(kern->metadata->fd == -1 && kern->metadata->conf != nullptr &&
                   kern->metadata->conf->attr.overwrite == DEFAULT_METADATA_OVERWRITE &&
                   kern->metadata->conf->attr.subbuf_size == default_get_metadata_subbuf_size() &&
                   kern->metadata->conf->attr.num_subbuf == DEFAULT_METADATA_SUBBUF_NUM &&
@@ -86,7 +86,7 @@ static void test_create_kernel_metadata(void)
        trace_kernel_destroy_metadata(kern->metadata);
 }
 
-static void test_create_kernel_channel(void)
+static void test_create_kernel_channel()
 {
        struct ltt_kernel_channel *chan;
        struct lttng_channel attr;
@@ -97,7 +97,7 @@ static void test_create_kernel_channel(void)
        attr.attr.extended.ptr = &extended;
 
        chan = trace_kernel_create_channel(&attr);
-       ok(chan != NULL, "Create kernel channel");
+       ok(chan != nullptr, "Create kernel channel");
 
        if (!chan) {
                skip(1, "Channel is null");
@@ -113,7 +113,7 @@ static void test_create_kernel_channel(void)
        trace_kernel_destroy_channel(chan);
 }
 
-static void test_create_kernel_event(void)
+static void test_create_kernel_event()
 {
        enum lttng_error_code ret;
        struct ltt_kernel_event *event;
@@ -125,7 +125,7 @@ static void test_create_kernel_event(void)
        ev.type = LTTNG_EVENT_TRACEPOINT;
        ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
 
-       ret = trace_kernel_create_event(&ev, NULL, NULL, &event);
+       ret = trace_kernel_create_event(&ev, nullptr, nullptr, &event);
        ok(ret == LTTNG_OK, "Create kernel event");
 
        if (!event) {
@@ -143,12 +143,12 @@ static void test_create_kernel_event(void)
        trace_kernel_destroy_event(event);
 }
 
-static void test_create_kernel_stream(void)
+static void test_create_kernel_stream()
 {
        struct ltt_kernel_stream *stream;
 
        stream = trace_kernel_create_stream("stream1", 0);
-       ok(stream != NULL, "Create kernel stream");
+       ok(stream != nullptr, "Create kernel stream");
 
        if (!stream) {
                skip(1, "Stream is null");
@@ -162,7 +162,7 @@ static void test_create_kernel_stream(void)
        trace_kernel_destroy_stream(stream);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
 
index 12e6e3555f0a47181fd2a4bb30977c4362fbe3d9..bec28825b2c5b3c700c3f7fc68d54ffbbd90a78e 100644 (file)
@@ -26,10 +26,10 @@ int lttng_opt_mi;
 
 #define NUM_TESTS 24
 
-static void test_kernel_probe_location_address(void)
+static void test_kernel_probe_location_address()
 {
-       struct lttng_kernel_probe_location *location = NULL;
-       struct lttng_kernel_probe_location *location_from_buffer = NULL;
+       struct lttng_kernel_probe_location *location = nullptr;
+       struct lttng_kernel_probe_location *location_from_buffer = nullptr;
        enum lttng_kernel_probe_location_status status;
        enum lttng_kernel_probe_location_type type;
        uint64_t address = 50, _address;
@@ -84,10 +84,10 @@ static void test_kernel_probe_location_address(void)
        lttng_kernel_probe_location_destroy(location_from_buffer);
 }
 
-static void test_kernel_probe_location_symbol(void)
+static void test_kernel_probe_location_symbol()
 {
-       struct lttng_kernel_probe_location *location = NULL;
-       struct lttng_kernel_probe_location *location_from_buffer = NULL;
+       struct lttng_kernel_probe_location *location = nullptr;
+       struct lttng_kernel_probe_location *location_from_buffer = nullptr;
        enum lttng_kernel_probe_location_status status;
        enum lttng_kernel_probe_location_type type;
        uint64_t offset = 50, _offset;
@@ -151,7 +151,7 @@ static void test_kernel_probe_location_symbol(void)
        lttng_kernel_probe_location_destroy(location_from_buffer);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        test_kernel_probe_location_address();
index 1d5114b756ac92609b9b02b814653e410cbe9c9c..209253267b176dadb29d1de1eac78485bdb7912a 100644 (file)
@@ -26,33 +26,33 @@ int lttng_opt_mi;
 
 #define NUM_TESTS 29
 
-static void test_log_level_rule_error(void)
+static void test_log_level_rule_error()
 {
        int level = 9000;
        struct lttng_log_level_rule *exactly = lttng_log_level_rule_exactly_create(level);
        struct lttng_log_level_rule *at_least_as_severe =
                lttng_log_level_rule_at_least_as_severe_as_create(level);
 
-       ok(lttng_log_level_rule_get_type(NULL) == LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN,
+       ok(lttng_log_level_rule_get_type(nullptr) == LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN,
           "Get type on invalid pointer");
 
-       ok(lttng_log_level_rule_exactly_get_level(NULL, NULL) ==
+       ok(lttng_log_level_rule_exactly_get_level(nullptr, nullptr) ==
                   LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
           "lttng_log_level_rule_exactly_get_level (NULL, NULL) returns invalid");
-       ok(lttng_log_level_rule_exactly_get_level(exactly, NULL) ==
+       ok(lttng_log_level_rule_exactly_get_level(exactly, nullptr) ==
                   LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
           "lttng_log_level_rule_exactly_get_level (valid, NULL) returns invalid");
-       ok(lttng_log_level_rule_exactly_get_level(NULL, &level) ==
+       ok(lttng_log_level_rule_exactly_get_level(nullptr, &level) ==
                   LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
           "lttng_log_level_rule_exactly_get_level (NULL, valid) returns invalid");
 
-       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(NULL, NULL) ==
+       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(nullptr, nullptr) ==
                   LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
           "lttng_log_level_rule_at_least_as_severe_as_get_level (NULL, NULL) returns invalid");
-       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(exactly, NULL) ==
+       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(exactly, nullptr) ==
                   LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
           "lttng_log_level_rule_at_least_as_severe_as_get_level (valid, NULL) returns invalid");
-       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(NULL, &level) ==
+       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(nullptr, &level) ==
                   LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
           "lttng_log_level_rule_at_least_as_severe_as_get_level (NULL, valid) returns invalid");
 
@@ -62,7 +62,7 @@ static void test_log_level_rule_error(void)
 
 static void test_log_level_rule_serialize_deserialize(const struct lttng_log_level_rule *rule)
 {
-       struct lttng_log_level_rule *log_level_rule_from_buffer = NULL;
+       struct lttng_log_level_rule *log_level_rule_from_buffer = nullptr;
        struct lttng_payload payload;
 
        lttng_payload_init(&payload);
@@ -83,7 +83,7 @@ static void test_log_level_rule_serialize_deserialize(const struct lttng_log_lev
        lttng_payload_reset(&payload);
 }
 
-static void test_log_level_rule_is_equal_exactly(void)
+static void test_log_level_rule_is_equal_exactly()
 {
        int level = 9000, no_eq_level = 420;
        struct lttng_log_level_rule *a, *b, *different_level, *different_type;
@@ -113,7 +113,7 @@ static void test_log_level_rule_is_equal_exactly(void)
        lttng_log_level_rule_destroy(different_type);
 }
 
-static void test_log_level_rule_is_equal_at_least_as_severe_as(void)
+static void test_log_level_rule_is_equal_at_least_as_severe_as()
 {
        int level = 9000, no_eq_level = 420;
        struct lttng_log_level_rule *a, *b, *different_level, *different_type;
@@ -143,11 +143,11 @@ static void test_log_level_rule_is_equal_at_least_as_severe_as(void)
        lttng_log_level_rule_destroy(different_type);
 }
 
-static void test_log_level_rule_exactly(void)
+static void test_log_level_rule_exactly()
 {
        int level = 9000;
        int _level;
-       struct lttng_log_level_rule *exactly = NULL;
+       struct lttng_log_level_rule *exactly = nullptr;
        enum lttng_log_level_rule_status status;
 
        exactly = lttng_log_level_rule_exactly_create(level);
@@ -165,11 +165,11 @@ static void test_log_level_rule_exactly(void)
        lttng_log_level_rule_destroy(exactly);
 }
 
-static void test_log_level_rule_at_least_as_severe_as(void)
+static void test_log_level_rule_at_least_as_severe_as()
 {
        int level = 9000;
        int _level;
-       struct lttng_log_level_rule *at_least_as_severe_as = NULL;
+       struct lttng_log_level_rule *at_least_as_severe_as = nullptr;
        enum lttng_log_level_rule_status status;
 
        at_least_as_severe_as = lttng_log_level_rule_at_least_as_severe_as_create(level);
@@ -189,7 +189,7 @@ static void test_log_level_rule_at_least_as_severe_as(void)
        lttng_log_level_rule_destroy(at_least_as_severe_as);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        test_log_level_rule_exactly();
index e2e885e6e192affa63725327c72514d3562028d5..5dfc83c1a58fa33f7de1b1d7a14e96252f2260b4 100644 (file)
@@ -35,8 +35,8 @@ int lttng_opt_mi;
 static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_condition)
 {
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
-       const char *session_name = NULL;
-       const char *channel_name = NULL;
+       const char *session_name = nullptr;
+       const char *channel_name = nullptr;
        enum lttng_domain_type domain_type;
        /* Start at a non zero value to validate initialization */
        double threshold_ratio;
@@ -67,9 +67,9 @@ static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_con
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Domain name is unset");
 
        diag("Testing session name set/get");
-       status = lttng_condition_buffer_usage_set_session_name(NULL, "Test");
+       status = lttng_condition_buffer_usage_set_session_name(nullptr, "Test");
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null condition on set session name");
-       status = lttng_condition_buffer_usage_get_session_name(NULL, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(nullptr, &session_name);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get session name with null condition");
        ok(!session_name, "Session name is null");
        status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
@@ -77,7 +77,7 @@ static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_con
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Session name is unset");
        ok(!session_name, "Session name is null");
 
-       status = lttng_condition_buffer_usage_set_session_name(buffer_usage_condition, NULL);
+       status = lttng_condition_buffer_usage_set_session_name(buffer_usage_condition, nullptr);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null session name");
        status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
                                                               &session_name);
@@ -114,16 +114,16 @@ static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_con
        ok(strcmp("session420", session_name) == 0, "Session is still name is %s", "session420");
 
        diag("Testing channel name set/get");
-       status = lttng_condition_buffer_usage_set_channel_name(NULL, "Test");
+       status = lttng_condition_buffer_usage_set_channel_name(nullptr, "Test");
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null condition on set channel name");
-       status = lttng_condition_buffer_usage_get_channel_name(NULL, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(nullptr, &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get channel name with null condition");
        status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
                                                               &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Channel name is unset");
        ok(!channel_name, "Channel name is null");
 
-       status = lttng_condition_buffer_usage_set_channel_name(buffer_usage_condition, NULL);
+       status = lttng_condition_buffer_usage_set_channel_name(buffer_usage_condition, nullptr);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null channel name");
        status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
                                                               &channel_name);
@@ -160,9 +160,9 @@ static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_con
        ok(strcmp("channel420", channel_name) == 0, "Channel is still name is %s", "channel420");
 
        diag("Testing threshold ratio set/get");
-       status = lttng_condition_buffer_usage_set_threshold_ratio(NULL, 0.420);
+       status = lttng_condition_buffer_usage_set_threshold_ratio(nullptr, 0.420);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set threshold ratio with null condition");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(NULL, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(nullptr, &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold ratio with null condition");
        status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
                                                                  &threshold_ratio);
@@ -202,9 +202,9 @@ static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_con
        ok(threshold_ratio == 0.420, "Threshold ratio is 0.420");
 
        diag("Testing threshold bytes set/get");
-       status = lttng_condition_buffer_usage_set_threshold(NULL, 100000);
+       status = lttng_condition_buffer_usage_set_threshold(nullptr, 100000);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set threshold with null condition");
-       status = lttng_condition_buffer_usage_get_threshold(NULL, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(nullptr, &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold value with null condition ");
        status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
                                                            &threshold_bytes);
@@ -258,9 +258,9 @@ static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_con
        ok(threshold_bytes == 420, "Threshold is untouched");
 
        diag("Testing domain type set/get");
-       status = lttng_condition_buffer_usage_set_domain_type(NULL, LTTNG_DOMAIN_UST);
+       status = lttng_condition_buffer_usage_set_domain_type(nullptr, LTTNG_DOMAIN_UST);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set domain type with null condition");
-       status = lttng_condition_buffer_usage_get_domain_type(NULL, &domain_type);
+       status = lttng_condition_buffer_usage_get_domain_type(nullptr, &domain_type);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get domain type with null condition");
 
        status = lttng_condition_buffer_usage_set_domain_type(buffer_usage_condition,
@@ -277,9 +277,9 @@ static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_con
        ok(domain_type == LTTNG_DOMAIN_UST, "Domain type is LTTNG_DOMAIN_UST");
 }
 
-static void test_condition_buffer_usage_low(void)
+static void test_condition_buffer_usage_low()
 {
-       struct lttng_condition *buffer_usage_low = NULL;
+       struct lttng_condition *buffer_usage_low = nullptr;
 
        diag("Testing lttng_condition_buffer_usage_low_create");
        buffer_usage_low = lttng_condition_buffer_usage_low_create();
@@ -293,9 +293,9 @@ static void test_condition_buffer_usage_low(void)
        lttng_condition_destroy(buffer_usage_low);
 }
 
-static void test_condition_buffer_usage_high(void)
+static void test_condition_buffer_usage_high()
 {
-       struct lttng_condition *buffer_usage_high = NULL;
+       struct lttng_condition *buffer_usage_high = nullptr;
 
        diag("Testing lttng_condition_buffer_usage_high_create");
        buffer_usage_high = lttng_condition_buffer_usage_high_create();
@@ -309,20 +309,20 @@ static void test_condition_buffer_usage_high(void)
        lttng_condition_destroy(buffer_usage_high);
 }
 
-static void test_trigger(void)
+static void test_trigger()
 {
-       struct lttng_action *notify_action = NULL;
-       struct lttng_condition *buffer_usage_high = NULL;
-       struct lttng_trigger *trigger = NULL;
+       struct lttng_action *notify_action = nullptr;
+       struct lttng_condition *buffer_usage_high = nullptr;
+       struct lttng_trigger *trigger = nullptr;
 
        notify_action = lttng_action_notify_create();
        buffer_usage_high = lttng_condition_buffer_usage_high_create();
 
-       trigger = lttng_trigger_create(NULL, NULL);
+       trigger = lttng_trigger_create(nullptr, nullptr);
        ok(!trigger, "lttng_trigger_create(NULL, NULL) returns null");
-       trigger = lttng_trigger_create(buffer_usage_high, NULL);
+       trigger = lttng_trigger_create(buffer_usage_high, nullptr);
        ok(!trigger, "lttng_trigger_create(NON-NULL, NULL) returns null");
-       trigger = lttng_trigger_create(NULL, notify_action);
+       trigger = lttng_trigger_create(nullptr, notify_action);
        ok(!trigger, "lttng_trigger_create(NULL, NON-NULL) returns null");
 
        trigger = lttng_trigger_create(buffer_usage_high, notify_action);
@@ -333,7 +333,7 @@ static void test_trigger(void)
        lttng_trigger_destroy(trigger);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        test_condition_buffer_usage_low();
index a719770aa9958779eeca0659c024e9084cbcd38f..2d1e016964461f9c800c574c697ca83e90c6e9c3 100644 (file)
@@ -19,7 +19,7 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
 int lttng_opt_mi;
 
-static void test_fd_push_pop_order(void)
+static void test_fd_push_pop_order()
 {
        int ret, i;
        struct lttng_payload payload;
@@ -65,7 +65,7 @@ static void test_fd_push_pop_order(void)
        lttng_payload_reset(&payload);
 }
 
-static void test_fd_push_pop_imbalance(void)
+static void test_fd_push_pop_imbalance()
 {
        int ret, i;
        struct lttng_payload payload;
@@ -115,7 +115,7 @@ fail:
        lttng_payload_reset(&payload);
 }
 
-static void test_fd_pop_fd_root_views(void)
+static void test_fd_pop_fd_root_views()
 {
        int ret, i;
        int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
@@ -163,13 +163,13 @@ fail:
        fd_handle_put(handle);
 }
 
-static void test_fd_pop_fd_descendant_views(void)
+static void test_fd_pop_fd_descendant_views()
 {
        int ret;
        const int fd1 = 42, fd2 = 1837;
        struct fd_handle *handle1 = fd_handle_create(fd1);
        struct fd_handle *handle2 = fd_handle_create(fd2);
-       struct fd_handle *view_handle1 = NULL, *view_handle2 = NULL;
+       struct fd_handle *view_handle1 = nullptr, *view_handle2 = nullptr;
        struct lttng_payload payload;
        const char *const test_description =
                "Different file descriptors returned when popping from descendant views";
@@ -220,7 +220,7 @@ fail:
        fd_handle_put(view_handle2);
 }
 
-int main(void)
+int main()
 {
        plan_tests(TEST_COUNT);
 
index 1c2c46961d5fe595d5552a8470f9c5fd87525a02..40ac0b4d6a118f1faa17d8e59b4a1dd9513dfc13 100644 (file)
@@ -26,13 +26,13 @@ int lttng_opt_mi;
 
 #define NUM_TESTS 42
 
-static void test_rate_policy_every_n(void)
+static void test_rate_policy_every_n()
 {
        enum lttng_rate_policy_status status;
-       struct lttng_rate_policy *policy_a = NULL; /* Interval of 100. */
-       struct lttng_rate_policy *policy_b = NULL; /* Interval of 100 */
-       struct lttng_rate_policy *policy_c = NULL; /* Interval of 1 */
-       struct lttng_rate_policy *policy_from_buffer = NULL;
+       struct lttng_rate_policy *policy_a = nullptr; /* Interval of 100. */
+       struct lttng_rate_policy *policy_b = nullptr; /* Interval of 100 */
+       struct lttng_rate_policy *policy_c = nullptr; /* Interval of 1 */
+       struct lttng_rate_policy *policy_from_buffer = nullptr;
        uint64_t interval_a_b = 100;
        uint64_t interval_c = 1;
        uint64_t interval_query = 0;
@@ -43,21 +43,21 @@ static void test_rate_policy_every_n(void)
        policy_a = lttng_rate_policy_every_n_create(interval_a_b);
        policy_b = lttng_rate_policy_every_n_create(interval_a_b);
        policy_c = lttng_rate_policy_every_n_create(interval_c);
-       ok(policy_a != NULL, "Rate policy every n A created: interval: %" PRIu64, interval_a_b);
-       ok(policy_b != NULL, "Rate policy every n B created: interval: %" PRIu64, interval_a_b);
-       ok(policy_c != NULL, "Rate policy every n C created: interval: %" PRIu64, interval_c);
+       ok(policy_a != nullptr, "Rate policy every n A created: interval: %" PRIu64, interval_a_b);
+       ok(policy_b != nullptr, "Rate policy every n B created: interval: %" PRIu64, interval_a_b);
+       ok(policy_c != nullptr, "Rate policy every n C created: interval: %" PRIu64, interval_c);
 
        ok(LTTNG_RATE_POLICY_TYPE_EVERY_N == lttng_rate_policy_get_type(policy_a),
           "Type is LTTNG_RATE_POLICY_TYPE_EVERY_N");
 
        /* Getter tests */
-       status = lttng_rate_policy_every_n_get_interval(NULL, NULL);
+       status = lttng_rate_policy_every_n_get_interval(nullptr, nullptr);
        ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get interval returns INVALID");
 
-       status = lttng_rate_policy_every_n_get_interval(NULL, &interval_query);
+       status = lttng_rate_policy_every_n_get_interval(nullptr, &interval_query);
        ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get interval returns INVALID");
 
-       status = lttng_rate_policy_every_n_get_interval(policy_a, NULL);
+       status = lttng_rate_policy_every_n_get_interval(policy_a, nullptr);
        ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get interval returns INVALID");
 
        status = lttng_rate_policy_every_n_get_interval(policy_a, &interval_query);
@@ -77,9 +77,9 @@ static void test_rate_policy_every_n(void)
         * lttng_condition_is_equal back in 2017 do we want to fix this and
         * return true if both are NULL?
         */
-       ok(false == lttng_rate_policy_is_equal(NULL, NULL), "is equal (NULL,NULL)");
-       ok(false == lttng_rate_policy_is_equal(policy_a, NULL), "is equal (object, NULL)");
-       ok(false == lttng_rate_policy_is_equal(NULL, policy_a), " is equal (NULL, object)");
+       ok(false == lttng_rate_policy_is_equal(nullptr, nullptr), "is equal (NULL,NULL)");
+       ok(false == lttng_rate_policy_is_equal(policy_a, nullptr), "is equal (object, NULL)");
+       ok(false == lttng_rate_policy_is_equal(nullptr, policy_a), " is equal (NULL, object)");
        ok(true == lttng_rate_policy_is_equal(policy_a, policy_a), "is equal (object A, object A)");
 
        ok(true == lttng_rate_policy_is_equal(policy_a, policy_b), "is equal (object A, object B");
@@ -96,7 +96,7 @@ static void test_rate_policy_every_n(void)
                struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
                ok(lttng_rate_policy_create_from_payload(&view, &policy_from_buffer) > 0 &&
-                          policy_from_buffer != NULL,
+                          policy_from_buffer != nullptr,
                   "Deserializing");
        }
 
@@ -110,13 +110,13 @@ static void test_rate_policy_every_n(void)
        lttng_payload_reset(&payload);
 }
 
-static void test_rate_policy_once_after_n(void)
+static void test_rate_policy_once_after_n()
 {
        enum lttng_rate_policy_status status;
-       struct lttng_rate_policy *policy_a = NULL; /* Threshold of 100. */
-       struct lttng_rate_policy *policy_b = NULL; /* threshold of 100 */
-       struct lttng_rate_policy *policy_c = NULL; /* threshold of 1 */
-       struct lttng_rate_policy *policy_from_buffer = NULL;
+       struct lttng_rate_policy *policy_a = nullptr; /* Threshold of 100. */
+       struct lttng_rate_policy *policy_b = nullptr; /* threshold of 100 */
+       struct lttng_rate_policy *policy_c = nullptr; /* threshold of 1 */
+       struct lttng_rate_policy *policy_from_buffer = nullptr;
        uint64_t threshold_a_b = 100;
        uint64_t threshold_c = 1;
        uint64_t threshold_query = 0;
@@ -127,21 +127,25 @@ static void test_rate_policy_once_after_n(void)
        policy_a = lttng_rate_policy_once_after_n_create(threshold_a_b);
        policy_b = lttng_rate_policy_once_after_n_create(threshold_a_b);
        policy_c = lttng_rate_policy_once_after_n_create(threshold_c);
-       ok(policy_a != NULL, "Rate policy every n A created: threshold: %" PRIu64, threshold_a_b);
-       ok(policy_b != NULL, "Rate policy every n B created: threshold: %" PRIu64, threshold_a_b);
-       ok(policy_c != NULL, "Rate policy every n C created: threshold: %" PRIu64, threshold_c);
+       ok(policy_a != nullptr,
+          "Rate policy every n A created: threshold: %" PRIu64,
+          threshold_a_b);
+       ok(policy_b != nullptr,
+          "Rate policy every n B created: threshold: %" PRIu64,
+          threshold_a_b);
+       ok(policy_c != nullptr, "Rate policy every n C created: threshold: %" PRIu64, threshold_c);
 
        ok(LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N == lttng_rate_policy_get_type(policy_a),
           "Type is LTTNG_RATE_POLICY_TYPE_once_after_n");
 
        /* Getter tests */
-       status = lttng_rate_policy_once_after_n_get_threshold(NULL, NULL);
+       status = lttng_rate_policy_once_after_n_get_threshold(nullptr, nullptr);
        ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get threshold returns INVALID");
 
-       status = lttng_rate_policy_once_after_n_get_threshold(NULL, &threshold_query);
+       status = lttng_rate_policy_once_after_n_get_threshold(nullptr, &threshold_query);
        ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get threshold returns INVALID");
 
-       status = lttng_rate_policy_once_after_n_get_threshold(policy_a, NULL);
+       status = lttng_rate_policy_once_after_n_get_threshold(policy_a, nullptr);
        ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get threshold returns INVALID");
 
        status = lttng_rate_policy_once_after_n_get_threshold(policy_a, &threshold_query);
@@ -157,9 +161,9 @@ static void test_rate_policy_once_after_n(void)
           " Getting threshold C");
 
        /* is_equal tests */
-       ok(false == lttng_rate_policy_is_equal(NULL, NULL), "is equal (NULL,NULL)");
-       ok(false == lttng_rate_policy_is_equal(policy_a, NULL), "is equal (object, NULL)");
-       ok(false == lttng_rate_policy_is_equal(NULL, policy_a), " is equal (NULL, object)");
+       ok(false == lttng_rate_policy_is_equal(nullptr, nullptr), "is equal (NULL,NULL)");
+       ok(false == lttng_rate_policy_is_equal(policy_a, nullptr), "is equal (object, NULL)");
+       ok(false == lttng_rate_policy_is_equal(nullptr, policy_a), " is equal (NULL, object)");
        ok(true == lttng_rate_policy_is_equal(policy_a, policy_a), "is equal (object A, object A)");
 
        ok(true == lttng_rate_policy_is_equal(policy_a, policy_b), "is equal (object A, object B");
@@ -176,7 +180,7 @@ static void test_rate_policy_once_after_n(void)
                struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
                ok(lttng_rate_policy_create_from_payload(&view, &policy_from_buffer) > 0 &&
-                          policy_from_buffer != NULL,
+                          policy_from_buffer != nullptr,
                   "Deserializing");
        }
 
@@ -190,7 +194,7 @@ static void test_rate_policy_once_after_n(void)
        lttng_payload_reset(&payload);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        test_rate_policy_every_n();
index cfd5b1a975d87fe3b5be688c49a37ef9dc491091..11ba8b032ed5207cbc8f0d58812a1e68c282a27d 100644 (file)
@@ -144,14 +144,14 @@ struct test tests[] = {
 static char *craft_expected(struct test *test, time_t relay_session_creation_time)
 {
        int ret;
-       char *result = NULL;
+       char *result = nullptr;
        char relay_session_creation_datetime[DATETIME_STR_LEN];
 
        ret = time_to_datetime_str(relay_session_creation_time,
                                   relay_session_creation_datetime,
                                   sizeof(relay_session_creation_datetime));
        if (ret < 0) {
-               result = NULL;
+               result = nullptr;
                goto end;
        }
 
@@ -165,18 +165,18 @@ static char *craft_expected(struct test *test, time_t relay_session_creation_tim
                       test->extra_path[0] != '\0' ? "/" : "",
                       test->leftover);
        if (ret < 0) {
-               result = NULL;
+               result = nullptr;
                goto end;
        }
 end:
        return result;
 }
 
-int main(void)
+int main()
 {
        int i;
        int num_test = sizeof(tests) / sizeof(struct test);
-       const time_t test_time = time(NULL);
+       const time_t test_time = time(nullptr);
 
        plan_tests(NUM_TESTS_PER_TEST * num_test);
        diag("Backward compatibility utils for lttng-relayd --group-by-session");
@@ -187,8 +187,8 @@ int main(void)
        }
 
        for (i = 0; i < num_test; i++) {
-               char *expected = NULL;
-               char *result = NULL;
+               char *expected = nullptr;
+               char *result = nullptr;
 
                expected = craft_expected(&tests[i], test_time);
                if (!expected) {
index 1589cf78e0e02f4c2dba6dc45e4ca54608138d49..f6e58c8cb48cae044539d0310a78814b58745c90 100644 (file)
@@ -41,7 +41,7 @@ static char random_string[RANDOM_STRING_LEN];
  * Return random string of 10 characters.
  * Not thread-safe.
  */
-static char *get_random_string(void)
+static char *get_random_string()
 {
        int i;
 
@@ -70,7 +70,7 @@ static int find_session_name(const char *name)
        return -1;
 }
 
-static int session_list_count(void)
+static int session_list_count()
 {
        int count = 0;
        struct ltt_session *iter;
@@ -84,7 +84,7 @@ static int session_list_count(void)
 /*
  * Empty session list manually.
  */
-static void empty_session_list(void)
+static void empty_session_list()
 {
        struct ltt_session *iter, *tmp;
 
@@ -105,7 +105,7 @@ static int create_one_session(const char *name)
 {
        int ret;
        enum lttng_error_code ret_code;
-       struct ltt_session *session = NULL;
+       struct ltt_session *session = nullptr;
 
        session_lock_list();
        ret_code = session_create(name, geteuid(), getegid(), &session);
@@ -161,7 +161,7 @@ static int destroy_one_session(struct ltt_session *session)
  * This test is supposed to fail at the second create call. If so, return 0 for
  * test success, else -1.
  */
-static int two_session_same_name(void)
+static int two_session_same_name()
 {
        int ret;
        struct ltt_session *sess;
@@ -192,28 +192,28 @@ end:
        return ret;
 }
 
-static void test_session_list(void)
+static void test_session_list()
 {
        session_list = session_get_list();
-       ok(session_list != NULL, "Session list: not NULL");
+       ok(session_list != nullptr, "Session list: not NULL");
 }
 
-static void test_create_one_session(void)
+static void test_create_one_session()
 {
        ok(create_one_session(SESSION1) == 0, "Create session: %s", SESSION1);
 }
 
-static void test_validate_session(void)
+static void test_validate_session()
 {
        struct ltt_session *tmp;
 
        session_lock_list();
        tmp = session_find_by_name(SESSION1);
 
-       ok(tmp != NULL, "Validating session: session found");
+       ok(tmp != nullptr, "Validating session: session found");
 
        if (tmp) {
-               ok(tmp->kernel_session == NULL && strlen(tmp->name),
+               ok(tmp->kernel_session == nullptr && strlen(tmp->name),
                   "Validating session: basic sanity check");
        } else {
                skip(1, "Skipping session validation check as session was not found");
@@ -227,14 +227,14 @@ end:
        session_unlock_list();
 }
 
-static void test_destroy_session(void)
+static void test_destroy_session()
 {
        struct ltt_session *tmp;
 
        session_lock_list();
        tmp = session_find_by_name(SESSION1);
 
-       ok(tmp != NULL, "Destroying session: session found");
+       ok(tmp != nullptr, "Destroying session: session found");
 
        if (tmp) {
                ok(destroy_one_session(tmp) == 0, "Destroying session: %s destroyed", SESSION1);
@@ -244,19 +244,19 @@ static void test_destroy_session(void)
        session_unlock_list();
 }
 
-static void test_duplicate_session(void)
+static void test_duplicate_session()
 {
        ok(two_session_same_name() == 0, "Duplicate session creation");
 }
 
-static void test_session_name_generation(void)
+static void test_session_name_generation()
 {
-       struct ltt_session *session = NULL;
+       struct ltt_session *session = nullptr;
        enum lttng_error_code ret_code;
        const char *expected_session_name_prefix = DEFAULT_SESSION_NAME;
 
        session_lock_list();
-       ret_code = session_create(NULL, geteuid(), getegid(), &session);
+       ret_code = session_create(nullptr, geteuid(), getegid(), &session);
        ok(ret_code == LTTNG_OK, "Create session with a NULL name (auto-generate a name)");
        if (!session) {
                skip(1, "Skipping session name generation tests as session_create() failed.");
@@ -274,7 +274,7 @@ end:
        session_unlock_list();
 }
 
-static void test_large_session_number(void)
+static void test_large_session_number()
 {
        int ret, i, failed = 0;
        struct ltt_session *iter, *tmp;
@@ -310,7 +310,7 @@ static void test_large_session_number(void)
           MAX_SESSIONS);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
 
index 239e998dce65431dba0cf15fd778153d2f69391d..ca0f607ba04cab7f9b4865fd5ccdaeff9f2bed59 100644 (file)
@@ -62,7 +62,7 @@ static void test_one_split(const char *input, char delim, int escape_delim, ...)
           escape_delim);
 }
 
-static void test_split(void)
+static void test_split()
 {
        test_one_split("a/b/c/d/e", '/', false, "a", "b", "c", "d", "e", NULL);
        test_one_split("a/b//d/e", '/', false, "a", "b", "", "d", "e", NULL);
@@ -91,7 +91,7 @@ static void test_one_is_star_at_the_end_only_glob_pattern(const char *pattern, b
           expected);
 }
 
-static void test_is_star_at_the_end_only_glob_pattern(void)
+static void test_is_star_at_the_end_only_glob_pattern()
 {
        test_one_is_star_at_the_end_only_glob_pattern("allo*", true);
        test_one_is_star_at_the_end_only_glob_pattern("allo\\\\*", true);
@@ -113,7 +113,7 @@ static void test_one_is_star_glob_pattern(const char *pattern, bool expected)
           expected);
 }
 
-static void test_is_star_glob_pattern(void)
+static void test_is_star_glob_pattern()
 {
        test_one_is_star_glob_pattern("allo*", true);
        test_one_is_star_glob_pattern("*allo", true);
@@ -145,7 +145,7 @@ static void test_one_normalize_star_glob_pattern(const char *pattern, const char
        free(rw_pattern);
 }
 
-static void test_normalize_star_glob_pattern(void)
+static void test_normalize_star_glob_pattern()
 {
        test_one_normalize_star_glob_pattern("salut", "salut");
        test_one_normalize_star_glob_pattern("sal*ut", "sal*ut");
@@ -176,7 +176,7 @@ static void test_normalize_star_glob_pattern(void)
        test_one_normalize_star_glob_pattern("**\\***", "*\\**");
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
        diag("String utils unit tests");
index 2c23b669c2d800bf35e7b528b0e346f3bc0ef1a5..361dbe36a7edf4e0c7b304b81ed30e499cd9211e 100644 (file)
@@ -486,7 +486,7 @@ error:
        lttng_payload_reset(&received_payload);
 }
 
-static void test_creds_passing(void)
+static void test_creds_passing()
 {
        pid_t fork_ret = -1;
        int ret, parent_socket = -1, child_connection_socket = -1;
@@ -651,7 +651,7 @@ error:
        }
 }
 
-int main(void)
+int main()
 {
        plan_tests(TEST_COUNT);
 
index 558948040e486516586521d330870307e9a39d84..41c74203dd035d263b4750c8f845c9f5a6c17ff5 100644 (file)
@@ -18,11 +18,11 @@ int lttng_opt_mi;
 /* Number of TAP tests in this file */
 #define NUM_TESTS 11
 
-static void test_uri_parsing(void)
+static void test_uri_parsing()
 {
        ssize_t size;
        const char *s_uri1;
-       struct lttng_uri *uri = NULL;
+       struct lttng_uri *uri = nullptr;
 
        s_uri1 = "net://localhost";
 
@@ -37,7 +37,7 @@ static void test_uri_parsing(void)
 
        if (uri) {
                uri_free(uri);
-               uri = NULL;
+               uri = nullptr;
        }
 
        s_uri1 = "net://localhost:8989:4242/my/test/path";
@@ -54,7 +54,7 @@ static void test_uri_parsing(void)
 
        if (uri) {
                uri_free(uri);
-               uri = NULL;
+               uri = nullptr;
        }
 
        s_uri1 = "net://localhost:8989:4242";
@@ -70,7 +70,7 @@ static void test_uri_parsing(void)
 
        if (uri) {
                uri_free(uri);
-               uri = NULL;
+               uri = nullptr;
        }
 
        s_uri1 = "net6://[::1]:8989";
@@ -86,7 +86,7 @@ static void test_uri_parsing(void)
 
        if (uri) {
                uri_free(uri);
-               uri = NULL;
+               uri = nullptr;
        }
 
        s_uri1 = "tcp://42.42.42.42/my/test/path";
@@ -101,7 +101,7 @@ static void test_uri_parsing(void)
 
        if (uri) {
                uri_free(uri);
-               uri = NULL;
+               uri = nullptr;
        }
 
        s_uri1 = "tcp6://[fe80::f66d:4ff:fe53:d220]/my/test/path";
@@ -116,7 +116,7 @@ static void test_uri_parsing(void)
 
        if (uri) {
                uri_free(uri);
-               uri = NULL;
+               uri = nullptr;
        }
 
        s_uri1 = "file:///my/test/path";
@@ -130,7 +130,7 @@ static void test_uri_parsing(void)
 
        if (uri) {
                uri_free(uri);
-               uri = NULL;
+               uri = nullptr;
        }
 
        /* FIXME: Noisy on stdout */
@@ -145,7 +145,7 @@ static void test_uri_parsing(void)
        LTTNG_ASSERT(!uri);
 }
 
-static void test_uri_cmp(void)
+static void test_uri_cmp()
 {
        struct lttng_uri *uri1, *uri2;
        const char *s_uri1 = "net://localhost";
@@ -198,7 +198,7 @@ static void test_uri_cmp(void)
        uri_free(uri2);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
 
index ac03a4f3f800043b4bf36f9d63ddb0fb2b708676..93875491b2161097248b9536aae33955af6ee28b 100644 (file)
@@ -42,7 +42,7 @@ static char random_string[RANDOM_STRING_LEN];
  * Return random string of 10 characters.
  * Not thread-safe.
  */
-static char *get_random_string(void)
+static char *get_random_string()
 {
        int i;
 
@@ -55,18 +55,18 @@ static char *get_random_string(void)
        return random_string;
 }
 
-static void test_create_one_ust_session(void)
+static void test_create_one_ust_session()
 {
        struct ltt_ust_session *usess = trace_ust_create_session(42);
 
-       ok(usess != NULL, "Create UST session");
+       ok(usess != nullptr, "Create UST session");
 
        if (!usess) {
                skip(1, "UST session is null");
                return;
        }
 
-       ok(usess->id == 42 && usess->active == 0 && usess->domain_global.channels != NULL &&
+       ok(usess->id == 42 && usess->active == 0 && usess->domain_global.channels != nullptr &&
                   usess->uid == 0 && usess->gid == 0,
           "Validate UST session");
 
@@ -74,7 +74,7 @@ static void test_create_one_ust_session(void)
        trace_ust_free_session(usess);
 }
 
-static void test_create_ust_channel(void)
+static void test_create_ust_channel()
 {
        struct ltt_ust_channel *uchan;
        struct lttng_channel attr;
@@ -87,7 +87,7 @@ static void test_create_ust_channel(void)
        ok(lttng_strncpy(attr.name, "channel0", sizeof(attr.name)) == 0,
           "Validate channel name length");
        uchan = trace_ust_create_channel(&attr, LTTNG_DOMAIN_UST);
-       ok(uchan != NULL, "Create UST channel");
+       ok(uchan != nullptr, "Create UST channel");
 
        if (!uchan) {
                skip(1, "UST channel is null");
@@ -95,14 +95,14 @@ static void test_create_ust_channel(void)
        }
 
        ok(uchan->enabled == 0 && strncmp(uchan->name, "channel0", 8) == 0 &&
-                  uchan->name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0' && uchan->ctx != NULL &&
-                  uchan->events != NULL && uchan->attr.overwrite == attr.attr.overwrite,
+                  uchan->name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0' && uchan->ctx != nullptr &&
+                  uchan->events != nullptr && uchan->attr.overwrite == attr.attr.overwrite,
           "Validate UST channel");
 
        trace_ust_destroy_channel(uchan);
 }
 
-static void test_create_ust_event(void)
+static void test_create_ust_event()
 {
        struct ltt_ust_event *event;
        struct lttng_event ev;
@@ -114,7 +114,7 @@ static void test_create_ust_event(void)
        ev.type = LTTNG_EVENT_TRACEPOINT;
        ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
 
-       ret = trace_ust_create_event(&ev, NULL, NULL, NULL, false, &event);
+       ret = trace_ust_create_event(&ev, nullptr, nullptr, nullptr, false, &event);
 
        ok(ret == LTTNG_OK, "Create UST event");
 
@@ -131,7 +131,7 @@ static void test_create_ust_event(void)
        trace_ust_destroy_event(event);
 }
 
-static void test_create_ust_event_exclusion(void)
+static void test_create_ust_event_exclusion()
 {
        int copy_ret;
        enum lttng_error_code ret;
@@ -139,8 +139,8 @@ static void test_create_ust_event_exclusion(void)
        struct lttng_event ev;
        char *name;
        char *random_name;
-       struct lttng_event_exclusion *exclusion = NULL;
-       struct lttng_event_exclusion *exclusion_copy = NULL;
+       struct lttng_event_exclusion *exclusion = nullptr;
+       struct lttng_event_exclusion *exclusion_copy = nullptr;
        const int exclusion_count = 2;
 
        memset(&ev, 0, sizeof(ev));
@@ -156,7 +156,7 @@ static void test_create_ust_event_exclusion(void)
        /* set up an exclusion set */
        exclusion = zmalloc<lttng_event_exclusion>(sizeof(*exclusion) +
                                                   LTTNG_SYMBOL_NAME_LEN * exclusion_count);
-       ok(exclusion != NULL, "Create UST exclusion");
+       ok(exclusion != nullptr, "Create UST exclusion");
        if (!exclusion) {
                skip(4, "zmalloc failed");
                goto end;
@@ -171,14 +171,14 @@ static void test_create_ust_event_exclusion(void)
                random_name,
                LTTNG_SYMBOL_NAME_LEN - 1);
 
-       ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
-       exclusion = NULL;
+       ret = trace_ust_create_event(&ev, nullptr, nullptr, exclusion, false, &event);
+       exclusion = nullptr;
 
        ok(ret != LTTNG_OK, "Create UST event with identical exclusion names fails");
 
        exclusion = zmalloc<lttng_event_exclusion>(sizeof(*exclusion) +
                                                   LTTNG_SYMBOL_NAME_LEN * exclusion_count);
-       ok(exclusion != NULL, "Create UST exclusion");
+       ok(exclusion != nullptr, "Create UST exclusion");
        if (!exclusion) {
                skip(2, "zmalloc failed");
                goto end;
@@ -217,8 +217,8 @@ static void test_create_ust_event_exclusion(void)
                                 sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 1)));
        LTTNG_ASSERT(copy_ret == 0);
 
-       ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
-       exclusion = NULL;
+       ret = trace_ust_create_event(&ev, nullptr, nullptr, exclusion, false, &event);
+       exclusion = nullptr;
        ok(ret == LTTNG_OK, "Create UST event with different exclusion names");
 
        if (!event) {
@@ -227,7 +227,7 @@ static void test_create_ust_event_exclusion(void)
        }
 
        ok(event->enabled == 0 && event->attr.instrumentation == LTTNG_UST_ABI_TRACEPOINT &&
-                  strcmp(event->attr.name, ev.name) == 0 && event->exclusion != NULL &&
+                  strcmp(event->attr.name, ev.name) == 0 && event->exclusion != nullptr &&
                   event->exclusion->count == exclusion_count &&
                   !memcmp(event->exclusion->names,
                           exclusion_copy->names,
@@ -242,7 +242,7 @@ end:
        return;
 }
 
-static void test_create_ust_context(void)
+static void test_create_ust_context()
 {
        struct lttng_event_context ectx;
        struct ltt_ust_context *uctx;
@@ -250,7 +250,7 @@ static void test_create_ust_context(void)
        ectx.ctx = LTTNG_EVENT_CONTEXT_VTID;
 
        uctx = trace_ust_create_context(&ectx);
-       ok(uctx != NULL, "Create UST context");
+       ok(uctx != nullptr, "Create UST context");
 
        if (uctx) {
                ok((int) uctx->ctx.ctx == LTTNG_UST_ABI_CONTEXT_VTID, "Validate UST context");
@@ -260,7 +260,7 @@ static void test_create_ust_context(void)
        free(uctx);
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
 
index dcfbe2aa07a27b7e934e63dbd4521a57a176e007..6c865b298e975dc73ad5da5f8e02ec85be7f6428 100644 (file)
@@ -56,7 +56,7 @@ int lttng_opt_mi;
 #define CLOE_VALUE FD_CLOEXEC
 #endif
 
-static void test_epoll_compat(void)
+static void test_epoll_compat()
 {
        /*
         * Type conversion present to disable warning of anonymous enum from
@@ -66,14 +66,14 @@ static void test_epoll_compat(void)
 }
 #endif
 
-static void test_alloc(void)
+static void test_alloc()
 {
        struct lttng_poll_event poll_events;
 
        lttng_poll_init(&poll_events);
 
        /* Null pointer */
-       ok(lttng_poll_create(NULL, 1, 0) != 0, "Create over NULL pointer fails");
+       ok(lttng_poll_create(nullptr, 1, 0) != 0, "Create over NULL pointer fails");
        /* Size 0 */
        ok(lttng_poll_create(&poll_events, 0, 0) != 0, "Create with size 0 fails");
        /* without CLOEXEC */
@@ -87,12 +87,12 @@ static void test_alloc(void)
 }
 
 /* Tests stuff related to what would be handled with epoll_ctl. */
-static void test_add_del(void)
+static void test_add_del()
 {
        struct lttng_poll_event poll_events;
 
        lttng_poll_init(&poll_events);
-       ok(lttng_poll_add(NULL, 1, LPOLLIN) != 0, "Adding to NULL set fails");
+       ok(lttng_poll_add(nullptr, 1, LPOLLIN) != 0, "Adding to NULL set fails");
        ok(lttng_poll_add(&poll_events, 1, LPOLLIN) != 0,
           "Adding to uninitialized structure fails");
        ok(lttng_poll_add(&poll_events, -1, LPOLLIN) != 0, "Adding invalid FD fails");
@@ -100,7 +100,7 @@ static void test_add_del(void)
        ok(lttng_poll_create(&poll_events, 1, 0) == 0, "Create a poll set succeeds");
        ok(LTTNG_POLL_GETNB(&poll_events) == 0, "Set created empty");
 
-       ok(lttng_poll_add(NULL, 1, LPOLLIN) != 0, "Adding to NULL set fails");
+       ok(lttng_poll_add(nullptr, 1, LPOLLIN) != 0, "Adding to NULL set fails");
        ok(LTTNG_POLL_GETNB(&poll_events) == 0, "Set still empty");
        ok(lttng_poll_add(&poll_events, -1, LPOLLIN) != 0, "Adding invalid FD fails");
        ok(LTTNG_POLL_GETNB(&poll_events) == 0, "Set still empty");
@@ -108,7 +108,7 @@ static void test_add_del(void)
        ok(lttng_poll_add(&poll_events, 1, LPOLLIN) == 0, "Adding valid FD succeeds");
        ok(LTTNG_POLL_GETNB(&poll_events) == 1, "Nb of elements incremented");
 
-       ok(lttng_poll_del(NULL, 1) != 0, "Removing from NULL set fails");
+       ok(lttng_poll_del(nullptr, 1) != 0, "Removing from NULL set fails");
        ok(LTTNG_POLL_GETNB(&poll_events) == 1, "Number of FD in set unchanged");
 
        ok(lttng_poll_del(&poll_events, -1) != 0, "Removing from negative FD fails");
@@ -126,7 +126,7 @@ static void test_add_del(void)
        lttng_poll_clean(&poll_events);
 }
 
-static void test_mod_wait(void)
+static void test_mod_wait()
 {
        struct lttng_poll_event poll_events;
        struct lttng_poll_event cpoll_events;
@@ -146,7 +146,7 @@ static void test_mod_wait(void)
        if (cpid == 0) {
                childok(lttng_poll_create(&cpoll_events, 1, 0) == 0,
                        "Create valid poll set succeeds");
-               childok(lttng_poll_mod(NULL, infd[0], LPOLLIN) == -1,
+               childok(lttng_poll_mod(nullptr, infd[0], LPOLLIN) == -1,
                        "lttng_poll_mod with invalid input returns an error");
                childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == -1,
                        "lttng_poll_mod with invalid input returns an error");
@@ -172,7 +172,7 @@ static void test_mod_wait(void)
                ok(close(hupfd[1]) == 0, "Close valid FD succeeds");
                ok(close(infd[0]) == 0, "Close valid FD succeeds");
 
-               ok(lttng_poll_wait(NULL, -1) == -1,
+               ok(lttng_poll_wait(nullptr, -1) == -1,
                   "lttng_poll_wait call with invalid input returns error");
 
                ok(lttng_poll_create(&poll_events, 1, 0) == 0, "Create valid poll set succeeds");
@@ -203,7 +203,7 @@ static int run_active_set_combination(unsigned int fd_count, unsigned int active
        const unsigned int active_fds_count = __builtin_popcount(active_fds_mask);
        struct lttng_poll_event poll_events;
        struct lttng_dynamic_pointer_array pipes;
-       struct lttng_pipe *pipe = NULL;
+       struct lttng_pipe *pipe = nullptr;
 
        lttng_poll_init(&poll_events);
        lttng_dynamic_pointer_array_init(&pipes, destroy_pipe);
@@ -238,7 +238,7 @@ static int run_active_set_combination(unsigned int fd_count, unsigned int active
                }
 
                /* Ownership transferred to the pointer array. */
-               pipe = NULL;
+               pipe = nullptr;
        }
 
        /* Write one byte for all active fds that should be active. */
@@ -305,7 +305,7 @@ fail:
        fail("Test all combinations of active file descriptors for %u file descriptors", fd_count);
 }
 
-static void test_func_def(void)
+static void test_func_def()
 {
 #ifdef LTTNG_POLL_GETFD
 #define PASS_GETFD 1
@@ -339,7 +339,7 @@ static void test_func_def(void)
        ok(PASS_GET_PREV_FD, "GET_PREV_FD is defined");
 }
 
-int main(void)
+int main()
 {
        plan_tests(NUM_TESTS);
 #ifdef HAVE_EPOLL
index 3adfd7ea7137815d921d2e99b88a756578c1b3da..db39d49b7ce5544d8d995df582c4dc87ed54c678 100644 (file)
@@ -13,7 +13,7 @@
 
 #define TEST_NAME_PROPER_LEN 16
 
-int main(void)
+int main()
 {
        int ret;
        char name1[TEST_NAME_PROPER_LEN];
index 908347659d6d3b28c0187337cedc47c7d7adc053..8809448caf5b62e781e352efe169916a5394c9c2 100644 (file)
@@ -93,23 +93,24 @@ const int num_symlink_tests = sizeof(symlink_tests_inputs) / sizeof(symlink_test
 
 /* Invalid test cases */
 char *invalid_tests_inputs[] = {
-       NULL,
+       nullptr,
 };
 const int num_invalid_tests = sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]);
 } /* namespace */
 
 #define PRINT_ERR(fmt, args...) fprintf(stderr, "test_utils_expand_path: error: " fmt "\n", ##args)
 
-static int prepare_valid_results(void)
+static int prepare_valid_results()
 {
        int i;
-       char *relative, *cur_path = NULL, *prev_path = NULL, *pprev_path = NULL, *empty = NULL;
+       char *relative, *cur_path = nullptr, *prev_path = nullptr, *pprev_path = nullptr,
+                       *empty = nullptr;
        int ret = 0;
 
        /* Prepare the relative paths */
-       cur_path = realpath(".", NULL);
-       prev_path = realpath("..", NULL);
-       pprev_path = realpath("../..", NULL);
+       cur_path = realpath(".", nullptr);
+       prev_path = realpath("..", nullptr);
+       pprev_path = realpath("../..", nullptr);
        empty = strdup("");
        if (!cur_path || !prev_path || !pprev_path || !empty) {
                PRINT_ERR("strdup out of memory");
@@ -126,7 +127,7 @@ static int prepare_valid_results(void)
        }
        for (i = 0; i < num_valid_tests; i++) {
                valid_tests_expected_results[i] = calloc<char>(PATH_MAX);
-               if (valid_tests_expected_results[i] == NULL) {
+               if (valid_tests_expected_results[i] == nullptr) {
                        PRINT_ERR("malloc expected results");
                        ret = -1;
                        goto end;
@@ -158,7 +159,7 @@ end:
        return ret;
 }
 
-static int free_valid_results(void)
+static int free_valid_results()
 {
        int i;
 
@@ -171,13 +172,13 @@ static int free_valid_results(void)
        return 0;
 }
 
-static int prepare_symlink_tree(void)
+static int prepare_symlink_tree()
 {
        int i;
        char tmppath[PATH_MAX] = {};
 
        /* Create the temporary directory */
-       if (mkdtemp(tree_origin) == NULL) {
+       if (mkdtemp(tree_origin) == nullptr) {
                PRINT_ERR("failed to mkdtemp");
                goto error;
        }
@@ -210,7 +211,7 @@ error:
        return 1;
 }
 
-static int free_symlink_tree(void)
+static int free_symlink_tree()
 {
        int i;
        char tmppath[PATH_MAX];
@@ -247,7 +248,7 @@ error:
        return 1;
 }
 
-static void test_utils_expand_path(void)
+static void test_utils_expand_path()
 {
        char *result;
        char name[100], tmppath[PATH_MAX], real_tree_origin[PATH_MAX];
@@ -258,7 +259,7 @@ static void test_utils_expand_path(void)
                sprintf(name, "valid test case: %s", valid_tests_inputs[i].input);
 
                result = utils_expand_path(valid_tests_inputs[i].input);
-               ok(result != NULL && strcmp(result, valid_tests_expected_results[i]) == 0,
+               ok(result != nullptr && strcmp(result, valid_tests_expected_results[i]) == 0,
                   "%s",
                   name);
 
@@ -297,7 +298,7 @@ static void test_utils_expand_path(void)
                        continue;
                }
                result = utils_expand_path(tmppath);
-               ok(result != NULL &&
+               ok(result != nullptr &&
                           strcmp(result + treelen, symlink_tests_inputs[i].expected_result) == 0,
                   "%s",
                   name);
@@ -312,14 +313,14 @@ static void test_utils_expand_path(void)
                sprintf(name, "invalid test case: %s", test_input ? test_input : "NULL");
 
                result = utils_expand_path(test_input);
-               if (result != NULL) {
+               if (result != nullptr) {
                        free(result);
                }
-               ok(result == NULL, "%s", name);
+               ok(result == nullptr, "%s", name);
        }
 }
 
-int main(void)
+int main()
 {
        if (prepare_symlink_tree() != 0) {
                goto error_mkdir;
index 3073e86860c5633498d865156bca9097bf8e2a70..4af3bc90d96090150ee1c49aa6ac1becc6f26629 100644 (file)
@@ -78,7 +78,7 @@ const char *invalid_tests_inputs[] = {
 const int num_invalid_tests = sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]);
 } /* namespace */
 
-static void test_utils_parse_size_suffix(void)
+static void test_utils_parse_size_suffix()
 {
        uint64_t result;
        int ret;
@@ -103,7 +103,7 @@ static void test_utils_parse_size_suffix(void)
        }
 }
 
-int main(void)
+int main()
 {
        plan_tests(num_valid_tests + num_invalid_tests);
 
index 98630d6abce44772860ba5c0a7a81f7e653087a3..12185830f140b32e5f026923f37edd27966934d8 100644 (file)
@@ -71,7 +71,7 @@ const char *invalid_tests_inputs[] = {
 const int num_invalid_tests = sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]);
 } /* namespace */
 
-static void test_utils_parse_time_suffix(void)
+static void test_utils_parse_time_suffix()
 {
        uint64_t result;
        int ret;
@@ -100,7 +100,7 @@ static void test_utils_parse_time_suffix(void)
        }
 }
 
-int main(void)
+int main()
 {
        plan_tests(num_valid_tests + num_invalid_tests);
 
index b714754a23a295ba476ab3a05c3a085e3763f954..6db6d54b30451812825b311676074de521ef3a05 100644 (file)
@@ -39,7 +39,7 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose = 0;
 int lttng_opt_mi;
 
-static void run_test_lttng_uuid_from_str(void)
+static void run_test_lttng_uuid_from_str()
 {
        int ret;
        lttng_uuid uuid1;
@@ -96,7 +96,7 @@ static void run_test_lttng_uuid_from_str(void)
           invalid_str_6);
 }
 
-static void run_test_lttng_uuid_to_str(void)
+static void run_test_lttng_uuid_to_str()
 {
        char uuid_str[LTTNG_UUID_STR_LEN];
 
@@ -116,7 +116,7 @@ static void run_test_lttng_uuid_to_str(void)
           valid_str_3);
 }
 
-static void run_test_lttng_uuid_is_equal(void)
+static void run_test_lttng_uuid_is_equal()
 {
        int ret;
        lttng_uuid uuid1, uuid2;
@@ -134,7 +134,7 @@ static void run_test_lttng_uuid_is_equal(void)
        ok(ret == false, "lttng_uuid_is_equal - Compare different UUID, expect failure");
 }
 
-static void run_test_lttng_uuid_copy(void)
+static void run_test_lttng_uuid_copy()
 {
        bool ret;
        lttng_uuid uuid1;
@@ -145,7 +145,7 @@ static void run_test_lttng_uuid_copy(void)
        ok(ret == true, "lttng_uuid_copy - Compare copied UUID with source, expect success");
 }
 
-static void run_test_lttng_uuid_generate(void)
+static void run_test_lttng_uuid_generate()
 {
        int ret;
        lttng_uuid uuid1, uuid2;
@@ -174,7 +174,7 @@ static void run_test_lttng_uuid_generate(void)
        ok(ret == LTTNG_UUID_VER, "lttng_uuid_generate - Generated UUID version check");
 }
 
-static void run_test(void)
+static void run_test()
 {
        plan_tests(NR_TESTS);
 
@@ -185,7 +185,7 @@ static void run_test(void)
        run_test_lttng_uuid_generate();
 }
 
-int main(void)
+int main()
 {
        /* Run tap-formated tests */
        run_test();
index dc18e4e9f91f36b630c65db25d36cda4f90a3435..fef6b02f52f113e8844d766bc7e5b867e963d411 100644 (file)
 #endif
 
 static int debug = 0;
-static char *ns_opt = NULL;
-static char *before_unshare_wait_file_path = NULL;
-static char *after_unshare_wait_file_path = NULL;
-static char *after_unshare_signal_file_path = NULL;
+static char *ns_opt = nullptr;
+static char *before_unshare_wait_file_path = nullptr;
+static char *after_unshare_wait_file_path = nullptr;
+static char *after_unshare_signal_file_path = nullptr;
 
 static struct poptOption opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "debug", 'd', POPT_ARG_NONE, &debug, 0, "Enable debug output", NULL },
-       { "ns", 'n', POPT_ARG_STRING, &ns_opt, 0, "Namespace short identifier", NULL },
+       { "debug", 'd', POPT_ARG_NONE, &debug, 0, "Enable debug output", nullptr },
+       { "ns", 'n', POPT_ARG_STRING, &ns_opt, 0, "Namespace short identifier", nullptr },
        { "before",
          'b',
          POPT_ARG_STRING,
          &before_unshare_wait_file_path,
          0,
          "Wait for file before unshare",
-         NULL },
+         nullptr },
        { "after",
          'a',
          POPT_ARG_STRING,
          &after_unshare_wait_file_path,
          0,
          "Wait for file after unshare",
-         NULL },
+         nullptr },
        { "signal",
          's',
          POPT_ARG_STRING,
          &after_unshare_signal_file_path,
          0,
          "Create signal file after unshare",
-         NULL },
-       POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL }
+         nullptr },
+       POPT_AUTOHELP{ nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
 };
 
 static ATTR_FORMAT_PRINTF(1, 2) void debug_printf(const char *format, ...)
@@ -200,7 +200,7 @@ int main(int argc, const char **argv)
        int ret = EXIT_SUCCESS;
        poptContext pc;
 
-       pc = poptGetContext(NULL, argc, argv, opts, 0);
+       pc = poptGetContext(nullptr, argc, argv, opts, 0);
        poptReadDefaultConfig(pc, 0);
 
        if (argc < 2) {
@@ -229,7 +229,7 @@ int main(int argc, const char **argv)
                goto end;
        }
 
-       if (ns_opt == NULL) {
+       if (ns_opt == nullptr) {
                poptPrintUsage(pc, stderr, 0);
                ret = EXIT_FAILURE;
                goto end;
index 8a3014ea655e85204565eb0733ec986d55f78c7d..c6b40f53dd2daaa01616718acccd5f0b3941c545 100644 (file)
 
 static int nr_iter = 100;
 static int debug = 0;
-static char *ns_opt = NULL;
-static char *after_unshare_file_path = NULL;
-static char *before_second_event_file_path = NULL;
+static char *ns_opt = nullptr;
+static char *after_unshare_file_path = nullptr;
+static char *before_second_event_file_path = nullptr;
 
 static struct poptOption opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "debug", 'd', POPT_ARG_NONE, &debug, 0, "Enable debug output", NULL },
-       { "ns", 'n', POPT_ARG_STRING, &ns_opt, 0, "Namespace short identifier", NULL },
-       { "iter", 'i', POPT_ARG_INT, &nr_iter, 0, "Number of tracepoint iterations", NULL },
+       { "debug", 'd', POPT_ARG_NONE, &debug, 0, "Enable debug output", nullptr },
+       { "ns", 'n', POPT_ARG_STRING, &ns_opt, 0, "Namespace short identifier", nullptr },
+       { "iter", 'i', POPT_ARG_INT, &nr_iter, 0, "Number of tracepoint iterations", nullptr },
        { "after",
          'a',
          POPT_ARG_STRING,
          &after_unshare_file_path,
          0,
          "after_unshare_file_path,",
-         NULL },
+         nullptr },
        { "before",
          'b',
          POPT_ARG_STRING,
          &before_second_event_file_path,
          0,
          "before_second_event_file_path,",
-         NULL },
-       POPT_AUTOHELP{ NULL, 0, 0, NULL, 0 }
+         nullptr },
+       POPT_AUTOHELP{ nullptr, 0, 0, nullptr, 0 }
 };
 
 static ATTR_FORMAT_PRINTF(1, 2) void debug_printf(const char *format, ...)
@@ -207,7 +207,7 @@ int main(int argc, const char **argv)
        int ret = EXIT_SUCCESS;
        poptContext pc;
 
-       pc = poptGetContext(NULL, argc, argv, opts, 0);
+       pc = poptGetContext(nullptr, argc, argv, opts, 0);
        poptReadDefaultConfig(pc, 0);
 
        if (argc < 2) {
@@ -236,7 +236,7 @@ int main(int argc, const char **argv)
                goto end;
        }
 
-       if (ns_opt == NULL) {
+       if (ns_opt == nullptr) {
                poptPrintUsage(pc, stderr, 0);
                ret = EXIT_FAILURE;
                goto end;
index 5c5ba3114b4ad2a04d3e2eed88d9919eff0101d0..d64d55421a1e1caa30496c42cfc373e8f626f740 100644 (file)
 
 static struct option long_options[] = {
        /* These options set a flag. */
-       { "iter", required_argument, 0, 'i' },
-       { "wait", required_argument, 0, 'w' },
-       { "sync-after-first-event", required_argument, 0, 'a' },
-       { "sync-before-last-event", required_argument, 0, 'b' },
-       { "sync-before-last-event-touch", required_argument, 0, 'c' },
-       { "sync-before-exit", required_argument, 0, 'd' },
-       { "sync-before-exit-touch", required_argument, 0, 'e' },
-       { "emit-end-event", no_argument, 0, 'f' },
-       { 0, 0, 0, 0 }
+       { "iter", required_argument, nullptr, 'i' },
+       { "wait", required_argument, nullptr, 'w' },
+       { "sync-after-first-event", required_argument, nullptr, 'a' },
+       { "sync-before-last-event", required_argument, nullptr, 'b' },
+       { "sync-before-last-event-touch", required_argument, nullptr, 'c' },
+       { "sync-before-exit", required_argument, nullptr, 'd' },
+       { "sync-before-exit-touch", required_argument, nullptr, 'e' },
+       { "emit-end-event", no_argument, nullptr, 'f' },
+       { nullptr, 0, nullptr, 0 }
 };
 
 int main(int argc, char **argv)
@@ -54,17 +54,17 @@ int main(int argc, char **argv)
        uint32_t net_values[] = { 1, 2, 3 };
        int nr_iter = 100, ret = 0, first_event_file_created = 0;
        useconds_t nr_usec = 0;
-       char *after_first_event_file_path = NULL;
-       char *before_last_event_file_path = NULL;
+       char *after_first_event_file_path = nullptr;
+       char *before_last_event_file_path = nullptr;
        /*
         * Touch a file to indicate that all events except one were
         * generated.
         */
-       char *before_last_event_file_path_touch = NULL;
+       char *before_last_event_file_path_touch = nullptr;
        /* Touch file when we are exiting */
-       char *before_exit_file_path_touch = NULL;
+       char *before_exit_file_path_touch = nullptr;
        /* Wait on file before exiting */
-       char *before_exit_file_path = NULL;
+       char *before_exit_file_path = nullptr;
        /* Emit an end event */
        bool emit_end_event = false;
 
index e7a44151bb03d8b7d6903be43d2d477fdb4240df..b7c3974ee52c268e2f1d93e09e29b9ba4d00c1ee 100644 (file)
 
 static struct option long_options[] = {
        /* These options set a flag. */
-       { "iter", required_argument, 0, 'i' },
-       { "wait", required_argument, 0, 'w' },
-       { "create-in-main", required_argument, 0, 'm' },
-       { "wait-before-first-event", required_argument, 0, 'b' },
-       { 0, 0, 0, 0 }
+       { "iter", required_argument, nullptr, 'i' },
+       { "wait", required_argument, nullptr, 'w' },
+       { "create-in-main", required_argument, nullptr, 'm' },
+       { "wait-before-first-event", required_argument, nullptr, 'b' },
+       { nullptr, 0, nullptr, 0 }
 };
 
 int main(int argc, char **argv)
@@ -41,8 +41,8 @@ int main(int argc, char **argv)
        float flt = 2222.0;
        unsigned int nr_iter = 100;
        useconds_t nr_usec = 0;
-       char *wait_before_first_event_file_path = NULL;
-       char *create_in_main_file_path = NULL;
+       char *wait_before_first_event_file_path = nullptr;
+       char *create_in_main_file_path = nullptr;
 
        while ((option = getopt_long(argc, argv, "i:w:b:m:", long_options, &option_index)) != -1) {
                switch (option) {
index 011c399522451a407dbfd824fe380365e43043d6..8389b3f76b26f768502c982a21ee775e2d0374da 100644 (file)
@@ -45,7 +45,7 @@ int main(int argc, char **argv)
        int i;
        unsigned int nr_iter = 100;
        useconds_t nr_usec = 0;
-       char *tmp_file_path = NULL;
+       char *tmp_file_path = nullptr;
 
        if (set_signal_handler()) {
                return 1;
index cff564951015382fde8b97ca20b6b3a67155284d..ba2c86a39da25e73aa6437bbcce6e1d4b4f548c7 100644 (file)
@@ -22,7 +22,7 @@ void sighandler(int sig)
 }
 
 static
-int set_signal_handler(void)
+int set_signal_handler()
 {
        int ret;
        struct sigaction sa {};
@@ -35,7 +35,7 @@ int set_signal_handler(void)
                goto end;
        }
 
-       ret = sigaction(SIGTERM, &sa, NULL);
+       ret = sigaction(SIGTERM, &sa, nullptr);
        if (ret) {
                perror("sigaction");
                goto end;
index 18091e22d0244692899afb99d9e4405fe2db42c1..e135416367da19b2dfcf5ad07fb15ced1718153d 100644 (file)
@@ -15,7 +15,7 @@ void test_cxx_function()
        not_a_function += 1;
 }
 
-int main(void)
+int main()
 {
        test_class my_test_class;
        /* Call test function. */
index 4ec36f1145b79b0e02fbc4e217f2e562747dabf7..c95b4622709570c9f313085c4dedd5c74b59dfcf 100644 (file)
@@ -99,7 +99,7 @@ int wait_on_file(const char *path)
        for (;;) {
                ret = stat(path, &buf);
                if (ret == -1 && errno == ENOENT) {
-                       ret = poll(NULL, 0, 10); /* 10 ms delay */
+                       ret = poll(nullptr, 0, 10); /* 10 ms delay */
                        /* Should return 0 everytime */
                        if (ret) {
                                if (ret < 0) {
index 80b895411ab45b864208d33f2b673a19e0fe0c7e..3995dde48a27d9d96485f148222b883f58f4ef10 100644 (file)
@@ -56,7 +56,7 @@ static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
        int i;
 
        xmlNodePtr cur;
-       xmlChar *node_child_value_string = NULL;
+       xmlChar *node_child_value_string = nullptr;
 
        LTTNG_ASSERT(output);
        size = (nodes) ? nodes->nodeNr : 0;
@@ -135,7 +135,7 @@ static int register_lttng_namespace(xmlXPathContextPtr xpathCtx)
 {
        int ret;
        xmlChar *prefix;
-       xmlChar *ns = NULL;
+       xmlChar *ns = nullptr;
 
        prefix = xmlCharStrdup("lttng");
        if (!prefix) {
@@ -169,9 +169,9 @@ end:
 static int extract_xpath(const char *xml_path, const xmlChar *xpath)
 {
        int ret;
-       xmlDocPtr doc = NULL;
-       xmlXPathContextPtr xpathCtx = NULL;
-       xmlXPathObjectPtr xpathObj = NULL;
+       xmlDocPtr doc = nullptr;
+       xmlXPathContextPtr xpathCtx = nullptr;
+       xmlXPathObjectPtr xpathObj = nullptr;
 
        LTTNG_ASSERT(xml_path);
        LTTNG_ASSERT(xpath);
index aa2d526bd9096fccd590bb4234eb802a99bfeca9..ee1e552f85fb5b2f18cb7b5c0e7f568d4277cb64 100644 (file)
@@ -88,7 +88,7 @@ static int init_validation_ctx(struct validation_ctx *ctx, char *xsd_path)
                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                goto end;
        }
-       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, NULL);
+       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, nullptr);
 
        ctx->schema = xmlSchemaParse(ctx->parser_ctx);
        if (!ctx->schema) {
@@ -103,7 +103,7 @@ static int init_validation_ctx(struct validation_ctx *ctx, char *xsd_path)
        }
 
        xmlSchemaSetValidErrors(
-               ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, NULL);
+               ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, nullptr);
        ret = 0;
 
 end:
@@ -116,7 +116,7 @@ end:
 static int validate_xml(const char *xml_file_path, struct validation_ctx *ctx)
 {
        int ret;
-       xmlDocPtr doc = NULL;
+       xmlDocPtr doc = nullptr;
 
        LTTNG_ASSERT(xml_file_path);
        LTTNG_ASSERT(ctx);
This page took 0.652474 seconds and 4 git commands to generate.