1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-22 04:35:58 -04:00

replace refstring macro implementation with C functions

This commit is contained in:
Ailin Nemui 2021-02-25 10:50:51 +01:00
parent d535a79730
commit 322df0d2c8
2 changed files with 30 additions and 20 deletions

View File

@ -1,16 +1,42 @@
#include <glib.h>
#include <string.h>
#include <irssi/src/core/refstrings.h>
#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

View File

@ -1,20 +1,6 @@
#ifndef IRSSI_CORE_REFSTRINGS_H
#define IRSSI_CORE_REFSTRINGS_H
#include <glib.h>
#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