diff options
author | Carsten Haitzler <raster@src.gnome.org> | 1998-07-03 20:33:16 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@src.gnome.org> | 1998-07-03 20:33:16 +0000 |
commit | 4389781ea1ec28ddcfc7a2c7f543ce7405d34f31 (patch) | |
tree | 924b41dff9752c6dd7f91fdea0e5b4f51135c302 /glib/gslist.c | |
parent | 0da6bdc3304d7fcd0d37e04a117804b229990d1f (diff) | |
download | gtk+-themes.tar.gz |
Wheee now others can get to play :)themes
Wheee now others can get to play :)
Diffstat (limited to 'glib/gslist.c')
-rw-r--r-- | glib/gslist.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/glib/gslist.c b/glib/gslist.c index 7045687ca2..636dd37dc4 100644 --- a/glib/gslist.c +++ b/glib/gslist.c @@ -57,7 +57,7 @@ g_slist_set_allocator (GListAllocator* fallocator) GSList* -g_slist_alloc () +g_slist_alloc (void) { GSList *new_list; @@ -289,6 +289,16 @@ g_slist_nth (GSList *list, return list; } +gpointer +g_slist_nth_data (GSList *list, + guint n) +{ + while ((n-- > 0) && list) + list = list->next; + + return list ? list->data : NULL; +} + GSList* g_slist_find (GSList *list, gpointer data) @@ -303,6 +313,42 @@ g_slist_find (GSList *list, return list; } +gint +g_slist_position (GSList *list, + GSList *link) +{ + gint i; + + i = 0; + while (list) + { + if (list == link) + return i; + i++; + list = list->next; + } + + return -1; +} + +gint +g_slist_index (GSList *list, + gpointer data) +{ + gint i; + + i = 0; + while (list) + { + if (list->data == data) + return i; + i++; + list = list->next; + } + + return -1; +} + GSList* g_slist_last (GSList *list) { |