diff --git a/src/core/refstrings.c b/src/core/refstrings.c index 8391766d..8f220f6f 100644 --- a/src/core/refstrings.c +++ b/src/core/refstrings.c @@ -1,16 +1,42 @@ +#include #include #include #if GLIB_CHECK_VERSION(2, 58, 0) -/* callback implementation for GHashTable */ -#undef i_refstr_release +void i_refstr_init(void) +{ + /* nothing */ +} + +char *i_refstr_intern(const char *str) +{ + if (str == NULL) { + return NULL; + } + + return g_ref_string_new_intern(str); +} + void i_refstr_release(char *str) { - if (str != NULL) { - g_ref_string_release(str); + if (str == NULL) { + return; } + + g_ref_string_release(str); +} + +void i_refstr_deinit(void) +{ + /* nothing */ +} + +char *i_refstr_table_size_info(void) +{ + /* not available */ + return NULL; } #else diff --git a/src/core/refstrings.h b/src/core/refstrings.h index 35f52176..89ef84d1 100644 --- a/src/core/refstrings.h +++ b/src/core/refstrings.h @@ -1,20 +1,6 @@ #ifndef IRSSI_CORE_REFSTRINGS_H #define IRSSI_CORE_REFSTRINGS_H -#include - -#if GLIB_CHECK_VERSION(2, 58, 0) - -#define i_refstr_init() /* nothing */ -/* callback implementation */ -void i_refstr_release(char *str); -#define i_refstr_release(str) ((str) == NULL ? NULL : g_ref_string_release(str)) -#define i_refstr_intern(str) ((str) == NULL ? NULL : g_ref_string_new_intern(str)) -#define i_refstr_deinit() /* nothing */ -#define i_refstr_table_size_info() NULL - -#else - void i_refstr_init(void); char *i_refstr_intern(const char *str); void i_refstr_release(char *str); @@ -22,5 +8,3 @@ void i_refstr_deinit(void); char *i_refstr_table_size_info(void); #endif - -#endif