mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 04:13:32 +02:00
implement reference counted strings
- on glib >=2.58, use the implementation provided by glib - otherwise, a hash table will contain the strings
This commit is contained in:
parent
2f82d9cd33
commit
ad7ad063ca
6 changed files with 133 additions and 0 deletions
24
src/core/refstrings.h
Normal file
24
src/core/refstrings.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#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 */
|
||||
#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);
|
||||
void i_refstr_deinit(void);
|
||||
char *i_refstr_table_size_info(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue