projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sessiond: main.cpp: iterate on list using list_iteration_adapter
[lttng-tools.git]
/
src
/
common
/
event-expr
/
event-expr.cpp
diff --git
a/src/common/event-expr/event-expr.cpp
b/src/common/event-expr/event-expr.cpp
index e80fb1d5df4d269627847bb0ccb74f7d246fb666..221d8e6cbf9518290026dd57b213b302b887c495 100644
(file)
--- a/
src/common/event-expr/event-expr.cpp
+++ b/
src/common/event-expr/event-expr.cpp
@@
-8,18
+8,18
@@
*/
#define _LGPL_SOURCE
*/
#define _LGPL_SOURCE
-#include <stddef.h>
+#include <common/bytecode/bytecode.hpp>
+#include <common/error.hpp>
+#include <common/macros.hpp>
+#include <common/mi-lttng.hpp>
-#include <common/bytecode/bytecode.h>
-#include <common/error.h>
-#include <common/macros.h>
-#include <common/mi-lttng.h>
-#include <lttng/event-expr-internal.h>
+#include <lttng/event-expr-internal.hpp>
#include <lttng/event-expr.h>
#include <lttng/event-expr.h>
+
+#include <stddef.h>
#include <stdio.h>
#include <stdio.h>
-enum lttng_event_expr_type lttng_event_expr_get_type(
- const struct lttng_event_expr *expr)
+enum lttng_event_expr_type lttng_event_expr_get_type(const struct lttng_event_expr *expr)
{
enum lttng_event_expr_type type;
{
enum lttng_event_expr_type type;
@@
-34,13
+34,11
@@
end:
return type;
}
return type;
}
-static
-struct lttng_event_expr *create_empty_expr(enum lttng_event_expr_type type,
- size_t size)
+static struct lttng_event_expr *create_empty_expr(enum lttng_event_expr_type type, size_t size)
{
struct lttng_event_expr *expr;
{
struct lttng_event_expr *expr;
- expr =
(lttng_event_expr *) zmalloc
(size);
+ expr =
zmalloc<lttng_event_expr>
(size);
if (!expr) {
goto end;
}
if (!expr) {
goto end;
}
@@
-51,15
+49,11
@@
end:
return expr;
}
return expr;
}
-static
-struct lttng_event_expr_field *create_field_event_expr(
- enum lttng_event_expr_type type,
- const char *name)
+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);
+ struct lttng_event_expr_field *expr = lttng::utils::container_of(
+ create_empty_expr(type, sizeof(*expr)), <tng_event_expr_field::parent);
if (!expr) {
goto error;
if (!expr) {
goto error;
@@
-77,61
+71,55
@@
error:
if (expr) {
lttng_event_expr_destroy(&expr->parent);
}
if (expr) {
lttng_event_expr_destroy(&expr->parent);
}
- expr =
NULL
;
+ expr =
nullptr
;
end:
return expr;
}
end:
return expr;
}
-struct lttng_event_expr *lttng_event_expr_event_payload_field_create(
- const char *field_name)
+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;
}
if (!field_name) {
goto end;
}
- expr = &create_field_event_expr(
- LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD,
- field_name)->parent;
+ expr = &create_field_event_expr(LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD, field_name)
+ ->parent;
end:
return expr;
}
end:
return expr;
}
-struct lttng_event_expr *lttng_event_expr_channel_context_field_create(
- const char *field_name)
+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;
}
if (!field_name) {
goto end;
}
- expr = &create_field_event_expr(
- LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD,
- field_name)->parent;
+ expr = &create_field_event_expr(LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD, field_name)
+ ->parent;
end:
return expr;
}
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 *
+
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) {
goto error;
}
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);
+ expr = lttng::utils::container_of(
+ create_empty_expr(LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD, sizeof(*expr)),
+ <tng_event_expr_app_specific_context_field::parent);
if (!expr) {
goto error;
}
if (!expr) {
goto error;
}
@@
-153,30
+141,27
@@
error:
if (expr) {
lttng_event_expr_destroy(&expr->parent);
}
if (expr) {
lttng_event_expr_destroy(&expr->parent);
}
- ret_parent_expr =
NULL
;
+ ret_parent_expr =
nullptr
;
end:
return ret_parent_expr;
}
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 *
+
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 */
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)) {
+ if (!array_field_expr || !lttng_event_expr_is_lvalue(array_field_expr)) {
goto error;
}
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);
+ expr = lttng::utils::container_of(
+ create_empty_expr(LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT, sizeof(*expr)),
+ <tng_event_expr_array_field_element::parent);
if (!expr) {
goto error;
}
if (!expr) {
goto error;
}
@@
-187,117
+172,108
@@
struct lttng_event_expr *lttng_event_expr_array_field_element_create(
goto end;
error:
goto end;
error:
- ret_parent_expr =
NULL
;
+ ret_parent_expr =
nullptr
;
end:
return ret_parent_expr;
}
end:
return ret_parent_expr;
}
-const char *lttng_event_expr_event_payload_field_get_name(
- const struct lttng_event_expr *expr)
+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;
}
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;
+ ret = lttng::utils::container_of(expr, <tng_event_expr_field::parent)->name;
end:
return ret;
}
end:
return ret;
}
-const char *lttng_event_expr_channel_context_field_get_name(
- const struct lttng_event_expr *expr)
+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;
}
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;
+ ret = lttng::utils::container_of(expr, <tng_event_expr_field::parent)->name;
end:
return ret;
}
end:
return ret;
}
-const char *
lttng_event_expr_app_specific_context_field_get_provider_name(
-
const struct lttng_event_expr *expr)
+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;
}
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;
+ ret = lttng::utils::container_of(expr, <tng_event_expr_app_specific_context_field::parent)
+ ->provider_name;
end:
return ret;
}
end:
return ret;
}
-const char *
lttng_event_expr_app_specific_context_field_get_type_name(
-
const struct lttng_event_expr *expr)
+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;
}
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;
+ ret = lttng::utils::container_of(expr, <tng_event_expr_app_specific_context_field::parent)
+ ->type_name;
end:
return ret;
}
const struct lttng_event_expr *
end:
return ret;
}
const struct lttng_event_expr *
-lttng_event_expr_array_field_element_get_parent_expr(
- const struct lttng_event_expr *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;
}
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;
+ ret = lttng::utils::container_of(expr, <tng_event_expr_array_field_element::parent)
+ ->array_field_expr;
end:
return ret;
}
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
+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;
{
enum lttng_event_expr_status ret = LTTNG_EVENT_EXPR_STATUS_OK;
- if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT ||
- !index) {
+ if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT || !index) {
ret = LTTNG_EVENT_EXPR_STATUS_INVALID;
goto end;
}
ret = LTTNG_EVENT_EXPR_STATUS_INVALID;
goto end;
}
- *index = container_of(expr,
- const struct lttng_event_expr_array_field_element,
- parent)->index;
+ *index = lttng::utils::container_of(expr, <tng_event_expr_array_field_element::parent)
+ ->index;
end:
return ret;
}
bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
end:
return ret;
}
bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
- const struct lttng_event_expr *expr_b)
+
const struct lttng_event_expr *expr_b)
{
bool is_equal = true;
{
bool is_equal = true;
@@
-321,13
+297,9
@@
bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
{
const struct lttng_event_expr_field *field_expr_a =
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);
+ lttng::utils::container_of(expr_a, <tng_event_expr_field::parent);
const struct lttng_event_expr_field *field_expr_b =
const struct lttng_event_expr_field *field_expr_b =
- container_of(expr_b,
- const struct lttng_event_expr_field,
- parent);
+ lttng::utils::container_of(expr_b, <tng_event_expr_field::parent);
if (strcmp(field_expr_a->name, field_expr_b->name) != 0) {
goto not_equal;
if (strcmp(field_expr_a->name, field_expr_b->name) != 0) {
goto not_equal;
@@
-338,21
+310,17
@@
bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
{
const struct lttng_event_expr_app_specific_context_field *field_expr_a =
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);
+ lttng::utils::container_of(
+ expr_a, <tng_event_expr_app_specific_context_field::parent);
const struct lttng_event_expr_app_specific_context_field *field_expr_b =
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);
+ lttng::utils::container_of(
+ expr_b, <tng_event_expr_app_specific_context_field::parent);
- if (strcmp(field_expr_a->provider_name,
- field_expr_b->provider_name) != 0) {
+ if (strcmp(field_expr_a->provider_name, field_expr_b->provider_name) != 0) {
goto not_equal;
}
goto not_equal;
}
- if (strcmp(field_expr_a->type_name,
- field_expr_b->type_name) != 0) {
+ if (strcmp(field_expr_a->type_name, field_expr_b->type_name) != 0) {
goto not_equal;
}
goto not_equal;
}
@@
-361,16
+329,14
@@
bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
{
const struct lttng_event_expr_array_field_element *elem_expr_a =
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);
+ lttng::utils::container_of(expr_a,
+ <tng_event_expr_array_field_element::parent);
const struct lttng_event_expr_array_field_element *elem_expr_b =
const struct lttng_event_expr_array_field_element *elem_expr_b =
- container_of(expr_b,
- const struct lttng_event_expr_array_field_element,
- parent);
+ lttng::utils::container_of(expr_b,
+ <tng_event_expr_array_field_element::parent);
if (!lttng_event_expr_is_equal(elem_expr_a->array_field_expr,
if (!lttng_event_expr_is_equal(elem_expr_a->array_field_expr,
- elem_expr_b->array_field_expr)) {
+
elem_expr_b->array_field_expr)) {
goto not_equal;
}
goto not_equal;
}
@@
-404,8
+370,7
@@
void lttng_event_expr_destroy(struct lttng_event_expr *expr)
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
{
struct lttng_event_expr_field *field_expr =
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
{
struct lttng_event_expr_field *field_expr =
- container_of(expr,
- struct lttng_event_expr_field, parent);
+ lttng::utils::container_of(expr, <tng_event_expr_field::parent);
free(field_expr->name);
break;
free(field_expr->name);
break;
@@
-413,9
+378,8
@@
void lttng_event_expr_destroy(struct lttng_event_expr *expr)
case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
{
struct lttng_event_expr_app_specific_context_field *field_expr =
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);
+ lttng::utils::container_of(
+ expr, <tng_event_expr_app_specific_context_field::parent);
free(field_expr->provider_name);
free(field_expr->type_name);
free(field_expr->provider_name);
free(field_expr->type_name);
@@
-423,10
+387,8
@@
void lttng_event_expr_destroy(struct lttng_event_expr *expr)
}
case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
{
}
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);
+ struct lttng_event_expr_array_field_element *elem_expr = lttng::utils::container_of(
+ expr, <tng_event_expr_array_field_element::parent);
lttng_event_expr_destroy(elem_expr->array_field_expr);
break;
lttng_event_expr_destroy(elem_expr->array_field_expr);
break;
@@
-442,8
+404,8
@@
end:
}
static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
}
static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
- struct lttng_bytecode_alloc **bytecode,
- struct lttng_bytecode_alloc **bytecode_reloc)
+
struct lttng_bytecode_alloc **bytecode,
+
struct lttng_bytecode_alloc **bytecode_reloc)
{
int status;
enum lttng_event_expr_status event_expr_status;
{
int status;
enum lttng_event_expr_status event_expr_status;
@@
-466,8
+428,7
@@
static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
goto end;
}
goto end;
}
- status = bytecode_push_get_symbol(
- bytecode, bytecode_reloc, name);
+ status = bytecode_push_get_symbol(bytecode, bytecode_reloc, name);
if (status) {
ERR("Failed to push 'get symbol %s' in bytecode", name);
goto end;
if (status) {
ERR("Failed to push 'get symbol %s' in bytecode", name);
goto end;
@@
-492,8
+453,7
@@
static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
goto end;
}
goto end;
}
- status = bytecode_push_get_symbol(
- bytecode, bytecode_reloc, name);
+ status = bytecode_push_get_symbol(bytecode, bytecode_reloc, name);
if (status) {
ERR("Failed to push 'get symbol %s' in bytecode", name);
goto end;
if (status) {
ERR("Failed to push 'get symbol %s' in bytecode", name);
goto end;
@@
-504,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;
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);
const char *provider_name, *type_name;
status = bytecode_push_get_app_context_root(bytecode);
@@
-513,16
+473,14
@@
static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
goto end;
}
goto end;
}
- provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(
- expr);
+ provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(expr);
if (!provider_name) {
ERR("Failed to get application context provider name from event expression");
status = -1;
goto end;
}
if (!provider_name) {
ERR("Failed to get application context provider name from event expression");
status = -1;
goto end;
}
- type_name = lttng_event_expr_app_specific_context_field_get_type_name(
- expr);
+ type_name = lttng_event_expr_app_specific_context_field_get_type_name(expr);
if (!type_name) {
ERR("Failed to get application context type name from event expression");
status = -1;
if (!type_name) {
ERR("Failed to get application context type name from event expression");
status = -1;
@@
-535,17
+493,18
@@
static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
ret = asprintf(&name, "%s:%s", provider_name, type_name);
if (ret < 0) {
PERROR("Failed to format application specific context: provider_name = '%s', type_name = '%s'",
ret = asprintf(&name, "%s:%s", provider_name, type_name);
if (ret < 0) {
PERROR("Failed to format application specific context: provider_name = '%s', type_name = '%s'",
- provider_name, type_name);
+ provider_name,
+ type_name);
status = -1;
goto end;
}
status = -1;
goto end;
}
- status = bytecode_push_get_symbol(
- bytecode, bytecode_reloc, name);
+ status = bytecode_push_get_symbol(bytecode, bytecode_reloc, name);
free(name);
if (status) {
ERR("Failed to push 'get symbol %s:%s' in bytecode",
free(name);
if (status) {
ERR("Failed to push 'get symbol %s:%s' in bytecode",
- provider_name, type_name);
+ provider_name,
+ type_name);
goto end;
}
goto end;
}
@@
-556,23
+515,19
@@
static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
unsigned int index;
const struct lttng_event_expr *parent;
unsigned int index;
const struct lttng_event_expr *parent;
- parent = lttng_event_expr_array_field_element_get_parent_expr(
- expr);
+ parent = lttng_event_expr_array_field_element_get_parent_expr(expr);
if (!parent) {
ERR("Failed to get parent expression from array event expression");
status = -1;
goto end;
}
if (!parent) {
ERR("Failed to get parent expression from array event expression");
status = -1;
goto end;
}
- status = event_expr_to_bytecode_recursive(
- parent, bytecode, bytecode_reloc);
+ status = event_expr_to_bytecode_recursive(parent, bytecode, bytecode_reloc);
if (status) {
goto end;
}
if (status) {
goto end;
}
- event_expr_status =
- lttng_event_expr_array_field_element_get_index(
- expr, &index);
+ event_expr_status = lttng_event_expr_array_field_element_get_index(expr, &index);
if (event_expr_status != LTTNG_EVENT_EXPR_STATUS_OK) {
ERR("Failed to get array field element index from event expression");
status = -1;
if (event_expr_status != LTTNG_EVENT_EXPR_STATUS_OK) {
ERR("Failed to get array field element index from event expression");
status = -1;
@@
-597,12
+552,12
@@
end:
}
int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
}
int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
- struct lttng_bytecode **bytecode_out)
+
struct lttng_bytecode **bytecode_out)
{
int status;
struct return_op ret_insn;
{
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) {
status = bytecode_init(&bytecode);
if (status) {
@@
-616,8
+571,7
@@
int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
goto end;
}
goto end;
}
- status = event_expr_to_bytecode_recursive(
- expr, &bytecode, &bytecode_reloc);
+ status = event_expr_to_bytecode_recursive(expr, &bytecode, &bytecode_reloc);
if (status) {
/* Errors already logged. */
goto end;
if (status) {
/* Errors already logged. */
goto end;
@@
-628,8
+582,8
@@
int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
/* Append symbol table to bytecode. */
bytecode->b.reloc_table_offset = bytecode_get_len(&bytecode->b);
/* Append symbol table to bytecode. */
bytecode->b.reloc_table_offset = bytecode_get_len(&bytecode->b);
- status = bytecode_push(
&bytecode, bytecode_reloc->b.data, 1,
-
bytecode_get_len(&bytecode_reloc->b));
+ status = bytecode_push(
+
&bytecode, bytecode_reloc->b.data, 1,
bytecode_get_len(&bytecode_reloc->b));
if (status) {
ERR("Failed to push symbol table to bytecode");
goto end;
if (status) {
ERR("Failed to push symbol table to bytecode");
goto end;
@@
-654,14
+608,13
@@
end:
return status;
}
return status;
}
-static
-enum lttng_error_code lttng_event_expr_event_payload_field_mi_serialize(
- const struct lttng_event_expr *expression,
- struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_event_payload_field_mi_serialize(const struct lttng_event_expr *expression,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
- const char *name =
NULL
;
+ const char *name =
nullptr
;
LTTNG_ASSERT(expression);
LTTNG_ASSERT(writer);
LTTNG_ASSERT(expression);
LTTNG_ASSERT(writer);
@@
-671,15
+624,13
@@
enum lttng_error_code lttng_event_expr_event_payload_field_mi_serialize(
LTTNG_ASSERT(name);
/* Open event expr payload field element. */
LTTNG_ASSERT(name);
/* Open event expr payload field element. */
- ret = mi_lttng_writer_open_element(
- writer, mi_lttng_element_event_expr_payload_field);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_expr_payload_field);
if (ret) {
goto mi_error;
}
/* Name. */
if (ret) {
goto mi_error;
}
/* Name. */
- ret = mi_lttng_writer_write_element_string(
- writer, config_element_name, name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
if (ret) {
goto mi_error;
}
if (ret) {
goto mi_error;
}
@@
-699,14
+650,13
@@
end:
return ret_code;
}
return ret_code;
}
-static
-enum lttng_error_code lttng_event_expr_channel_context_field_mi_serialize(
- const struct lttng_event_expr *expression,
- struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_channel_context_field_mi_serialize(const struct lttng_event_expr *expression,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
- const char *name =
NULL
;
+ const char *name =
nullptr
;
LTTNG_ASSERT(expression);
LTTNG_ASSERT(writer);
LTTNG_ASSERT(expression);
LTTNG_ASSERT(writer);
@@
-717,14
+667,13
@@
enum lttng_error_code lttng_event_expr_channel_context_field_mi_serialize(
/* Open event expr channel context field element. */
ret = mi_lttng_writer_open_element(writer,
/* Open event expr channel context field element. */
ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_event_expr_channel_context_field);
+
mi_lttng_element_event_expr_channel_context_field);
if (ret) {
goto mi_error;
}
/* Name. */
if (ret) {
goto mi_error;
}
/* Name. */
- ret = mi_lttng_writer_write_element_string(
- writer, config_element_name, name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
if (ret) {
goto mi_error;
}
if (ret) {
goto mi_error;
}
@@
-744,47
+693,42
@@
end:
return ret_code;
}
return ret_code;
}
-static
-enum lttng_error_code lttng_event_expr_app_specific_context_field_mi_serialize(
- const struct lttng_event_expr *expression,
- struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_app_specific_context_field_mi_serialize(const struct lttng_event_expr *expression,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
{
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);
LTTNG_ASSERT(expression);
LTTNG_ASSERT(writer);
- LTTNG_ASSERT(expression->type ==
- LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD);
+ LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD);
- provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(
- expression);
+ provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(expression);
LTTNG_ASSERT(provider_name);
LTTNG_ASSERT(provider_name);
- type_name = lttng_event_expr_app_specific_context_field_get_type_name(
- expression);
+ type_name = lttng_event_expr_app_specific_context_field_get_type_name(expression);
LTTNG_ASSERT(provider_name);
/* Open event expr app specific context field element. */
ret = mi_lttng_writer_open_element(writer,
LTTNG_ASSERT(provider_name);
/* Open event expr app specific context field element. */
ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_event_expr_app_specific_context_field);
+
mi_lttng_element_event_expr_app_specific_context_field);
if (ret) {
goto mi_error;
}
/* Provider name. */
if (ret) {
goto mi_error;
}
/* Provider name. */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_event_expr_provider_name,
- provider_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_event_expr_provider_name, provider_name);
if (ret) {
goto mi_error;
}
/* Type name. */
if (ret) {
goto mi_error;
}
/* Type name. */
- ret = mi_lttng_writer_write_element_string(
writer,
-
mi_lttng_element_event_expr_type_name, type_name);
+ ret = mi_lttng_writer_write_element_string(
+
writer,
mi_lttng_element_event_expr_type_name, type_name);
if (ret) {
goto mi_error;
}
if (ret) {
goto mi_error;
}
@@
-804,39
+748,35
@@
end:
return ret_code;
}
return ret_code;
}
-static
-enum lttng_error_code lttng_event_expr_array_field_element_mi_serialize(
- const struct lttng_event_expr *expression,
- struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_array_field_element_mi_serialize(const struct lttng_event_expr *expression,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
enum lttng_event_expr_status status;
{
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);
LTTNG_ASSERT(writer);
LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT);
unsigned int index;
LTTNG_ASSERT(expression);
LTTNG_ASSERT(writer);
LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT);
- status = lttng_event_expr_array_field_element_get_index(
- expression, &index);
+ status = lttng_event_expr_array_field_element_get_index(expression, &index);
LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
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);
+ parent_expr = lttng_event_expr_array_field_element_get_parent_expr(expression);
+ LTTNG_ASSERT(parent_expr != nullptr);
/* Open event expr array field element. */
/* Open event expr array field element. */
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_event_expr_array_field_element);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_expr_array_field_element);
if (ret) {
goto mi_error;
}
/* Index. */
ret = mi_lttng_writer_write_element_unsigned_int(
if (ret) {
goto mi_error;
}
/* Index. */
ret = mi_lttng_writer_write_element_unsigned_int(
-
writer, mi_lttng_element_event_expr_index, index);
+ writer, mi_lttng_element_event_expr_index, index);
if (ret) {
goto mi_error;
}
if (ret) {
goto mi_error;
}
@@
-862,9
+802,8
@@
end:
return ret_code;
}
return ret_code;
}
-enum lttng_error_code lttng_event_expr_mi_serialize(
- const struct lttng_event_expr *expression,
- struct mi_writer *writer)
+enum lttng_error_code lttng_event_expr_mi_serialize(const struct lttng_event_expr *expression,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
@@
-879,20
+818,17
@@
enum lttng_error_code lttng_event_expr_mi_serialize(
switch (expression->type) {
case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD:
switch (expression->type) {
case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD:
- ret_code = lttng_event_expr_event_payload_field_mi_serialize(
- expression, writer);
+ ret_code = lttng_event_expr_event_payload_field_mi_serialize(expression, writer);
break;
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
break;
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
- ret_code = lttng_event_expr_channel_context_field_mi_serialize(
- expression, writer);
+ ret_code = lttng_event_expr_channel_context_field_mi_serialize(expression, writer);
break;
case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
break;
case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
- ret_code = lttng_event_expr_app_specific_context_field_mi_serialize(
-
expression,
writer);
+ ret_code = lttng_event_expr_app_specific_context_field_mi_serialize(
expression,
+
writer);
break;
case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
break;
case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
- ret_code = lttng_event_expr_array_field_element_mi_serialize(
- expression, writer);
+ ret_code = lttng_event_expr_array_field_element_mi_serialize(expression, writer);
break;
default:
abort();
break;
default:
abort();
This page took
0.039083 seconds
and
4
git commands to generate.