projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: remove some unnecessary uses of `GString`
[babeltrace.git]
/
src
/
lib
/
trace-ir
/
stream-class.c
diff --git
a/src/lib/trace-ir/stream-class.c
b/src/lib/trace-ir/stream-class.c
index 08395849b03c9331fde5cfe8b7422d00ccb6f077..c997086101cee2a48707d976beb8fd4ff9d6be4e 100644
(file)
--- a/
src/lib/trace-ir/stream-class.c
+++ b/
src/lib/trace-ir/stream-class.c
@@
-47,12
+47,7
@@
void destroy_stream_class(struct bt_object *obj)
stream_class->event_classes = NULL;
}
stream_class->event_classes = NULL;
}
- if (stream_class->name.str) {
- g_string_free(stream_class->name.str, TRUE);
- stream_class->name.str = NULL;
- stream_class->name.value = NULL;
- }
-
+ g_free(stream_class->name);
BT_LOGD_STR("Putting packet context field class.");
BT_OBJECT_PUT_REF_AND_RESET(stream_class->packet_context_fc);
BT_LOGD_STR("Putting event common context field class.");
BT_LOGD_STR("Putting packet context field class.");
BT_OBJECT_PUT_REF_AND_RESET(stream_class->packet_context_fc);
BT_LOGD_STR("Putting event common context field class.");
@@
-117,12
+112,6
@@
struct bt_stream_class *create_stream_class_with_id(
goto error;
}
goto error;
}
- stream_class->name.str = g_string_new(NULL);
- if (!stream_class->name.str) {
- BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
- goto error;
- }
-
stream_class->id = id;
stream_class->assigns_automatic_event_class_id = true;
stream_class->assigns_automatic_stream_id = true;
stream_class->id = id;
stream_class->assigns_automatic_event_class_id = true;
stream_class->assigns_automatic_stream_id = true;
@@
-203,7
+192,7
@@
BT_EXPORT
const char *bt_stream_class_get_name(const struct bt_stream_class *stream_class)
{
BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class);
const char *bt_stream_class_get_name(const struct bt_stream_class *stream_class)
{
BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class);
- return stream_class->name
.value
;
+ return stream_class->name;
}
BT_EXPORT
}
BT_EXPORT
@@
-215,8
+204,8
@@
enum bt_stream_class_set_name_status bt_stream_class_set_name(
BT_ASSERT_PRE_SC_NON_NULL(stream_class);
BT_ASSERT_PRE_NAME_NON_NULL(name);
BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
BT_ASSERT_PRE_SC_NON_NULL(stream_class);
BT_ASSERT_PRE_NAME_NON_NULL(name);
BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
- g_
string_assign(stream_class->name.str,
name);
- stream_class->name
.value = stream_class->name.str->str
;
+ g_
free(stream_class->
name);
+ stream_class->name
= g_strdup(name)
;
BT_LIB_LOGD("Set stream class's name: %!+S", stream_class);
return BT_FUNC_STATUS_OK;
}
BT_LIB_LOGD("Set stream class's name: %!+S", stream_class);
return BT_FUNC_STATUS_OK;
}
This page took
0.024515 seconds
and
4
git commands to generate.