[gimp/gimp-2-10] app: add gimp_list_compare()
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: add gimp_list_compare()
- Date: Thu, 30 May 2019 05:52:13 +0000 (UTC)
commit 4dd3e73aaac65e18972358caa6b3ef924f14547f
Author: Ell <ell_se yahoo com>
Date: Thu May 30 01:37:32 2019 -0400
app: add gimp_list_compare()
... which lexicographically (shallowly) compares a pair of GLists.
(cherry picked from commit c4ce70a2d3054f811ea046577d8f79192f74f75a)
app/core/gimp-utils.c | 23 +++++++++++++++++++++++
app/core/gimp-utils.h | 3 +++
2 files changed, 26 insertions(+)
---
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index 8be6c3c5d8..74b7410c4d 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -858,6 +858,29 @@ gimp_ascii_strtod (const gchar *nptr,
return TRUE;
}
+gint
+gimp_list_compare (GList *list1,
+ GList *list2)
+{
+ while (list1 && list2)
+ {
+ if (list1->data < list2->data)
+ return -1;
+ else if (list1->data > list2->data)
+ return +1;
+
+ list1 = g_list_next (list1);
+ list2 = g_list_next (list2);
+ }
+
+ if (! list1)
+ return -1;
+ else if (! list2)
+ return +1;
+
+ return 0;
+}
+
/* debug stuff */
diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h
index 956216e82b..761c73ef31 100644
--- a/app/core/gimp-utils.h
+++ b/app/core/gimp-utils.h
@@ -98,6 +98,9 @@ gboolean gimp_ascii_strtod (const gchar *nptr,
gchar **endptr,
gdouble *result);
+gint gimp_list_compare (GList *list1,
+ GList *list2);
+
GimpImage * gimp_create_image_from_buffer (Gimp *gimp,
GeglBuffer *buffer,
const gchar *image_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]