X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=lib%2Fctf-ir%2Fstream.c;h=4c6bda2653166a2044de3ecce530083472f85efc;hb=d975f66c5dcfc7eade13db3edbc975d2055dfe4b;hp=c5c1f19a0777d48c05a599d89beb89b893bc78b2;hpb=f42867e2d049c1e7cad50cd097290a3adef8d54c;p=babeltrace.git diff --git a/lib/ctf-ir/stream.c b/lib/ctf-ir/stream.c index c5c1f19a..4c6bda26 100644 --- a/lib/ctf-ir/stream.c +++ b/lib/ctf-ir/stream.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -1210,17 +1211,8 @@ struct bt_stream *bt_stream_create( struct bt_stream_class *bt_stream_get_class( struct bt_stream *stream) { - struct bt_stream_class *stream_class = NULL; - - if (!stream) { - BT_LOGW_STR("Invalid parameter: stream is NULL."); - goto end; - } - - stream_class = stream->stream_class; - bt_get(stream_class); -end: - return stream_class; + BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + return bt_get(stream->stream_class); } int bt_stream_get_discarded_events_count( @@ -2075,17 +2067,8 @@ int try_set_structure_field_integer(struct bt_field *structure, char *name, const char *bt_stream_get_name(struct bt_stream *stream) { - const char *name = NULL; - - if (!stream) { - BT_LOGW_STR("Invalid parameter: stream is NULL."); - goto end; - } - - name = stream->name ? stream->name->str : NULL; - -end: - return name; + BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + return stream->name ? stream->name->str : NULL; } int bt_stream_is_writer(struct bt_stream *stream) @@ -2148,18 +2131,12 @@ int64_t bt_stream_get_id(struct bt_stream *stream) { int64_t ret; - if (!stream) { - BT_LOGW_STR("Invalid parameter: stream is NULL."); - ret = (int64_t) -1; - goto end; - } - + BT_ASSERT_PRE_NON_NULL(stream, "Stream"); ret = stream->id; if (ret < 0) { BT_LOGV("Stream's ID is not set: addr=%p, name=\"%s\"", stream, bt_stream_get_name(stream)); } -end: return ret; }