[tracker/perf: 2/4] libtracker-data: Reuse blank_buffer arrays
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/perf: 2/4] libtracker-data: Reuse blank_buffer arrays
- Date: Wed, 13 Jan 2010 16:44:49 +0000 (UTC)
commit 466d008d301ba8b47158741b926829d52b8b7f49
Author: Jürg Billeter <j bitron ch>
Date: Wed Dec 16 15:41:17 2009 +0100
libtracker-data: Reuse blank_buffer arrays
src/libtracker-data/tracker-data-update.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 9325e6a..44831d8 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -705,9 +705,9 @@ tracker_data_blank_buffer_flush (GError **error)
g_free (g_array_index (blank_buffer.predicates, gchar *, i));
g_free (g_array_index (blank_buffer.objects, gchar *, i));
}
- g_array_free (blank_buffer.graphs, TRUE);
- g_array_free (blank_buffer.predicates, TRUE);
- g_array_free (blank_buffer.objects, TRUE);
+ g_array_remove_range (blank_buffer.graphs, 0, blank_buffer.graphs->len);
+ g_array_remove_range (blank_buffer.predicates, 0, blank_buffer.predicates->len);
+ g_array_remove_range (blank_buffer.objects, 0, blank_buffer.objects->len);
g_hash_table_insert (blank_buffer.table, subject, blank_uri);
g_checksum_free (checksum);
@@ -1360,9 +1360,11 @@ tracker_data_insert_statement_common (const gchar *graph,
if (blank_buffer.subject == NULL) {
blank_buffer.subject = g_strdup (subject);
- blank_buffer.graphs = g_array_sized_new (FALSE, FALSE, sizeof (char*), 4);
- blank_buffer.predicates = g_array_sized_new (FALSE, FALSE, sizeof (char*), 4);
- blank_buffer.objects = g_array_sized_new (FALSE, FALSE, sizeof (char*), 4);
+ if (blank_buffer.graphs == NULL) {
+ blank_buffer.graphs = g_array_sized_new (FALSE, FALSE, sizeof (char*), 4);
+ blank_buffer.predicates = g_array_sized_new (FALSE, FALSE, sizeof (char*), 4);
+ blank_buffer.objects = g_array_sized_new (FALSE, FALSE, sizeof (char*), 4);
+ }
}
value = g_strdup (graph);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]