glib_compat: make the API compatible with glib
This commit is contained in:
@ -44,78 +44,79 @@ typedef unsigned int guint;
|
||||
typedef char gchar;
|
||||
typedef int gboolean;
|
||||
|
||||
typedef void (*GFunc)(void* data, void* user_data);
|
||||
typedef gint (*GCompareFunc)(const void *v1, const void *v2);
|
||||
typedef void (*GDestroyNotify)(void *data);
|
||||
typedef void (*GFunc)(gpointer data, gpointer user_data);
|
||||
typedef gint (*GCompareFunc)(gconstpointer v1, gconstpointer v2);
|
||||
typedef void (*GDestroyNotify)(gpointer data);
|
||||
|
||||
guint g_direct_hash(const void *v);
|
||||
guint g_str_hash(const void *v);
|
||||
int g_str_equal(const void *v1, const void *v2);
|
||||
guint g_int_hash(const void *v);
|
||||
int g_int_equal(const void *v1, const void *v2);
|
||||
guint g_direct_hash(gconstpointer v);
|
||||
guint g_str_hash(gconstpointer v);
|
||||
gboolean g_str_equal(gconstpointer v1, gconstpointer v2);
|
||||
guint g_int_hash(gconstpointer v);
|
||||
|
||||
gboolean g_int_equal(gconstpointer v1, gconstpointer v2);
|
||||
|
||||
typedef struct _GList {
|
||||
void *data;
|
||||
gpointer data;
|
||||
struct _GList *next;
|
||||
struct _GList *prev;
|
||||
} GList;
|
||||
|
||||
GList *g_list_first(GList *list);
|
||||
void g_list_foreach(GList *list, GFunc func, void* user_data);
|
||||
void g_list_foreach(GList *list, GFunc func, gpointer user_data);
|
||||
void g_list_free(GList *list);
|
||||
GList *g_list_insert_sorted(GList *list, void* data, GCompareFunc compare);
|
||||
GList *g_list_insert_sorted(GList *list, gpointer data, GCompareFunc compare);
|
||||
#define g_list_next(list) (list->next)
|
||||
GList *g_list_prepend(GList *list, void* data);
|
||||
GList *g_list_prepend(GList *list, gpointer data);
|
||||
GList *g_list_remove_link(GList *list, GList *llink);
|
||||
GList *g_list_sort(GList *list, GCompareFunc compare);
|
||||
|
||||
typedef struct _GSList {
|
||||
void *data;
|
||||
gpointer data;
|
||||
struct _GSList *next;
|
||||
} GSList;
|
||||
|
||||
GSList *g_slist_append(GSList *list, void* data);
|
||||
void g_slist_foreach(GSList *list, GFunc func, void* user_data);
|
||||
GSList *g_slist_append(GSList *list, gpointer data);
|
||||
void g_slist_foreach(GSList *list, GFunc func, gpointer user_data);
|
||||
void g_slist_free(GSList *list);
|
||||
GSList *g_slist_prepend(GSList *list, void* data);
|
||||
GSList *g_slist_prepend(GSList *list, gpointer data);
|
||||
GSList *g_slist_sort(GSList *list, GCompareFunc compare);
|
||||
|
||||
typedef guint (*GHashFunc)(const void *key);
|
||||
typedef int (*GEqualFunc)(const void *a, const void *b);
|
||||
typedef void (*GHFunc)(void* key, void* value, void* user_data);
|
||||
typedef int (*GHRFunc)(void* key, void* value, void* user_data);
|
||||
typedef guint (*GHashFunc)(gconstpointer key);
|
||||
typedef gboolean (*GEqualFunc)(gconstpointer a, gconstpointer b);
|
||||
typedef void (*GHFunc)(gpointer key, gpointer value, gpointer user_data);
|
||||
typedef gboolean (*GHRFunc)(gpointer key, gpointer value, gpointer user_data);
|
||||
|
||||
typedef struct _GHashTable GHashTable;
|
||||
|
||||
void g_hash_table_destroy(GHashTable *hash_table);
|
||||
void* g_hash_table_find(GHashTable *hash_table, GHRFunc predicate, void* user_data);
|
||||
void g_hash_table_foreach(GHashTable *hash_table, GHFunc func, void* user_data);
|
||||
int g_hash_table_insert(GHashTable *hash_table, void* key, void* value);
|
||||
void* g_hash_table_lookup(GHashTable *hash_table, const void* key);
|
||||
gpointer g_hash_table_find(GHashTable *hash_table, GHRFunc predicate, gpointer user_data);
|
||||
void g_hash_table_foreach(GHashTable *hash_table, GHFunc func, gpointer user_data);
|
||||
gboolean g_hash_table_insert(GHashTable *hash_table, gpointer key, gpointer value);
|
||||
gpointer g_hash_table_lookup(GHashTable *hash_table, gconstpointer key);
|
||||
GHashTable *g_hash_table_new(GHashFunc hash_func, GEqualFunc key_equal_func);
|
||||
GHashTable *g_hash_table_new_full(GHashFunc hash_func, GEqualFunc key_equal_func,
|
||||
GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
|
||||
void g_hash_table_remove_all(GHashTable *hash_table);
|
||||
int g_hash_table_remove(GHashTable *hash_table, const void* key);
|
||||
gboolean g_hash_table_remove(GHashTable *hash_table, gconstpointer key);
|
||||
void g_hash_table_unref(GHashTable *hash_table);
|
||||
GHashTable *g_hash_table_ref(GHashTable *hash_table);
|
||||
guint g_hash_table_size(GHashTable *hash_table);
|
||||
|
||||
/* replacement for g_malloc dependency */
|
||||
void g_free(void *ptr);
|
||||
void *g_malloc(size_t size);
|
||||
void *g_malloc0(size_t size);
|
||||
void *g_try_malloc0(size_t size);
|
||||
void *g_realloc(void *ptr, size_t size);
|
||||
void g_free(gpointer ptr);
|
||||
gpointer g_malloc(size_t size);
|
||||
gpointer g_malloc0(size_t size);
|
||||
gpointer g_try_malloc0(size_t size);
|
||||
gpointer g_realloc(gpointer ptr, size_t size);
|
||||
char *g_strdup(const char *str);
|
||||
char *g_strdup_printf(const char *format, ...);
|
||||
char *g_strdup_vprintf(const char *format, va_list ap);
|
||||
char *g_strndup(const char *str, size_t n);
|
||||
void g_strfreev(char **v);
|
||||
void *g_memdup(const void *mem, size_t byte_size);
|
||||
void *g_new_(size_t sz, size_t n_structs);
|
||||
void *g_new0_(size_t sz, size_t n_structs);
|
||||
void *g_renew_(size_t sz, void *mem, size_t n_structs);
|
||||
gpointer g_memdup(gconstpointer mem, size_t byte_size);
|
||||
gpointer g_new_(size_t sz, size_t n_structs);
|
||||
gpointer g_new0_(size_t sz, size_t n_structs);
|
||||
gpointer g_renew_(size_t sz, gpointer mem, size_t n_structs);
|
||||
char *g_strconcat(const char *string1, ...);
|
||||
|
||||
char **g_strsplit(const char *string, const char *delimiter, int max_tokens);
|
||||
|
Reference in New Issue
Block a user