#include "query.h"
#include <stdbool.h>
-#include <assert.h>
+#include <babeltrace/assert-internal.h>
#include "metadata.h"
#include "../common/metadata/decoder.h"
#include <babeltrace/common-internal.h>
goto error;
}
+ BT_ASSERT(params);
+
if (!bt_value_is_map(params)) {
BT_LOGE_STR("Query parameters is not a map value object.");
query_ret.status = BT_QUERY_STATUS_INVALID_PARAMS;
goto error;
}
- path_value = bt_value_map_get(params, "path");
+ path_value = bt_value_map_borrow(params, "path");
ret = bt_value_string_get(path_value, &path);
if (ret) {
BT_LOGE_STR("Cannot get `path` string parameter.");
goto error;
}
- assert(path);
+ BT_ASSERT(path);
metadata_fp = ctf_fs_metadata_open_file(path);
if (!metadata_fp) {
BT_LOGE("Cannot open trace metadata: path=\"%s\".", path);
}
end:
- bt_put(path_value);
free(metadata_text);
if (g_metadata_text) {
}
}
- stream_class = bt_stream_get_class(stream);
+ stream_class = bt_stream_borrow_class(stream);
if (!stream_class) {
ret = -1;
goto end;
ret = -1;
goto end;
}
+
end:
- bt_put(stream_class);
return ret;
}
goto end;
}
- trace = ctf_fs_trace_create(trace_path, trace_name, NULL);
+ trace = ctf_fs_trace_create(trace_path, trace_name, NULL, NULL);
if (!trace) {
BT_LOGE("Failed to create fs trace at \'%s\'", trace_path);
ret = -1;
goto end;
}
- assert(trace->ds_file_groups);
+ BT_ASSERT(trace->ds_file_groups);
/* Add trace range info only if it contains streams. */
if (trace->ds_file_groups->len == 0) {
ret = -1;
GList *tn_node = NULL;
GString *normalized_path = NULL;
+ BT_ASSERT(params);
+
if (!bt_value_is_map(params)) {
BT_LOGE("Query parameters is not a map value object.");
query_ret.status = BT_QUERY_STATUS_INVALID_PARAMS;
goto error;
}
- path_value = bt_value_map_get(params, "path");
+ path_value = bt_value_map_borrow(params, "path");
ret = bt_value_string_get(path_value, &path);
if (ret) {
BT_LOGE("Cannot get `path` string parameter.");
BT_LOGE("Failed to normalize path: `%s`.", path);
goto error;
}
- assert(path);
+ BT_ASSERT(path);
ret = ctf_fs_find_traces(&trace_paths, normalized_path->str);
if (ret) {
g_list_free(trace_names);
}
/* "path" becomes invalid with the release of path_value. */
- bt_put(path_value);
return query_ret;
}