Skip to contentSkip to conversation

Remove unused array in bt_context_add_traces_recursive

PATCH Mathieu Desnoyers 1 participant 1 message May 15, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mathieu Desnoyers

author Applied
#1 lore raw

merged, thanks!

Mathieu

Quoted 57 lines · * Jérémie Galarneau ([email protected]) wrote:
---
 converter/babeltrace.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
converter/babeltrace.c +3 -8
index 2fd371c..1008351 100644
@@ -490,15 +490,11 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path,
 		void (*packet_seek)(struct bt_stream_pos *pos,
 			size_t offset, int whence))
 {
-
-	GArray *trace_ids;
-	int ret = 0;
+	int ret = 0, trace_ids = 0;
 
 	/* Should lock traversed_paths mutex here if used in multithread */
 
 	traversed_paths = g_ptr_array_new();
-	trace_ids = g_array_new(FALSE, TRUE, sizeof(int));
-
 	ret = nftw(path, traverse_trace_dir, 10, 0);
 
 	/* Process the array if ntfw did not return a fatal error */
@@ -520,7 +516,7 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path,
 				/* Allow to skip erroneous traces. */
 				ret = 1;	/* partial error */
 			} else {
-				g_array_append_val(trace_ids, trace_id);
+				trace_ids++;
 			}
 			g_string_free(trace_path, TRUE);
 		}
@@ -534,11 +530,10 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path,
 	/*
 	 * Return an error if no trace can be opened.
 	 */
-	if (trace_ids->len == 0) {
+	if (trace_ids == 0) {
 		fprintf(stderr, "[error] Cannot open any trace for reading.\n\n");
 		ret = -ENOENT;		/* failure */
 	}
-	g_array_free(trace_ids, TRUE);
 	return ret;
 }
 
Signature · 7 lines
1.8.2.2


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com