mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-31 22:55:40 +00:00
cleanup glib_compat
This commit is contained in:
parent
d91206eed6
commit
9371ae7dd7
|
@ -27,32 +27,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#include "glib_compat.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN64
|
||||
#define __HAVE_64_BIT_PTRS
|
||||
#else
|
||||
#define __HAVE_32_BIT_PTRS
|
||||
#endif
|
||||
#else
|
||||
#ifdef _WIN64
|
||||
#define __HAVE_64_BIT_PTRS
|
||||
#endif
|
||||
#undef __HAVE_64_BIT_PTRS
|
||||
|
||||
#ifdef _WIN64
|
||||
#define __HAVE_64_BIT_PTRS
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef __x86_64__
|
||||
#define __HAVE_64_BIT_PTRS
|
||||
#else
|
||||
#ifdef __ppc64__
|
||||
#define __HAVE_64_BIT_PTRS
|
||||
#else
|
||||
#ifdef __aarch64__
|
||||
#define __HAVE_64_BIT_PTRS
|
||||
#else
|
||||
#define __HAVE_32_BIT_PTRS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__)
|
||||
#define __HAVE_64_BIT_PTRS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* All functions below added to eliminate GLIB dependency */
|
||||
|
@ -79,11 +63,6 @@ guint g_direct_hash(const void *v)
|
|||
#endif
|
||||
}
|
||||
|
||||
int g_direct_equal(const void *v1, const void *v2)
|
||||
{
|
||||
return v1 == v2;
|
||||
}
|
||||
|
||||
/*
|
||||
djb2+ string hashing
|
||||
see: http://www.cse.yorku.ca/~oz/hash.html
|
||||
|
@ -281,16 +260,6 @@ void g_slist_free(GSList *list)
|
|||
}
|
||||
}
|
||||
|
||||
void g_slist_free_full(GSList *list, GDestroyNotify free_func)
|
||||
{
|
||||
GSList *lp, *next;
|
||||
for (lp = list; lp; lp = next) {
|
||||
next = lp->next;
|
||||
if (free_func) (*free_func)(lp->data);
|
||||
free(lp);
|
||||
}
|
||||
}
|
||||
|
||||
GSList *g_slist_prepend(GSList *list, void* data)
|
||||
{
|
||||
GSList *head = (GSList*)g_malloc(sizeof(GSList));
|
||||
|
@ -345,34 +314,6 @@ GSList *g_slist_sort(GSList *list, GCompareFunc compare)
|
|||
return list;
|
||||
}
|
||||
|
||||
GSList *g_slist_find_custom(GSList *list, const void *data, GCompareFunc func)
|
||||
{
|
||||
GSList *lp;
|
||||
for (lp = list; lp; lp = lp->next) {
|
||||
if ((*func)(lp->data, data) == 0) return lp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GSList *g_slist_remove(GSList *list, const void *data)
|
||||
{
|
||||
GSList *lp, *prev = NULL;
|
||||
for (lp = list; lp; lp = lp->next) {
|
||||
if (lp->data == data) {
|
||||
if (prev == NULL) {
|
||||
list = lp->next;
|
||||
}
|
||||
else {
|
||||
prev->next = lp->next;
|
||||
}
|
||||
free(lp);
|
||||
break;
|
||||
}
|
||||
prev = lp;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/* END of g_slist related functions */
|
||||
|
||||
|
||||
|
@ -556,7 +497,6 @@ guint g_hash_table_size(GHashTable *hash_table)
|
|||
return hash_table ? hash_table->num_entries : 0;
|
||||
}
|
||||
|
||||
|
||||
/* END of g_hash_table related functions */
|
||||
|
||||
/* general g_XXX substitutes */
|
||||
|
|
|
@ -49,7 +49,6 @@ typedef gint (*GCompareFunc)(const void *v1, const void *v2);
|
|||
typedef void (*GDestroyNotify)(void *data);
|
||||
|
||||
guint g_direct_hash(const void *v);
|
||||
int g_direct_equal(const void *v1, const void *v2);
|
||||
guint g_str_hash(const void *v);
|
||||
int g_str_equal(const void *v1, const void *v2);
|
||||
guint g_int_hash(const void *v);
|
||||
|
@ -78,11 +77,8 @@ typedef struct _GSList {
|
|||
GSList *g_slist_append(GSList *list, void* data);
|
||||
void g_slist_foreach(GSList *list, GFunc func, void* user_data);
|
||||
void g_slist_free(GSList *list);
|
||||
void g_slist_free_full(GSList *list, GDestroyNotify free_func);
|
||||
GSList *g_slist_prepend(GSList *list, void* data);
|
||||
GSList *g_slist_sort(GSList *list, GCompareFunc compare);
|
||||
GSList *g_slist_find_custom(GSList *list, const void *data, GCompareFunc func);
|
||||
GSList *g_slist_remove(GSList *list, const void *data);
|
||||
|
||||
typedef guint (*GHashFunc)(const void *key);
|
||||
typedef int (*GEqualFunc)(const void *a, const void *b);
|
||||
|
|
Loading…
Reference in a new issue