app: add gimp_list_compare()

... which lexicographically (shallowly) compares a pair of GLists.
This commit is contained in:
Ell 2019-05-30 01:37:32 -04:00
parent b1c113c444
commit c4ce70a2d3
2 changed files with 26 additions and 0 deletions

View File

@ -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 */

View File

@ -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);