diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2018-02-05 22:29:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-05 22:29:35 +0100 |
commit | f8fbc1e1ab9b01c651c7da0652eac8631894c44c (patch) | |
tree | 4622a6b8b545c36a4d539626ad741f1e56387fcf /src/core | |
parent | 81831806132608d5111ffb24efd2a2469c62d197 (diff) | |
parent | 260733475c2b701c35024a3b4fbe900751b45341 (diff) | |
download | irssi-f8fbc1e1ab9b01c651c7da0652eac8631894c44c.zip |
Merge pull request #775 from LemonBoy/caps_kv
CAP 3.2 support
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/misc.c | 13 | ||||
-rw-r--r-- | src/core/misc.h | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/core/misc.c b/src/core/misc.c index 4e9f4bbe..27741220 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -218,6 +218,19 @@ GSList *gslist_remove_string (GSList *list, const char *str) return list; } +GSList *gslist_delete_string (GSList *list, const char *str, GDestroyNotify free_func) +{ + GSList *l; + + l = g_slist_find_custom(list, str, (GCompareFunc) g_strcmp0); + if (l != NULL) { + free_func(l->data); + return g_slist_delete_link(list, l); + } + + return list; +} + /* `list' contains pointer to structure with a char* to string. */ char *gslistptr_to_string(GSList *list, int offset, const char *delimiter) { diff --git a/src/core/misc.h b/src/core/misc.h index 375744db..a46a1432 100644 --- a/src/core/misc.h +++ b/src/core/misc.h @@ -21,7 +21,8 @@ GSList *gslist_find_string(GSList *list, const char *key); GSList *gslist_find_icase_string(GSList *list, const char *key); GList *glist_find_string(GList *list, const char *key); GList *glist_find_icase_string(GList *list, const char *key); -GSList *gslist_remove_string (GSList *list, const char *str); +GSList *gslist_remove_string (GSList *list, const char *str) G_GNUC_DEPRECATED; +GSList *gslist_delete_string (GSList *list, const char *str, GDestroyNotify free_func); void gslist_free_full (GSList *list, GDestroyNotify free_func); |