[tracker/wip/miner-priority-queues: 5/7] libtracker-miner: Make tracker_priority_queue_foreach_remove return gboolean
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/miner-priority-queues: 5/7] libtracker-miner: Make tracker_priority_queue_foreach_remove return gboolean
- Date: Thu, 30 Jun 2011 16:14:23 +0000 (UTC)
commit 9d183d10354e8b02bff1156f42b49bfb1eb9a66e
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Jun 30 18:06:52 2011 +0200
libtracker-miner: Make tracker_priority_queue_foreach_remove return gboolean
it will return TRUE if some item has been removed, FALSE otherwise
src/libtracker-miner/tracker-priority-queue.c | 12 ++++++++----
src/libtracker-miner/tracker-priority-queue.h | 4 ++--
2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-priority-queue.c b/src/libtracker-miner/tracker-priority-queue.c
index 776f0a9..831457d 100644
--- a/src/libtracker-miner/tracker-priority-queue.c
+++ b/src/libtracker-miner/tracker-priority-queue.c
@@ -164,7 +164,7 @@ tracker_priority_queue_foreach (TrackerPriorityQueue *queue,
g_queue_foreach (&queue->queue, func, user_data);
}
-void
+gboolean
tracker_priority_queue_foreach_remove (TrackerPriorityQueue *queue,
GEqualFunc compare_func,
gpointer compare_user_data,
@@ -172,15 +172,16 @@ tracker_priority_queue_foreach_remove (TrackerPriorityQueue *queue,
{
PrioritySegment *segment;
gint n_segment = 0;
+ gboolean updated = FALSE;
GList *list;
- g_return_if_fail (queue != NULL);
- g_return_if_fail (compare_func != NULL);
+ g_return_val_if_fail (queue != NULL, FALSE);
+ g_return_val_if_fail (compare_func != NULL, FALSE);
list = queue->queue.head;
if (!list) {
- return;
+ return FALSE;
}
segment = &g_array_index (queue->segments, PrioritySegment, n_segment);
@@ -217,6 +218,7 @@ tracker_priority_queue_foreach_remove (TrackerPriorityQueue *queue,
}
g_queue_delete_link (&queue->queue, elem);
+ updated = TRUE;
} else {
if (list != NULL &&
elem == segment->last_elem) {
@@ -230,6 +232,8 @@ tracker_priority_queue_foreach_remove (TrackerPriorityQueue *queue,
}
}
}
+
+ return updated;
}
gboolean
diff --git a/src/libtracker-miner/tracker-priority-queue.h b/src/libtracker-miner/tracker-priority-queue.h
index 0a694f2..63ec24c 100644
--- a/src/libtracker-miner/tracker-priority-queue.h
+++ b/src/libtracker-miner/tracker-priority-queue.h
@@ -47,7 +47,7 @@ void tracker_priority_queue_foreach (TrackerPriorityQueue *queue,
GFunc func,
gpointer user_data);
-void tracker_priority_queue_foreach_remove (TrackerPriorityQueue *queue,
+gboolean tracker_priority_queue_foreach_remove (TrackerPriorityQueue *queue,
GEqualFunc compare_func,
gpointer compare_user_data,
GDestroyNotify destroy_notify);
@@ -55,7 +55,7 @@ void tracker_priority_queue_foreach_remove (TrackerPriorityQueue *queue,
gpointer tracker_priority_queue_find (TrackerPriorityQueue *queue,
gint *priority_out,
GEqualFunc compare_func,
- gpointer user_data);
+ gpointer data);
gpointer tracker_priority_queue_peek (TrackerPriorityQueue *queue,
gint *priority_out);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]