From f19fe6afea0aff4028ab390b1627566c67d6ba63 Mon Sep 17 00:00:00 2001 From: Gilbert Ramirez Date: Sat, 20 Mar 1999 04:41:04 +0000 Subject: Added g_slist_nth_data() to glib-new.o so that glib-1.0.x, x < 4, will work. It seems that a stable version of the library received a new function. This should help RedHat folks, since they seem to have glib-1.0.1. svn path=/trunk/; revision=216 --- wiretap/glib-new.c | 13 +++++++++++++ wiretap/glib-new.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/wiretap/glib-new.c b/wiretap/glib-new.c index 5b88f1d8da..d8f6ee6d1c 100644 --- a/wiretap/glib-new.c +++ b/wiretap/glib-new.c @@ -89,4 +89,17 @@ g_strjoin (const gchar *separator, return string; } + +/* this was introduced sometime between glib-1.0.1 and glib-1.0.4 */ +gpointer +g_slist_nth_data (GSList *list, + guint n) +{ + while ((n-- > 0) && list) + list = list->next; + + return list ? list->data : NULL; +} + + #endif diff --git a/wiretap/glib-new.h b/wiretap/glib-new.h index f6ddb14088..562efdbbb2 100644 --- a/wiretap/glib-new.h +++ b/wiretap/glib-new.h @@ -24,3 +24,7 @@ g_memdup (const gpointer mem, gchar* g_strjoin (const gchar *separator, ...); + +gpointer +g_slist_nth_data (GSList *list, + guint n); -- cgit v1.2.3