Move event-expr from liblttng-ctl to libcommon
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 11 Feb 2021 15:18:38 +0000 (10:18 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Jul 2021 21:31:33 +0000 (17:31 -0400)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I31c65cd7f63fa4e1c918285b02ab2ab2e82549f6

src/common/Makefile.am
src/common/event-expr/event-expr.c [new file with mode: 0644]
src/lib/lttng-ctl/Makefile.am
src/lib/lttng-ctl/event-expr.c [deleted file]

index 0885448b5dbccb63d53fd32ee05ea4a90f2bf66a..ca0973403b7a0c07fc37e6d2e49112993618abe2 100644 (file)
@@ -66,6 +66,7 @@ libcommon_la_SOURCES = \
        error-query.c \
        evaluation.c \
        event.c \
+       event-expr/event-expr.c \
        event-expr-to-bytecode.c event-expr-to-bytecode.h \
        event-field-value.c \
        event-rule/event-rule.c \
diff --git a/src/common/event-expr/event-expr.c b/src/common/event-expr/event-expr.c
new file mode 100644 (file)
index 0000000..c0ec257
--- /dev/null
@@ -0,0 +1,442 @@
+/*
+ * event-expr.c
+ *
+ * Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ */
+
+#define _LGPL_SOURCE
+#include <assert.h>
+#include <stddef.h>
+
+#include <common/error.h>
+#include <common/macros.h>
+#include <lttng/event-expr-internal.h>
+
+enum lttng_event_expr_type lttng_event_expr_get_type(
+               const struct lttng_event_expr *expr)
+{
+       enum lttng_event_expr_type type;
+
+       if (!expr) {
+               type = LTTNG_EVENT_EXPR_TYPE_INVALID;
+               goto end;
+       }
+
+       type = expr->type;
+
+end:
+       return type;
+}
+
+static
+struct lttng_event_expr *create_empty_expr(enum lttng_event_expr_type type,
+               size_t size)
+{
+       struct lttng_event_expr *expr;
+
+       expr = zmalloc(size);
+       if (!expr) {
+               goto end;
+       }
+
+       expr->type = type;
+
+end:
+       return expr;
+}
+
+static
+struct lttng_event_expr_field *create_field_event_expr(
+               enum lttng_event_expr_type type,
+               const char *name)
+{
+       struct lttng_event_expr_field *expr =
+                       container_of(
+                               create_empty_expr(type, sizeof(*expr)),
+                               struct lttng_event_expr_field, parent);
+
+       if (!expr) {
+               goto error;
+       }
+
+       assert(name);
+       expr->name = strdup(name);
+       if (!expr->name) {
+               goto error;
+       }
+
+       goto end;
+
+error:
+       if (expr) {
+               lttng_event_expr_destroy(&expr->parent);
+       }
+       expr = NULL;
+
+end:
+       return expr;
+}
+
+struct lttng_event_expr *lttng_event_expr_event_payload_field_create(
+               const char *field_name)
+{
+       struct lttng_event_expr *expr = NULL;
+
+       if (!field_name) {
+               goto end;
+       }
+
+       expr = &create_field_event_expr(
+                       LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD,
+                       field_name)->parent;
+
+end:
+       return expr;
+}
+
+struct lttng_event_expr *lttng_event_expr_channel_context_field_create(
+               const char *field_name)
+{
+       struct lttng_event_expr *expr = NULL;
+
+       if (!field_name) {
+               goto end;
+       }
+
+       expr = &create_field_event_expr(
+                       LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD,
+                       field_name)->parent;
+
+end:
+       return expr;
+}
+
+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 *ret_parent_expr;
+
+       if (!type_name || !provider_name) {
+               goto error;
+       }
+
+       expr = container_of(create_empty_expr(
+                       LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD,
+                       sizeof(*expr)),
+                       struct lttng_event_expr_app_specific_context_field,
+                       parent);
+       if (!expr) {
+               goto error;
+       }
+
+       expr->provider_name = strdup(provider_name);
+       if (!expr->provider_name) {
+               goto error;
+       }
+
+       expr->type_name = strdup(type_name);
+       if (!expr->type_name) {
+               goto error;
+       }
+
+       ret_parent_expr = &expr->parent;
+       goto end;
+
+error:
+       if (expr) {
+               lttng_event_expr_destroy(&expr->parent);
+       }
+       ret_parent_expr = NULL;
+
+end:
+       return ret_parent_expr;
+}
+
+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 *ret_parent_expr;
+
+       /* The parent array field expression must be an l-value */
+       if (!array_field_expr ||
+                       !lttng_event_expr_is_lvalue(array_field_expr)) {
+               goto error;
+       }
+
+       expr = container_of(create_empty_expr(
+                       LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT,
+                       sizeof(*expr)),
+                       struct lttng_event_expr_array_field_element,
+                       parent);
+       if (!expr) {
+               goto error;
+       }
+
+       expr->array_field_expr = array_field_expr;
+       expr->index = index;
+       ret_parent_expr = &expr->parent;
+       goto end;
+
+error:
+       if (expr) {
+               lttng_event_expr_destroy(&expr->parent);
+       }
+       ret_parent_expr = NULL;
+
+end:
+       return ret_parent_expr;
+}
+
+const char *lttng_event_expr_event_payload_field_get_name(
+               const struct lttng_event_expr *expr)
+{
+       const char *ret = NULL;
+
+       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD) {
+               goto end;
+       }
+
+       ret = container_of(expr,
+                       const struct lttng_event_expr_field, parent)->name;
+
+end:
+       return ret;
+}
+
+const char *lttng_event_expr_channel_context_field_get_name(
+               const struct lttng_event_expr *expr)
+{
+       const char *ret = NULL;
+
+       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD) {
+               goto end;
+       }
+
+       ret = container_of(expr,
+                       const struct lttng_event_expr_field, parent)->name;
+
+end:
+       return ret;
+}
+
+const char *lttng_event_expr_app_specific_context_field_get_provider_name(
+               const struct lttng_event_expr *expr)
+{
+       const char *ret = NULL;
+
+       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD) {
+               goto end;
+       }
+
+       ret = container_of(expr,
+                       const struct lttng_event_expr_app_specific_context_field,
+                       parent)->provider_name;
+
+end:
+       return ret;
+}
+
+const char *lttng_event_expr_app_specific_context_field_get_type_name(
+               const struct lttng_event_expr *expr)
+{
+       const char *ret = NULL;
+
+       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD) {
+               goto end;
+       }
+
+       ret = container_of(expr,
+                       const struct lttng_event_expr_app_specific_context_field,
+                       parent)->type_name;
+
+end:
+       return ret;
+}
+
+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;
+
+       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT) {
+               goto end;
+       }
+
+       ret = container_of(expr,
+                       const struct lttng_event_expr_array_field_element,
+                       parent)->array_field_expr;
+
+end:
+       return ret;
+}
+
+enum lttng_event_expr_status lttng_event_expr_array_field_element_get_index(
+               const struct lttng_event_expr *expr, unsigned int *index)
+{
+       enum lttng_event_expr_status ret = LTTNG_EVENT_EXPR_STATUS_OK;
+
+       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT ||
+                       !index) {
+               ret = LTTNG_EVENT_EXPR_STATUS_INVALID;
+               goto end;
+       }
+
+       *index = container_of(expr,
+                       const struct lttng_event_expr_array_field_element,
+                       parent)->index;
+
+end:
+       return ret;
+}
+
+bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
+               const struct lttng_event_expr *expr_b)
+{
+       bool is_equal = true;
+
+       if (!expr_a && !expr_b) {
+               /* Both `NULL`: equal */
+               goto end;
+       }
+
+       if (!expr_a || !expr_b) {
+               /* Only one `NULL`: not equal */
+               goto not_equal;
+       }
+
+       if (expr_a->type != expr_b->type) {
+               /* Different types: not equal */
+               goto not_equal;
+       }
+
+       switch (expr_a->type) {
+       case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD:
+       case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
+       {
+               const struct lttng_event_expr_field *field_expr_a =
+                               container_of(expr_a,
+                                       const struct lttng_event_expr_field,
+                                       parent);
+               const struct lttng_event_expr_field *field_expr_b =
+                               container_of(expr_b,
+                                       const struct lttng_event_expr_field,
+                                       parent);
+
+               if (strcmp(field_expr_a->name, field_expr_b->name) != 0) {
+                       goto not_equal;
+               }
+
+               break;
+       }
+       case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
+       {
+               const struct lttng_event_expr_app_specific_context_field *field_expr_a =
+                               container_of(expr_a,
+                                       const struct lttng_event_expr_app_specific_context_field,
+                                       parent);
+               const struct lttng_event_expr_app_specific_context_field *field_expr_b =
+                               container_of(expr_b,
+                                       const struct lttng_event_expr_app_specific_context_field,
+                                       parent);
+
+               if (strcmp(field_expr_a->provider_name,
+                               field_expr_b->provider_name) != 0) {
+                       goto not_equal;
+               }
+
+               if (strcmp(field_expr_a->type_name,
+                               field_expr_b->type_name) != 0) {
+                       goto not_equal;
+               }
+
+               break;
+       }
+       case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
+       {
+               const struct lttng_event_expr_array_field_element *elem_expr_a =
+                               container_of(expr_a,
+                                       const struct lttng_event_expr_array_field_element,
+                                       parent);
+               const struct lttng_event_expr_array_field_element *elem_expr_b =
+                               container_of(expr_b,
+                                       const struct lttng_event_expr_array_field_element,
+                                       parent);
+
+               if (!lttng_event_expr_is_equal(elem_expr_a->array_field_expr,
+                               elem_expr_b->array_field_expr)) {
+                       goto not_equal;
+               }
+
+               if (elem_expr_a->index != elem_expr_b->index) {
+                       goto not_equal;
+               }
+
+               break;
+       }
+       default:
+               break;
+       }
+
+       goto end;
+
+not_equal:
+       is_equal = false;
+
+end:
+       return is_equal;
+}
+
+void lttng_event_expr_destroy(struct lttng_event_expr *expr)
+{
+       if (!expr) {
+               goto end;
+       }
+
+       switch (expr->type) {
+       case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD:
+       case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
+       {
+               struct lttng_event_expr_field *field_expr =
+                               container_of(expr,
+                                       struct lttng_event_expr_field, parent);
+
+               free(field_expr->name);
+               break;
+       }
+       case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
+       {
+               struct lttng_event_expr_app_specific_context_field *field_expr =
+                               container_of(expr,
+                                       struct lttng_event_expr_app_specific_context_field,
+                                       parent);
+
+               free(field_expr->provider_name);
+               free(field_expr->type_name);
+               break;
+       }
+       case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
+       {
+               struct lttng_event_expr_array_field_element *elem_expr =
+                               container_of(expr,
+                                       struct lttng_event_expr_array_field_element,
+                                       parent);
+
+               lttng_event_expr_destroy(elem_expr->array_field_expr);
+               break;
+       }
+       default:
+               break;
+       }
+
+       free(expr);
+
+end:
+       return;
+}
index 28aead7ad6cbb72cd7d4f9275cc594d029eece5f..8c271f5efd0a937c98ecfb6fa2ff98b0493018d7 100644 (file)
@@ -9,7 +9,6 @@ lib_LTLIBRARIES = liblttng-ctl.la
 liblttng_ctl_la_SOURCES = lttng-ctl.c snapshot.c lttng-ctl-helper.h \
                lttng-ctl-health.c save.c load.c deprecated-symbols.c \
                channel.c rotate.c event.c destruction-handle.c clear.c \
-               event-expr.c \
                tracker.c
 
 liblttng_ctl_la_LDFLAGS = \
diff --git a/src/lib/lttng-ctl/event-expr.c b/src/lib/lttng-ctl/event-expr.c
deleted file mode 100644 (file)
index 126f0ca..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * event-expr.c
- *
- * Linux Trace Toolkit Control Library
- *
- * Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- */
-
-#define _LGPL_SOURCE
-#include <assert.h>
-#include <stddef.h>
-
-#include <common/error.h>
-#include <common/macros.h>
-#include <lttng/event-expr-internal.h>
-
-enum lttng_event_expr_type lttng_event_expr_get_type(
-               const struct lttng_event_expr *expr)
-{
-       enum lttng_event_expr_type type;
-
-       if (!expr) {
-               type = LTTNG_EVENT_EXPR_TYPE_INVALID;
-               goto end;
-       }
-
-       type = expr->type;
-
-end:
-       return type;
-}
-
-static
-struct lttng_event_expr *create_empty_expr(enum lttng_event_expr_type type,
-               size_t size)
-{
-       struct lttng_event_expr *expr;
-
-       expr = zmalloc(size);
-       if (!expr) {
-               goto end;
-       }
-
-       expr->type = type;
-
-end:
-       return expr;
-}
-
-static
-struct lttng_event_expr_field *create_field_event_expr(
-               enum lttng_event_expr_type type,
-               const char *name)
-{
-       struct lttng_event_expr_field *expr =
-                       container_of(
-                               create_empty_expr(type, sizeof(*expr)),
-                               struct lttng_event_expr_field, parent);
-
-       if (!expr) {
-               goto error;
-       }
-
-       assert(name);
-       expr->name = strdup(name);
-       if (!expr->name) {
-               goto error;
-       }
-
-       goto end;
-
-error:
-       if (expr) {
-               lttng_event_expr_destroy(&expr->parent);
-       }
-       expr = NULL;
-
-end:
-       return expr;
-}
-
-struct lttng_event_expr *lttng_event_expr_event_payload_field_create(
-               const char *field_name)
-{
-       struct lttng_event_expr *expr = NULL;
-
-       if (!field_name) {
-               goto end;
-       }
-
-       expr = &create_field_event_expr(
-                       LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD,
-                       field_name)->parent;
-
-end:
-       return expr;
-}
-
-struct lttng_event_expr *lttng_event_expr_channel_context_field_create(
-               const char *field_name)
-{
-       struct lttng_event_expr *expr = NULL;
-
-       if (!field_name) {
-               goto end;
-       }
-
-       expr = &create_field_event_expr(
-                       LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD,
-                       field_name)->parent;
-
-end:
-       return expr;
-}
-
-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 *ret_parent_expr;
-
-       if (!type_name || !provider_name) {
-               goto error;
-       }
-
-       expr = container_of(create_empty_expr(
-                       LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD,
-                       sizeof(*expr)),
-                       struct lttng_event_expr_app_specific_context_field,
-                       parent);
-       if (!expr) {
-               goto error;
-       }
-
-       expr->provider_name = strdup(provider_name);
-       if (!expr->provider_name) {
-               goto error;
-       }
-
-       expr->type_name = strdup(type_name);
-       if (!expr->type_name) {
-               goto error;
-       }
-
-       ret_parent_expr = &expr->parent;
-       goto end;
-
-error:
-       if (expr) {
-               lttng_event_expr_destroy(&expr->parent);
-       }
-       ret_parent_expr = NULL;
-
-end:
-       return ret_parent_expr;
-}
-
-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 *ret_parent_expr;
-
-       /* The parent array field expression must be an l-value */
-       if (!array_field_expr ||
-                       !lttng_event_expr_is_lvalue(array_field_expr)) {
-               goto error;
-       }
-
-       expr = container_of(create_empty_expr(
-                       LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT,
-                       sizeof(*expr)),
-                       struct lttng_event_expr_array_field_element,
-                       parent);
-       if (!expr) {
-               goto error;
-       }
-
-       expr->array_field_expr = array_field_expr;
-       expr->index = index;
-       ret_parent_expr = &expr->parent;
-       goto end;
-
-error:
-       if (expr) {
-               lttng_event_expr_destroy(&expr->parent);
-       }
-       ret_parent_expr = NULL;
-
-end:
-       return ret_parent_expr;
-}
-
-const char *lttng_event_expr_event_payload_field_get_name(
-               const struct lttng_event_expr *expr)
-{
-       const char *ret = NULL;
-
-       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD) {
-               goto end;
-       }
-
-       ret = container_of(expr,
-                       const struct lttng_event_expr_field, parent)->name;
-
-end:
-       return ret;
-}
-
-const char *lttng_event_expr_channel_context_field_get_name(
-               const struct lttng_event_expr *expr)
-{
-       const char *ret = NULL;
-
-       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD) {
-               goto end;
-       }
-
-       ret = container_of(expr,
-                       const struct lttng_event_expr_field, parent)->name;
-
-end:
-       return ret;
-}
-
-const char *lttng_event_expr_app_specific_context_field_get_provider_name(
-               const struct lttng_event_expr *expr)
-{
-       const char *ret = NULL;
-
-       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD) {
-               goto end;
-       }
-
-       ret = container_of(expr,
-                       const struct lttng_event_expr_app_specific_context_field,
-                       parent)->provider_name;
-
-end:
-       return ret;
-}
-
-const char *lttng_event_expr_app_specific_context_field_get_type_name(
-               const struct lttng_event_expr *expr)
-{
-       const char *ret = NULL;
-
-       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD) {
-               goto end;
-       }
-
-       ret = container_of(expr,
-                       const struct lttng_event_expr_app_specific_context_field,
-                       parent)->type_name;
-
-end:
-       return ret;
-}
-
-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;
-
-       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT) {
-               goto end;
-       }
-
-       ret = container_of(expr,
-                       const struct lttng_event_expr_array_field_element,
-                       parent)->array_field_expr;
-
-end:
-       return ret;
-}
-
-enum lttng_event_expr_status lttng_event_expr_array_field_element_get_index(
-               const struct lttng_event_expr *expr, unsigned int *index)
-{
-       enum lttng_event_expr_status ret = LTTNG_EVENT_EXPR_STATUS_OK;
-
-       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT ||
-                       !index) {
-               ret = LTTNG_EVENT_EXPR_STATUS_INVALID;
-               goto end;
-       }
-
-       *index = container_of(expr,
-                       const struct lttng_event_expr_array_field_element,
-                       parent)->index;
-
-end:
-       return ret;
-}
-
-bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
-               const struct lttng_event_expr *expr_b)
-{
-       bool is_equal = true;
-
-       if (!expr_a && !expr_b) {
-               /* Both `NULL`: equal */
-               goto end;
-       }
-
-       if (!expr_a || !expr_b) {
-               /* Only one `NULL`: not equal */
-               goto not_equal;
-       }
-
-       if (expr_a->type != expr_b->type) {
-               /* Different types: not equal */
-               goto not_equal;
-       }
-
-       switch (expr_a->type) {
-       case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD:
-       case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
-       {
-               const struct lttng_event_expr_field *field_expr_a =
-                               container_of(expr_a,
-                                       const struct lttng_event_expr_field,
-                                       parent);
-               const struct lttng_event_expr_field *field_expr_b =
-                               container_of(expr_b,
-                                       const struct lttng_event_expr_field,
-                                       parent);
-
-               if (strcmp(field_expr_a->name, field_expr_b->name) != 0) {
-                       goto not_equal;
-               }
-
-               break;
-       }
-       case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
-       {
-               const struct lttng_event_expr_app_specific_context_field *field_expr_a =
-                               container_of(expr_a,
-                                       const struct lttng_event_expr_app_specific_context_field,
-                                       parent);
-               const struct lttng_event_expr_app_specific_context_field *field_expr_b =
-                               container_of(expr_b,
-                                       const struct lttng_event_expr_app_specific_context_field,
-                                       parent);
-
-               if (strcmp(field_expr_a->provider_name,
-                               field_expr_b->provider_name) != 0) {
-                       goto not_equal;
-               }
-
-               if (strcmp(field_expr_a->type_name,
-                               field_expr_b->type_name) != 0) {
-                       goto not_equal;
-               }
-
-               break;
-       }
-       case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
-       {
-               const struct lttng_event_expr_array_field_element *elem_expr_a =
-                               container_of(expr_a,
-                                       const struct lttng_event_expr_array_field_element,
-                                       parent);
-               const struct lttng_event_expr_array_field_element *elem_expr_b =
-                               container_of(expr_b,
-                                       const struct lttng_event_expr_array_field_element,
-                                       parent);
-
-               if (!lttng_event_expr_is_equal(elem_expr_a->array_field_expr,
-                               elem_expr_b->array_field_expr)) {
-                       goto not_equal;
-               }
-
-               if (elem_expr_a->index != elem_expr_b->index) {
-                       goto not_equal;
-               }
-
-               break;
-       }
-       default:
-               break;
-       }
-
-       goto end;
-
-not_equal:
-       is_equal = false;
-
-end:
-       return is_equal;
-}
-
-void lttng_event_expr_destroy(struct lttng_event_expr *expr)
-{
-       if (!expr) {
-               goto end;
-       }
-
-       switch (expr->type) {
-       case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD:
-       case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
-       {
-               struct lttng_event_expr_field *field_expr =
-                               container_of(expr,
-                                       struct lttng_event_expr_field, parent);
-
-               free(field_expr->name);
-               break;
-       }
-       case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
-       {
-               struct lttng_event_expr_app_specific_context_field *field_expr =
-                               container_of(expr,
-                                       struct lttng_event_expr_app_specific_context_field,
-                                       parent);
-
-               free(field_expr->provider_name);
-               free(field_expr->type_name);
-               break;
-       }
-       case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
-       {
-               struct lttng_event_expr_array_field_element *elem_expr =
-                               container_of(expr,
-                                       struct lttng_event_expr_array_field_element,
-                                       parent);
-
-               lttng_event_expr_destroy(elem_expr->array_field_expr);
-               break;
-       }
-       default:
-               break;
-       }
-
-       free(expr);
-
-end:
-       return;
-}
This page took 0.035059 seconds and 4 git commands to generate.