sessiond: registry_session: mark functions as noexcept
[lttng-tools.git] / src / common / event-rule / user-tracepoint.cpp
index 5158eeaa072c992a57aa777e4ee8fe0552ea40b5..48040fc59292384310ae1ac4fb19e0332266b08b 100644 (file)
@@ -5,19 +5,19 @@
  *
  */
 
-#include <common/credentials.h>
-#include <common/error.h>
-#include <common/hashtable/hashtable.h>
-#include <common/hashtable/utils.h>
-#include <common/macros.h>
-#include <common/mi-lttng.h>
-#include <common/optional.h>
-#include <common/payload-view.h>
-#include <common/payload.h>
-#include <common/runas.h>
-#include <common/string-utils/string-utils.h>
-#include <lttng/event-rule/event-rule-internal.h>
-#include <lttng/event-rule/user-tracepoint-internal.h>
+#include <common/credentials.hpp>
+#include <common/error.hpp>
+#include <common/hashtable/hashtable.hpp>
+#include <common/hashtable/utils.hpp>
+#include <common/macros.hpp>
+#include <common/mi-lttng.hpp>
+#include <common/optional.hpp>
+#include <common/payload-view.hpp>
+#include <common/payload.hpp>
+#include <common/runas.hpp>
+#include <common/string-utils/string-utils.hpp>
+#include <lttng/event-rule/event-rule-internal.hpp>
+#include <lttng/event-rule/user-tracepoint-internal.hpp>
 #include <lttng/event.h>
 #include <lttng/log-level-rule.h>
 
@@ -362,8 +362,7 @@ lttng_event_rule_user_tracepoint_generate_exclusions(
                goto end;
        }
 
-       exclusions = (lttng_event_exclusion *) zmalloc(sizeof(struct lttng_event_exclusion) +
-                       (LTTNG_SYMBOL_NAME_LEN * nb_exclusions));
+       exclusions = zmalloc<lttng_event_exclusion>(sizeof(struct lttng_event_exclusion) + (LTTNG_SYMBOL_NAME_LEN * nb_exclusions));
        if (!exclusions) {
                PERROR("Failed to allocate exclusions buffer");
                ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OUT_OF_MEMORY;
@@ -380,8 +379,10 @@ lttng_event_rule_user_tracepoint_generate_exclusions(
                                                rule, i, &exclusion_str);
                LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
-               copy_ret = lttng_strncpy(exclusions->names[i], exclusion_str,
-                               LTTNG_SYMBOL_NAME_LEN);
+               copy_ret = lttng_strncpy(
+                               LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i),
+                               exclusion_str,
+                               sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i)));
                if (copy_ret) {
                        free(exclusions);
                        exclusions = NULL;
@@ -558,7 +559,7 @@ struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void)
        struct lttng_event_rule_user_tracepoint *tp_rule;
        enum lttng_event_rule_status status;
 
-       tp_rule = (lttng_event_rule_user_tracepoint *) zmalloc(sizeof(struct lttng_event_rule_user_tracepoint));
+       tp_rule = zmalloc<lttng_event_rule_user_tracepoint>();
        if (!tp_rule) {
                goto end;
        }
This page took 0.024959 seconds and 4 git commands to generate.