[tracker/return-types] tracker-store: steroids: Use alloca instead of malloc



commit eefca8638efcf2050f636fd69e12909c43ef8951
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Sep 9 11:49:57 2010 +0200

    tracker-store: steroids: Use alloca instead of malloc

 src/tracker-store/tracker-steroids.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index 414c2c6..3802aaf 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -265,9 +265,9 @@ query_inthread (TrackerDBCursor *cursor,
 
 	n_columns = tracker_db_cursor_get_n_columns (cursor);
 
-	column_sizes = g_malloc (n_columns * sizeof (gint));
-	column_offsets = g_malloc (n_columns * sizeof (gint));
-	column_data = g_malloc (n_columns * sizeof (gchar*));
+	column_sizes = alloca (n_columns * sizeof (gint));
+	column_offsets = alloca (n_columns * sizeof (gint));
+	column_data = alloca (n_columns * sizeof (gchar*));
 
 	while (tracker_db_cursor_iter_next (cursor, cancellable, &loop_error)) {
 		gint i;
@@ -343,10 +343,6 @@ end_query_inthread:
 		ptr->error = loop_error;
 	}
 
-	g_free (column_sizes);
-	g_free (column_offsets);
-	g_free (column_data);
-
 	return ptr;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]