X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Fclock-class.c;h=10030155b5c1ece5ad791f803bfae618c0d13f99;hb=HEAD;hp=aee031d5ceff3f888cfcec4489c2344e8733fc9e;hpb=ecd7492f21a492b70569d5ecc1d3a808241b63f0;p=babeltrace.git diff --git a/src/lib/trace-ir/clock-class.c b/src/lib/trace-ir/clock-class.c index aee031d5..886501ec 100644 --- a/src/lib/trace-ir/clock-class.c +++ b/src/lib/trace-ir/clock-class.c @@ -16,7 +16,6 @@ #include "utils.h" #include "compat/compiler.h" #include -#include "compat/string.h" #include #include #include "lib/object.h" @@ -36,18 +35,8 @@ void destroy_clock_class(struct bt_object *obj) BT_LIB_LOGD("Destroying clock class: %!+K", clock_class); BT_OBJECT_PUT_REF_AND_RESET(clock_class->user_attributes); - if (clock_class->name.str) { - g_string_free(clock_class->name.str, TRUE); - clock_class->name.str = NULL; - clock_class->name.value = NULL; - } - - if (clock_class->description.str) { - g_string_free(clock_class->description.str, TRUE); - clock_class->description.str = NULL; - clock_class->description.value = NULL; - } - + g_free(clock_class->name); + g_free(clock_class->description); bt_object_pool_finalize(&clock_class->cs_pool); g_free(clock_class); } @@ -92,18 +81,6 @@ struct bt_clock_class *bt_clock_class_create(bt_self_component *self_comp) goto error; } - clock_class->name.str = g_string_new(NULL); - if (!clock_class->name.str) { - BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString."); - goto error; - } - - clock_class->description.str = g_string_new(NULL); - if (!clock_class->description.str) { - BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString."); - goto error; - } - clock_class->frequency = UINT64_C(1000000000); clock_class->origin_is_unix_epoch = BT_TRUE; set_base_offset(clock_class); @@ -133,7 +110,7 @@ BT_EXPORT const char *bt_clock_class_get_name(const struct bt_clock_class *clock_class) { BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); - return clock_class->name.value; + return clock_class->name; } BT_EXPORT @@ -144,8 +121,8 @@ enum bt_clock_class_set_name_status bt_clock_class_set_name( BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); - g_string_assign(clock_class->name.str, name); - clock_class->name.value = clock_class->name.str->str; + g_free(clock_class->name); + clock_class->name = g_strdup(name); BT_LIB_LOGD("Set clock class's name: %!+K", clock_class); return BT_FUNC_STATUS_OK; } @@ -155,7 +132,7 @@ const char *bt_clock_class_get_description( const struct bt_clock_class *clock_class) { BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); - return clock_class->description.value; + return clock_class->description; } BT_EXPORT @@ -166,8 +143,8 @@ enum bt_clock_class_set_description_status bt_clock_class_set_description( BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DESCR_NON_NULL(descr); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); - g_string_assign(clock_class->description.str, descr); - clock_class->description.value = clock_class->description.str->str; + g_free(clock_class->description); + clock_class->description = g_strdup(descr); BT_LIB_LOGD("Set clock class's description: %!+K", clock_class); return BT_FUNC_STATUS_OK;