From: Florian Zeitz Date: Wed, 26 Dec 2012 01:13:39 +0000 (+0100) Subject: Move JubGObjectMap functions to a .m file X-Git-Url: https://git.babelmonkeys.de/?a=commitdiff_plain;h=7fe1488aff56b88decb6cb7c248df745f8c45713;p=jubjub.git Move JubGObjectMap functions to a .m file --- diff --git a/src/gui/gtk/JubGObjectMap.h b/src/gui/gtk/JubGObjectMap.h index fef08a1..f5fd27e 100644 --- a/src/gui/gtk/JubGObjectMap.h +++ b/src/gui/gtk/JubGObjectMap.h @@ -1,86 +1,3 @@ -#import -#include - -static void *copy(void *value) -{ - return [(id)value copy]; -} - -static void release(void *value) -{ - [(id)value release]; -} - -static uint32_t hash(void *value) -{ - return [(id)value hash]; -} - -static BOOL equal(void *value1, void *value2) -{ - return [(id)value1 isEqual: (id)value2]; -} - -static void *g_retain(void *value) -{ - return g_object_ref(value); -} - -static void g_release(void *value) -{ - g_object_unref(value); -} - -static void *default_retain(void *value) -{ - return value; -} - -static uint32_t default_hash(void *value) -{ -#define NUM (sizeof(void*)/sizeof(uint32_t)) - int i; - uint32_t hash = 0; - union { - void *v; - uint32_t i[NUM]; - } u = { value }; - - for (i = 0; i < NUM; i++) - hash ^= u.i[i]; - - return hash; -#undef NUM -} - -static BOOL default_equal(void *value1, void *value2) -{ - return (value1 == value2); -} - - -static void rowref_release(void *value) -{ - gtk_tree_row_reference_free(value); -} - -static of_map_table_functions_t keyFunctions = { - .retain = copy, - .release = release, - .hash = hash, - .equal = equal -}; - -static of_map_table_functions_t gObjectFunctions __attribute__((unused)) = { - .retain = g_retain, - .release = g_release, - .hash = default_hash, - .equal = default_equal -}; - -static of_map_table_functions_t rowRefFunctions = { - .retain = default_retain, - .release = rowref_release, - .hash = default_hash, - .equal = default_equal -}; +extern of_map_table_functions_t keyFunctions; +extern of_map_table_functions_t gObjectFunctions __attribute__((unused)); +extern of_map_table_functions_t rowRefFunctions; diff --git a/src/gui/gtk/JubGObjectMap.m b/src/gui/gtk/JubGObjectMap.m new file mode 100644 index 0000000..ce6217a --- /dev/null +++ b/src/gui/gtk/JubGObjectMap.m @@ -0,0 +1,86 @@ +#import +#include + +static void *copy(void *value) +{ + return [(id)value copy]; +} + +static void release(void *value) +{ + [(id)value release]; +} + +static uint32_t hash(void *value) +{ + return [(id)value hash]; +} + +static BOOL equal(void *value1, void *value2) +{ + return [(id)value1 isEqual: (id)value2]; +} + +static void *g_retain(void *value) +{ + return g_object_ref(value); +} + +static void g_release(void *value) +{ + g_object_unref(value); +} + +static void *default_retain(void *value) +{ + return value; +} + +static uint32_t default_hash(void *value) +{ +#define NUM (sizeof(void*)/sizeof(uint32_t)) + int i; + uint32_t hash = 0; + union { + void *v; + uint32_t i[NUM]; + } u = { value }; + + for (i = 0; i < NUM; i++) + hash ^= u.i[i]; + + return hash; +#undef NUM +} + +static BOOL default_equal(void *value1, void *value2) +{ + return (value1 == value2); +} + + +static void rowref_release(void *value) +{ + gtk_tree_row_reference_free(value); +} + +of_map_table_functions_t keyFunctions = { + .retain = copy, + .release = release, + .hash = hash, + .equal = equal +}; + +of_map_table_functions_t gObjectFunctions = { + .retain = g_retain, + .release = g_release, + .hash = default_hash, + .equal = default_equal +}; + +of_map_table_functions_t rowRefFunctions = { + .retain = default_retain, + .release = rowref_release, + .hash = default_hash, + .equal = default_equal +}; diff --git a/src/gui/gtk/Makefile b/src/gui/gtk/Makefile index c505896..56c27e5 100644 --- a/src/gui/gtk/Makefile +++ b/src/gui/gtk/Makefile @@ -2,7 +2,8 @@ STATIC_LIB_NOINST = gtk.a SRCS = JubGtkUI.m \ JubGtkChatUI.m \ JubGtkRosterUI.m \ - JubGtkHelper.m + JubGtkHelper.m \ + JubGObjectMap.m include ../../../buildsys.mk