Move to kernel style SPDX license identifiers
[lttng-ust.git] / liblttng-ust / lttng-events.c
index fbebc338c6f0b7e49760ff6d6f4dc556f009bd36..6196fc6a59fbbd89a8336f4526e62c5060109875 100644 (file)
@@ -1,23 +1,9 @@
 /*
- * lttng-events.c
- *
- * Holds LTTng per-session event registry.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
  * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; only
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Holds LTTng per-session event registry.
  */
 
 #define _LGPL_SOURCE
@@ -1456,14 +1442,16 @@ int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler)
 
 static
 void _lttng_enabler_attach_filter_bytecode(struct lttng_enabler *enabler,
-               struct lttng_ust_bytecode_node *bytecode)
+               struct lttng_ust_bytecode_node **bytecode)
 {
-       bytecode->enabler = enabler;
-       cds_list_add_tail(&bytecode->node, &enabler->filter_bytecode_head);
+       (*bytecode)->enabler = enabler;
+       cds_list_add_tail(&(*bytecode)->node, &enabler->filter_bytecode_head);
+       /* Take ownership of bytecode */
+       *bytecode = NULL;
 }
 
 int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler,
-               struct lttng_ust_bytecode_node *bytecode)
+               struct lttng_ust_bytecode_node **bytecode)
 {
        _lttng_enabler_attach_filter_bytecode(
                lttng_event_enabler_as_enabler(event_enabler), bytecode);
@@ -1512,7 +1500,7 @@ int lttng_event_notifier_enabler_disable(
 
 int lttng_event_notifier_enabler_attach_filter_bytecode(
                struct lttng_event_notifier_enabler *event_notifier_enabler,
-               struct lttng_ust_bytecode_node *bytecode)
+               struct lttng_ust_bytecode_node **bytecode)
 {
        _lttng_enabler_attach_filter_bytecode(
                lttng_event_notifier_enabler_as_enabler(event_notifier_enabler),
@@ -1524,12 +1512,14 @@ int lttng_event_notifier_enabler_attach_filter_bytecode(
 
 int lttng_event_notifier_enabler_attach_capture_bytecode(
                struct lttng_event_notifier_enabler *event_notifier_enabler,
-               struct lttng_ust_bytecode_node *bytecode)
+               struct lttng_ust_bytecode_node **bytecode)
 {
-       bytecode->enabler = lttng_event_notifier_enabler_as_enabler(
+       (*bytecode)->enabler = lttng_event_notifier_enabler_as_enabler(
                        event_notifier_enabler);
-       cds_list_add_tail(&bytecode->node,
+       cds_list_add_tail(&(*bytecode)->node,
                        &event_notifier_enabler->capture_bytecode_head);
+       /* Take ownership of bytecode */
+       *bytecode = NULL;
        event_notifier_enabler->num_captures++;
 
        lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group);
This page took 0.023865 seconds and 4 git commands to generate.