diff options
author | Tim Janik <timj@gtk.org> | 1998-11-23 01:52:07 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-11-23 01:52:07 +0000 |
commit | 70a6dbff8767b9a836e6d62411d5d4450cc884fc (patch) | |
tree | 02b50d55b05c6f20411dbfaf266edb443ac454a0 | |
parent | 3556db20549c3d2a7d0ccc6552433cafc3fae4a5 (diff) |
new function g_slist_copy() to duplicate a list with all its data
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gslist.c: new function g_slist_copy() to duplicate a list with all its
data pointers.
* glist.c: new function g_list_copy.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-12 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 8 | ||||
-rw-r--r-- | glib.h | 2 | ||||
-rw-r--r-- | glib/glib.h | 2 | ||||
-rw-r--r-- | glib/glist.c | 26 | ||||
-rw-r--r-- | glib/gslist.c | 25 | ||||
-rw-r--r-- | glist.c | 26 | ||||
-rw-r--r-- | gslist.c | 25 |
14 files changed, 170 insertions, 0 deletions
@@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 9d97abab9..6fbd2622c 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9d97abab9..6fbd2622c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 9d97abab9..6fbd2622c 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 9d97abab9..6fbd2622c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 9d97abab9..6fbd2622c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 9d97abab9..6fbd2622c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 9d97abab9..6fbd2622c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org> + + * glib.h: + * gslist.c: new function g_slist_copy() to duplicate a list with all its + data pointers. + * glist.c: new function g_list_copy. + Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * INSTALL: @@ -9,6 +16,7 @@ Sat Nov 21 14:57:39 CST 1998 Shawn T. Amundson <amundson@gtk.org> * Released GLib 1.1.5 Wed Nov 18 1998 Elliot Lee <sopwith@redhat.com> + * gdataset.c: There was a code path into g_data_set_internal through a function (g_datalist_id_set_full). Neither function checked for g_dataset_init having been run, but @@ -885,6 +885,7 @@ GList* g_list_remove (GList *list, GList* g_list_remove_link (GList *list, GList *llink); GList* g_list_reverse (GList *list); +GList* g_list_copy (GList *list); GList* g_list_nth (GList *list, guint n); GList* g_list_find (GList *list, @@ -932,6 +933,7 @@ GSList* g_slist_remove (GSList *list, GSList* g_slist_remove_link (GSList *list, GSList *llink); GSList* g_slist_reverse (GSList *list); +GSList* g_slist_copy (GSList *list); GSList* g_slist_nth (GSList *list, guint n); GSList* g_slist_find (GSList *list, diff --git a/glib/glib.h b/glib/glib.h index 1b66572c5..551c2eb88 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -885,6 +885,7 @@ GList* g_list_remove (GList *list, GList* g_list_remove_link (GList *list, GList *llink); GList* g_list_reverse (GList *list); +GList* g_list_copy (GList *list); GList* g_list_nth (GList *list, guint n); GList* g_list_find (GList *list, @@ -932,6 +933,7 @@ GSList* g_slist_remove (GSList *list, GSList* g_slist_remove_link (GSList *list, GSList *llink); GSList* g_slist_reverse (GSList *list); +GSList* g_slist_copy (GSList *list); GSList* g_slist_nth (GSList *list, guint n); GSList* g_slist_find (GSList *list, diff --git a/glib/glist.c b/glib/glist.c index eaa77d82c..ee9ad695c 100644 --- a/glib/glist.c +++ b/glib/glist.c @@ -274,6 +274,32 @@ g_list_remove_link (GList *list, } GList* +g_list_copy (GList *list) +{ + GList *new_list = NULL; + + if (list) + { + GList *last; + + new_list = g_list_alloc (); + new_list->data = list->data; + last = new_list; + list = list->next; + while (list) + { + last->next = g_list_alloc (); + last->next->prev = last; + last = last->next; + last->data = list->data; + list = list->next; + } + } + + return new_list; +} + +GList* g_list_reverse (GList *list) { GList *last; diff --git a/glib/gslist.c b/glib/gslist.c index e95290024..6a76d22a6 100644 --- a/glib/gslist.c +++ b/glib/gslist.c @@ -256,6 +256,31 @@ g_slist_remove_link (GSList *list, } GSList* +g_slist_copy (GSList *list) +{ + GSList *new_list = NULL; + + if (list) + { + GSList *last; + + new_list = g_slist_alloc (); + new_list->data = list->data; + last = new_list; + list = list->next; + while (list) + { + last->next = g_slist_alloc (); + last = last->next; + last->data = list->data; + list = list->next; + } + } + + return new_list; +} + +GSList* g_slist_reverse (GSList *list) { GSList *tmp; @@ -274,6 +274,32 @@ g_list_remove_link (GList *list, } GList* +g_list_copy (GList *list) +{ + GList *new_list = NULL; + + if (list) + { + GList *last; + + new_list = g_list_alloc (); + new_list->data = list->data; + last = new_list; + list = list->next; + while (list) + { + last->next = g_list_alloc (); + last->next->prev = last; + last = last->next; + last->data = list->data; + list = list->next; + } + } + + return new_list; +} + +GList* g_list_reverse (GList *list) { GList *last; @@ -256,6 +256,31 @@ g_slist_remove_link (GSList *list, } GSList* +g_slist_copy (GSList *list) +{ + GSList *new_list = NULL; + + if (list) + { + GSList *last; + + new_list = g_slist_alloc (); + new_list->data = list->data; + last = new_list; + list = list->next; + while (list) + { + last->next = g_slist_alloc (); + last = last->next; + last->data = list->data; + list = list->next; + } + } + + return new_list; +} + +GSList* g_slist_reverse (GSList *list) { GSList *tmp; |