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



commit b601355c51911e99aae1d502af6d5fa147e75569
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]