summaryrefslogtreecommitdiffstats
path: root/eglib
diff options
context:
space:
mode:
Diffstat (limited to 'eglib')
-rw-r--r--eglib/gmain.c34
-rw-r--r--eglib/gmain.h3
2 files changed, 36 insertions, 1 deletions
diff --git a/eglib/gmain.c b/eglib/gmain.c
index 89794c05..027fd60c 100644
--- a/eglib/gmain.c
+++ b/eglib/gmain.c
@@ -1164,6 +1164,40 @@ GSList* g_slist_last(GSList *list)
return list;
}
+static inline GSList* _g_slist_remove_link(GSList *list, GSList *link)
+{
+ GSList *tmp;
+ GSList *prev;
+
+ prev = NULL;
+ tmp = list;
+
+ while (tmp) {
+ if (tmp == link) {
+ if (prev)
+ prev->next = tmp->next;
+ if (list == tmp)
+ list = list->next;
+
+ tmp->next = NULL;
+ break;
+ }
+
+ prev = tmp;
+ tmp = tmp->next;
+ }
+
+ return list;
+}
+
+GSList* g_slist_delete_link(GSList *list, GSList *link)
+{
+ list = _g_slist_remove_link(list, link);
+ g_free(link);
+
+ return list;
+}
+
/* Memory allocation functions */
gpointer g_malloc(gulong n_bytes)
diff --git a/eglib/gmain.h b/eglib/gmain.h
index c75f25d2..8eb70dc7 100644
--- a/eglib/gmain.h
+++ b/eglib/gmain.h
@@ -183,7 +183,7 @@ GSList *g_slist_remove(GSList *list, void *data);
GSList *g_slist_find(GSList *list, gconstpointer data);
GSList *g_slist_find_custom(GSList *list, const void *data,
- GCompareFunc cmp_func);
+ GCompareFunc cmp_func);
GSList *g_slist_sort(GSList *list, GCompareFunc cmp_func);
@@ -191,6 +191,7 @@ int g_slist_length(GSList *list);
void g_slist_foreach(GSList *list, GFunc func, void *user_data);
void g_slist_free(GSList *list);
+GSList *g_slist_delete_link(GSList *list, GSList *link);
GSList *g_slist_nth(GSList *list, guint n);
gpointer g_slist_nth_data(GSList *list, guint n);