X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=lib%2Fctf-ir%2Ffield-path.c;h=d9893059e4bb8001e3e2ae14269dd71191542f9f;hb=3fea54f69edd1780566230255da196cb6e82df62;hp=ac42ef5cc481de6d61dd98e689cdc6c10dc26d0e;hpb=331b8d44fe96f3a5e5d8a177e0eebda9838ac8d5;p=babeltrace.git diff --git a/lib/ctf-ir/field-path.c b/lib/ctf-ir/field-path.c index ac42ef5c..d9893059 100644 --- a/lib/ctf-ir/field-path.c +++ b/lib/ctf-ir/field-path.c @@ -35,12 +35,13 @@ #include #include #include +#include #include static void field_path_destroy(struct bt_object *obj) { - struct bt_ctf_field_path *field_path = (struct bt_ctf_field_path *) obj; + struct bt_field_path *field_path = (struct bt_field_path *) obj; BT_LOGD("Destroying field path: addr=%p", obj); @@ -55,20 +56,20 @@ void field_path_destroy(struct bt_object *obj) } BT_HIDDEN -struct bt_ctf_field_path *bt_ctf_field_path_create(void) +struct bt_field_path *bt_field_path_create(void) { - struct bt_ctf_field_path *field_path = NULL; + struct bt_field_path *field_path = NULL; BT_LOGD_STR("Creating empty field path object."); - field_path = g_new0(struct bt_ctf_field_path, 1); + field_path = g_new0(struct bt_field_path, 1); if (!field_path) { BT_LOGE_STR("Failed to allocate one field path."); goto error; } - bt_object_init(field_path, field_path_destroy); - field_path->root = BT_CTF_SCOPE_UNKNOWN; + bt_object_init_shared(&field_path->base, field_path_destroy); + field_path->root = BT_SCOPE_UNKNOWN; field_path->indexes = g_array_new(TRUE, FALSE, sizeof(int)); if (!field_path->indexes) { BT_LOGE_STR("Failed to allocate a GArray."); @@ -84,7 +85,7 @@ error: } BT_HIDDEN -void bt_ctf_field_path_clear(struct bt_ctf_field_path *field_path) +void bt_field_path_clear(struct bt_field_path *field_path) { if (field_path->indexes->len > 0) { g_array_remove_range(field_path->indexes, 0, @@ -93,15 +94,15 @@ void bt_ctf_field_path_clear(struct bt_ctf_field_path *field_path) } BT_HIDDEN -struct bt_ctf_field_path *bt_ctf_field_path_copy( - struct bt_ctf_field_path *path) +struct bt_field_path *bt_field_path_copy( + struct bt_field_path *path) { - struct bt_ctf_field_path *new_path; + struct bt_field_path *new_path; - assert(path); + BT_ASSERT(path); BT_LOGD("Copying field path: addr=%p, index-count=%u", path, path->indexes->len); - new_path = bt_ctf_field_path_create(); + new_path = bt_field_path_create(); if (!new_path) { BT_LOGE_STR("Cannot create empty field path."); goto end; @@ -116,10 +117,10 @@ end: return new_path; } -enum bt_ctf_scope bt_ctf_field_path_get_root_scope( - const struct bt_ctf_field_path *field_path) +enum bt_scope bt_field_path_get_root_scope( + const struct bt_field_path *field_path) { - enum bt_ctf_scope scope = BT_CTF_SCOPE_UNKNOWN; + enum bt_scope scope = BT_SCOPE_UNKNOWN; if (!field_path) { BT_LOGW_STR("Invalid parameter: field path is NULL."); @@ -132,8 +133,8 @@ end: return scope; } -int64_t bt_ctf_field_path_get_index_count( - const struct bt_ctf_field_path *field_path) +int64_t bt_field_path_get_index_count( + const struct bt_field_path *field_path) { int64_t count = (int64_t) -1; @@ -148,7 +149,7 @@ end: return count; } -int bt_ctf_field_path_get_index(const struct bt_ctf_field_path *field_path, +int bt_field_path_get_index(const struct bt_field_path *field_path, uint64_t index) { int ret = INT_MIN; @@ -170,29 +171,3 @@ int bt_ctf_field_path_get_index(const struct bt_ctf_field_path *field_path, end: return ret; } - -BT_HIDDEN -GString *bt_ctf_field_path_string(struct bt_ctf_field_path *path) -{ - GString *str = g_string_new(NULL); - size_t i; - - assert(path); - - if (!str) { - goto end; - } - - g_string_append_printf(str, "[%s", bt_ctf_scope_string(path->root)); - - for (i = 0; i < path->indexes->len; i++) { - int index = g_array_index(path->indexes, int, i); - - g_string_append_printf(str, ", %d", index); - } - - g_string_append(str, "]"); - -end: - return str; -}