#include "common/assert.h"
#include "common/common.h"
#include <glib.h>
+#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
static
struct field_class_stack_frame *field_class_stack_peek(field_class_stack *stack)
{
- struct field_class_stack_frame *entry = NULL;
+ BT_ASSERT(stack);
+ BT_ASSERT(!field_class_stack_empty(stack));
- if (!stack || field_class_stack_empty(stack)) {
- goto end;
- }
-
- entry = g_ptr_array_index(stack, stack->len - 1);
-end:
- return entry;
+ return g_ptr_array_index(stack, stack->len - 1);
}
/*
struct field_class_stack_frame *field_class_stack_at(field_class_stack *stack,
size_t index)
{
- struct field_class_stack_frame *entry = NULL;
-
- if (!stack || index >= stack->len) {
- goto end;
- }
-
- entry = g_ptr_array_index(stack, index);
+ BT_ASSERT(stack);
+ BT_ASSERT(index < stack->len);
-end:
- return entry;
+ return g_ptr_array_index(stack, index);
}
/*
case CTF_SCOPE_EVENT_PAYLOAD:
return ctx->scopes.event_payload;
default:
- abort();
+ bt_common_abort();
}
return NULL;
break;
default:
- abort();
+ bt_common_abort();
}
/* Skip absolute path tokens */
if (BT_LOG_ON_TRACE && ret == 0) {
GString *field_path_pretty = ctf_field_path_string(field_path);
const char *field_path_pretty_str =
- field_path_pretty ? field_path_pretty->str : NULL;
+ field_path_pretty ? field_path_pretty->str : "(null)";
BT_COMP_LOGD("Found field path: path=\"%s\", field-path=\"%s\"",
pathstr, field_path_pretty_str);
* Returns the index of the lowest common ancestor of two field path
* objects having the same root scope.
*/
+static
int64_t get_field_paths_lca_index(struct ctf_field_path *field_path1,
struct ctf_field_path *field_path2,
struct resolve_context *ctx)
GString *field_path2_pretty =
ctf_field_path_string(field_path2);
const char *field_path1_pretty_str =
- field_path1_pretty ? field_path1_pretty->str : NULL;
+ field_path1_pretty ? field_path1_pretty->str : "(null)";
const char *field_path2_pretty_str =
- field_path2_pretty ? field_path2_pretty->str : NULL;
+ field_path2_pretty ? field_path2_pretty->str : "(null)";
BT_COMP_LOGD("Finding lowest common ancestor (LCA) between two field paths: "
"field-path-1=\"%s\", field-path-2=\"%s\"",
break;
}
default:
- abort();
+ bt_common_abort();
}
end:
break;
}
default:
- abort();
+ bt_common_abort();
}
if (!pathstr) {
break;
}
default:
- abort();
+ bt_common_abort();
}
end:
}
ctx->scopes.event_common_context = sc->event_common_context_fc;
- ret = resolve_root_class(CTF_SCOPE_EVENT_SPECIFIC_CONTEXT, ctx);
+ ret = resolve_root_class(CTF_SCOPE_EVENT_COMMON_CONTEXT, ctx);
if (ret) {
BT_COMP_LOGE("Cannot resolve event common context field class: "
"ret=%d", ret);