diff options
author | Brian Tarricone <brian@tarricone.org> | 2009-02-02 05:57:54 +0000 |
---|---|---|
committer | Brian Tarricone <brian@tarricone.org> | 2009-02-02 05:57:54 +0000 |
commit | ff5a4ff20d3a63608c7df6d3a952e5af2059899f (patch) | |
tree | 1191835caa3c2cf6491b1b830649b3cc37ec4351 /xfconfd | |
parent | 9ee4a56187ed936c5abfa8b3142fd9c61104a913 (diff) | |
download | xfconf-ff5a4ff20d3a63608c7df6d3a952e5af2059899f.tar.gz |
just malloc a GType to store in the hash table rather than assuming a
GType will always fit in a pointer, and/or using the annoying macros
that don't really do what we want (but 4881).
(Old svn revision: 29428)
Diffstat (limited to 'xfconfd')
-rw-r--r-- | xfconfd/xfconf-backend-factory.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/xfconfd/xfconf-backend-factory.c b/xfconfd/xfconf-backend-factory.c index 9ac3096..3052cab 100644 --- a/xfconfd/xfconf-backend-factory.c +++ b/xfconfd/xfconf-backend-factory.c @@ -45,11 +45,16 @@ xfconf_backend_factory_ensure_backends(void) if(backends) return; - backends = g_hash_table_new(g_str_hash, g_str_equal); + backends = g_hash_table_new_full(g_str_hash, g_str_equal, + NULL, (GDestroyNotify)g_free); #ifdef BUILD_XFCONF_BACKEND_PERCHANNEL_XML - g_hash_table_insert(backends, XFCONF_BACKEND_PERCHANNEL_XML_TYPE_ID, - GSIZE_TO_POINTER(XFCONF_TYPE_BACKEND_PERCHANNEL_XML)); + { + GType *gtype = g_new(GType, 1); + *gtype = XFCONF_TYPE_BACKEND_PERCHANNEL_XML; + g_hash_table_insert(backends, XFCONF_BACKEND_PERCHANNEL_XML_TYPE_ID, + gtype); + } #endif } @@ -59,12 +64,12 @@ xfconf_backend_factory_get_backend(const gchar *type, GError **error) { XfconfBackend *backend = NULL; - GType backend_gtype; + GType *backend_gtype; xfconf_backend_factory_ensure_backends(); - backend_gtype = GPOINTER_TO_SIZE(g_hash_table_lookup(backends, type)); - if(0 == backend_gtype) { + backend_gtype = g_hash_table_lookup(backends, type); + if(!backend_gtype) { if(error) { g_set_error(error, XFCONF_ERROR, 0, _("Unable to find Xfconf backend of type \"%s\""), @@ -73,7 +78,7 @@ xfconf_backend_factory_get_backend(const gchar *type, return NULL; } - backend = g_object_new(backend_gtype, NULL); + backend = g_object_new(*backend_gtype, NULL); if(!xfconf_backend_initialize(backend, error)) { g_object_unref(G_OBJECT(backend)); return NULL; |