[tracker/class-signal: 13/17] libtracker-data: Optimization, just return once it's inserted



commit 202ab921650e89d97f9908346f755c0b7b42da1a
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Aug 19 13:47:53 2010 +0200

    libtracker-data: Optimization, just return once it's inserted

 src/libtracker-data/tracker-class.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-data/tracker-class.c b/src/libtracker-data/tracker-class.c
index ef08520..5dc9973 100644
--- a/src/libtracker-data/tracker-class.c
+++ b/src/libtracker-data/tracker-class.c
@@ -523,7 +523,6 @@ insert_vals_into_arrays (GArray *sub_pred_ids,
                          gint    object_id)
 {
 	guint i;
-	gboolean inserted = FALSE;
 	gint64 sub_pred_id;
 
 	sub_pred_id = (gint64) subject_id;
@@ -533,15 +532,12 @@ insert_vals_into_arrays (GArray *sub_pred_ids,
 		if (sub_pred_id < g_array_index (sub_pred_ids, gint64, i)) {
 			g_array_insert_val (sub_pred_ids, i, sub_pred_id);
 			g_array_insert_val (object_ids, i, object_id);
-			inserted = TRUE;
-			break;
+			return;
 		}
 	}
 
-	if (!inserted) {
-		g_array_append_val (sub_pred_ids, sub_pred_id);
-		g_array_append_val (object_ids, object_id);
-	}
+	g_array_append_val (sub_pred_ids, sub_pred_id);
+	g_array_append_val (object_ids, object_id);
 }
 
 void



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