From d5033d53bd25c0c4e04b345b1de93c41b45bdfb3 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Fri, 11 May 2001 18:05:16 +0000 Subject: [PATCH] make these safe against removal of the current element. Fri May 11 18:25:23 2001 Tim Janik * gdataset.c: (g_dataset_foreach): (g_datalist_foreach): make these safe against removal of the current element. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gdataset.c | 16 +++++++++++----- glib/gdataset.c | 16 +++++++++++----- 10 files changed, 78 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18eeaf6..0db0474 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 18eeaf6..0db0474 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 18eeaf6..0db0474 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 18eeaf6..0db0474 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 18eeaf6..0db0474 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 18eeaf6..0db0474 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 18eeaf6..0db0474 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 18eeaf6..0db0474 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Fri May 11 18:25:23 2001 Tim Janik + + * gdataset.c: + (g_dataset_foreach): + (g_datalist_foreach): make these safe against removal of the + current element. + 2001-05-10 Havoc Pennington * gmessages.c (g_log_write_prefix): change env variable to diff --git a/gdataset.c b/gdataset.c index 136141e..7d8d9af 100644 --- a/gdataset.c +++ b/gdataset.c @@ -481,10 +481,13 @@ g_dataset_foreach (gconstpointer dataset_location, G_UNLOCK (g_dataset_global); if (dataset) { - register GData *list; + register GData *list, *next; - for (list = dataset->datalist; list; list = list->next) + for (list = dataset->datalist; list; list = next) + { + next = list->next; func (list->id, list->data, user_data); + } } } else @@ -498,13 +501,16 @@ g_datalist_foreach (GData **datalist, GDataForeachFunc func, gpointer user_data) { - register GData *list; + register GData *list, *next; g_return_if_fail (datalist != NULL); g_return_if_fail (func != NULL); - for (list = *datalist; list; list = list->next) - func (list->id, list->data, user_data); + for (list = *datalist; list; list = next) + { + next = list->next; + func (list->id, list->data, user_data); + } } void diff --git a/glib/gdataset.c b/glib/gdataset.c index 136141e..7d8d9af 100644 --- a/glib/gdataset.c +++ b/glib/gdataset.c @@ -481,10 +481,13 @@ g_dataset_foreach (gconstpointer dataset_location, G_UNLOCK (g_dataset_global); if (dataset) { - register GData *list; + register GData *list, *next; - for (list = dataset->datalist; list; list = list->next) + for (list = dataset->datalist; list; list = next) + { + next = list->next; func (list->id, list->data, user_data); + } } } else @@ -498,13 +501,16 @@ g_datalist_foreach (GData **datalist, GDataForeachFunc func, gpointer user_data) { - register GData *list; + register GData *list, *next; g_return_if_fail (datalist != NULL); g_return_if_fail (func != NULL); - for (list = *datalist; list; list = list->next) - func (list->id, list->data, user_data); + for (list = *datalist; list; list = next) + { + next = list->next; + func (list->id, list->data, user_data); + } } void -- 2.7.4