Cleanup: remove logically dead code
[babeltrace.git] / plugins / ctf / fs-src / metadata.c
index 18ecb0c598d1dc926280b3a2e565038226203263..6ae43df90212d7773d3bf26d0902ff92a62bfe2b 100644 (file)
 BT_HIDDEN
 FILE *ctf_fs_metadata_open_file(const char *trace_path)
 {
-       GString *metadata_path = g_string_new(trace_path);
+       GString *metadata_path;
        FILE *fp = NULL;
 
+       metadata_path = g_string_new(trace_path);
        if (!metadata_path) {
-               goto error;
+               goto end;
        }
 
        g_string_append(metadata_path, "/" CTF_FS_METADATA_FILENAME);
        fp = fopen(metadata_path->str, "rb");
-       if (!fp) {
-               goto error;
-       }
-
-       goto end;
-
-error:
-       if (fp) {
-               fclose(fp);
-               fp = NULL;
-       }
-
-end:
        g_string_free(metadata_path, TRUE);
+end:
        return fp;
 }
 
@@ -103,8 +92,8 @@ int ctf_fs_metadata_set_trace(struct ctf_fs_trace *ctf_fs_trace,
        struct ctf_fs_file *file = NULL;
        struct ctf_metadata_decoder *metadata_decoder = NULL;
        struct ctf_metadata_decoder_config decoder_config = {
-               .clock_class_offset_s = config->clock_class_offset_s,
-               .clock_class_offset_ns = config->clock_class_offset_ns,
+               .clock_class_offset_s = config ? config->clock_class_offset_s : 0,
+               .clock_class_offset_ns = config ? config->clock_class_offset_ns : 0,
        };
 
        file = get_file(ctf_fs_trace->path->str);
@@ -114,7 +103,8 @@ int ctf_fs_metadata_set_trace(struct ctf_fs_trace *ctf_fs_trace,
                goto end;
        }
 
-       metadata_decoder = ctf_metadata_decoder_create(&decoder_config,
+       metadata_decoder = ctf_metadata_decoder_create(
+               config ? &decoder_config : NULL,
                ctf_fs_trace->name->str);
        if (!metadata_decoder) {
                BT_LOGE("Cannot create metadata decoder object");
This page took 0.023724 seconds and 4 git commands to generate.