mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added g_hash_table_contains for glib < 2.32
This commit is contained in:
parent
ce8f574444
commit
6dbcc03543
@ -81,12 +81,21 @@ p_list_free_full(GList *items, GDestroyNotify free_func)
|
||||
gboolean
|
||||
p_hash_table_add(GHashTable *hash_table, gpointer key)
|
||||
{
|
||||
// doesn't handle when key exists, but value == NULL
|
||||
gpointer found = g_hash_table_lookup(hash_table, key);
|
||||
g_hash_table_replace(hash_table, key, key);
|
||||
|
||||
return (found == NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
p_hash_table_contains(GHashTable *hash_table, gconstpointer key)
|
||||
{
|
||||
// doesn't handle when key exists, but value == NULL
|
||||
gpointer found = g_hash_table_lookup(hash_table, key);
|
||||
return (found != NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
create_dir(char *name)
|
||||
{
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,32,0)
|
||||
#define g_hash_table_add(hash_table, key) p_hash_table_add(hash_table, key)
|
||||
#define g_hash_table_contains(hash_table, key) p_hash_table_contains(hash_table, key);
|
||||
#endif
|
||||
|
||||
#ifndef NOTIFY_CHECK_VERSION
|
||||
@ -79,6 +80,7 @@ gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos);
|
||||
void p_slist_free_full(GSList *items, GDestroyNotify free_func);
|
||||
void p_list_free_full(GList *items, GDestroyNotify free_func);
|
||||
gboolean p_hash_table_add(GHashTable *hash_table, gpointer key);
|
||||
gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key);
|
||||
|
||||
gboolean create_dir(char *name);
|
||||
gboolean mkdir_recursive(const char *dir);
|
||||
|
Loading…
Reference in New Issue
Block a user