Commit 9556bba1 authored by Elliot Lee's avatar Elliot Lee
Browse files

Someone has to make SOME backwards incompatible changes sometime. I

Someone has to make SOME backwards incompatible changes sometime. I
switched around the prev & next pointers in GList.

not. (Would this change make any functional difference? Discuss in a five
page paper. :-)

Actually, added g_list_position() - inverse of g_list_nth()
parent 5647eeec
1998-04-27 Elliot Lee <>
* glist.c (g_list_position): New function to find the position of
a link in a list - should be the inverse of g_list_nth(), but
haven't tested it so poof.
Tue Apr 7 19:36:48 1998 Owen Taylor <>
* gutils.c (g_direct_compare): Removed, because that's what
......@@ -445,6 +445,8 @@ GList* g_list_remove_link (GList *list,
GList* g_list_reverse (GList *list);
GList* g_list_nth (GList *list,
guint n);
gint g_list_position (GList *list,
GList *link);
GList* g_list_find (GList *list,
gpointer data);
GList* g_list_last (GList *list);
......@@ -300,6 +300,21 @@ g_list_nth (GList *list,
return list;
g_list_position (GList *list,
GList *link)
gint nth;
GList *curlink;
for(nth = 0, curlink = list; curlink; curlink = g_list_next(curlink), nth++)
if(curlink == link) return nth;
return -1;
g_list_find (GList *list,
gpointer data)
......@@ -126,6 +126,10 @@ main (int argc,
g_error ("Regular insert failed");
for (i = 0; i < 10; i++)
if(g_list_position(list, g_list_nth (list, i)) != i)
g_error("g_list_position does not seem to be the inverse of g_list_nth\n");
g_list_free (list);
list = NULL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment