diff options
author | Tim Janik <timj@gtk.org> | 2001-07-02 05:02:13 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2001-07-02 05:02:13 +0000 |
commit | 69f32ba7c947dce0f0dd9615e937ec073bee466b (patch) | |
tree | 50c8b094388557c36ac1eb62b522550996dc46fb /glib/gslist.c | |
parent | 4f96a13cba0fc1d445c76d30a7cb90b2971de06a (diff) | |
download | glib-69f32ba7c947dce0f0dd9615e937ec073bee466b.tar.gz |
added g_list_insert_before().
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
* glib/glist.[hc]: added g_list_insert_before().
* glib/gslist.c (g_slist_insert_before): provide an implementation,
prototype was already present...
Sat Jun 30 11:07:00 2001 Tim Janik <timj@gtk.org>
* gobject.[hc]: provide weak_ref/weak_unref functions,
invoked from ->dispose. renamed ->shutdown() to ->dispose(),
provide "public" API entry here: g_object_run_dispose(), this
fucntion should _only_ be called from object system implementations
(e.g. gtkobject.c) if at all.
* gtypemodule.c (g_type_module_dispose): s/shutdown/dispose/
* gsignal.h: removed compat aliases.
* gobject.c (g_object_connect): support data objects.
Diffstat (limited to 'glib/gslist.c')
-rw-r--r-- | glib/gslist.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/glib/gslist.c b/glib/gslist.c index 4dafb98be..18e08e42d 100644 --- a/glib/gslist.c +++ b/glib/gslist.c @@ -307,6 +307,45 @@ g_slist_insert (GSList *list, return list; } +GSList* +g_slist_insert_before (GSList *slist, + GSList *sibling, + gpointer data) +{ + if (!slist) + { + slist = g_slist_alloc (); + slist->data = data; + g_return_val_if_fail (sibling == NULL, slist); + return slist; + } + else + { + GSList *node, *last = NULL; + + for (node = slist; node; last = node, node = last->next) + if (node == sibling) + break; + if (!last) + { + node = g_slist_alloc (); + node->data = data; + node->next = slist; + + return node; + } + else + { + node = g_slist_alloc (); + node->data = data; + node->next = last->next; + last->next = node; + + return slist; + } + } +} + GSList * g_slist_concat (GSList *list1, GSList *list2) { |