[gom] filter: Factorize some code
- From: Mathieu Bridon <mbridon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gom] filter: Factorize some code
- Date: Fri, 5 Dec 2014 17:17:06 +0000 (UTC)
commit 9e26704653cfabd86d6835ca93dd63066fe0b5de
Author: Mathieu Bridon <bochecha daitauha fr>
Date: Tue Dec 2 20:52:15 2014 +0100
filter: Factorize some code
https://bugzilla.gnome.org/show_bug.cgi?id=740872
gom/gom-filter.c | 28 ++++------------------------
1 files changed, 4 insertions(+), 24 deletions(-)
---
diff --git a/gom/gom-filter.c b/gom/gom-filter.c
index 2fdae8c..59cb09d 100644
--- a/gom/gom-filter.c
+++ b/gom/gom-filter.c
@@ -285,19 +285,9 @@ GomFilter *
gom_filter_new_and (GomFilter *left,
GomFilter *right)
{
- GomFilter *filter;
-
- g_return_val_if_fail(GOM_IS_FILTER(left), NULL);
- g_return_val_if_fail(GOM_IS_FILTER(right), NULL);
-
- filter = g_object_new(GOM_TYPE_FILTER,
- "mode", GOM_FILTER_AND,
- NULL);
- filter->priv->subfilters = g_queue_new();
- g_queue_push_tail(filter->priv->subfilters, g_object_ref(left));
- g_queue_push_tail(filter->priv->subfilters, g_object_ref(right));
+ GomFilter *filter_array[3] = { left, right, NULL };
- return filter;
+ return gom_filter_new_for_subfilters_fullv(GOM_FILTER_AND, filter_array);
}
/**
@@ -353,19 +343,9 @@ GomFilter *
gom_filter_new_or (GomFilter *left,
GomFilter *right)
{
- GomFilter *filter;
-
- g_return_val_if_fail(GOM_IS_FILTER(left), NULL);
- g_return_val_if_fail(GOM_IS_FILTER(right), NULL);
-
- filter = g_object_new(GOM_TYPE_FILTER,
- "mode", GOM_FILTER_OR,
- NULL);
- filter->priv->subfilters = g_queue_new();
- g_queue_push_tail(filter->priv->subfilters, g_object_ref(left));
- g_queue_push_tail(filter->priv->subfilters, g_object_ref(right));
+ GomFilter *filter_array[3] = { left, right, NULL };
- return filter;
+ return gom_filter_new_for_subfilters_fullv(GOM_FILTER_OR, filter_array);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]