From: Julien Desfossez Date: Wed, 14 Jun 2017 18:23:43 +0000 (-0400) Subject: copytrace: packet_context is optional X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=cfb74f3de463dfeffacda5313d75d6055f635e0e copytrace: packet_context is optional Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index 5c78d6f8..b50783cc 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -398,20 +398,16 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, } type = bt_ctf_stream_class_get_packet_context_type(stream_class); - if (!type) { - fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, - __LINE__); - goto error; - } - - ret_int = bt_ctf_stream_class_set_packet_context_type( - writer_stream_class, type); - if (ret_int < 0) { - fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, - __LINE__); - goto error; + if (type) { + ret_int = bt_ctf_stream_class_set_packet_context_type( + writer_stream_class, type); + if (ret_int < 0) { + fprintf(err, "[error] %s in %s:%d\n", __func__, + __FILE__, __LINE__); + goto error; + } + BT_PUT(type); } - BT_PUT(type); type = bt_ctf_stream_class_get_event_header_type(stream_class); if (!type) {