[libpeas] Initialize the peas-extension-type quark in class_init when possible



commit 4480c359be81c2d01cbfce10fe3f1de7ca3cfaf4
Author: Garrett Regier <garrettregier gmail com>
Date:   Fri Nov 20 02:24:22 2015 -0800

    Initialize the peas-extension-type quark in class_init when possible

 libpeas/peas-plugin-loader-c.c             |    7 ++++---
 loaders/lua5.1/peas-plugin-loader-lua.c    |    7 ++++---
 loaders/python/peas-plugin-loader-python.c |    7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/libpeas/peas-plugin-loader-c.c b/libpeas/peas-plugin-loader-c.c
index a76ef9c..5aed1b3 100644
--- a/libpeas/peas-plugin-loader-c.c
+++ b/libpeas/peas-plugin-loader-c.c
@@ -44,8 +44,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (PeasPluginLoaderC,
 #define GET_PRIV(o) \
   (peas_plugin_loader_c_get_instance_private (o))
 
-static
-G_DEFINE_QUARK (peas-extension-type, extension_type)
+static GQuark quark_extension_type = 0;
 
 static gboolean
 peas_plugin_loader_c_load (PeasPluginLoader *loader,
@@ -145,7 +144,7 @@ peas_plugin_loader_c_create_extension (PeasPluginLoader *loader,
   /* We have to remember which interface we are instantiating
    * for the deprecated peas_extension_get_extension_type().
    */
-  g_object_set_qdata (instance, extension_type_quark (),
+  g_object_set_qdata (instance, quark_extension_type,
                       GSIZE_TO_POINTER (exten_type));
 
   return instance;
@@ -182,6 +181,8 @@ peas_plugin_loader_c_class_init (PeasPluginLoaderCClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   PeasPluginLoaderClass *loader_class = PEAS_PLUGIN_LOADER_CLASS (klass);
 
+  quark_extension_type = g_quark_from_static_string ("peas-extension-type");
+
   object_class->finalize = peas_plugin_loader_c_finalize;
 
   loader_class->load = peas_plugin_loader_c_load;
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.c b/loaders/lua5.1/peas-plugin-loader-lua.c
index d4a78bb..389dcee 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.c
+++ b/loaders/lua5.1/peas-plugin-loader-lua.c
@@ -54,8 +54,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (PeasPluginLoaderLua,
 #define GET_PRIV(o) \
   (peas_plugin_loader_lua_get_instance_private (o))
 
-static
-G_DEFINE_QUARK (peas-extension-type, extension_type)
+static GQuark quark_extension_type = 0;
 
 G_MODULE_EXPORT void
 peas_register_types (PeasObjectModule *module)
@@ -181,7 +180,7 @@ peas_plugin_loader_lua_create_extension (PeasPluginLoader *loader,
   /* We have to remember which interface we are instantiating
    * for the deprecated peas_extension_get_extension_type().
    */
-  g_object_set_qdata (object, extension_type_quark (),
+  g_object_set_qdata (object, quark_extension_type,
                       GSIZE_TO_POINTER (exten_type));
 
   luaL_checkstack (L, 2, "");
@@ -374,6 +373,8 @@ peas_plugin_loader_lua_class_init (PeasPluginLoaderLuaClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   PeasPluginLoaderClass *loader_class = PEAS_PLUGIN_LOADER_CLASS (klass);
 
+  quark_extension_type = g_quark_from_static_string ("peas-extension-type");
+
   object_class->finalize = peas_plugin_loader_lua_finalize;
 
   loader_class->initialize = peas_plugin_loader_lua_initialize;
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 0e1e4fb..6d7c582 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -50,8 +50,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (PeasPluginLoaderPython,
 #define GET_PRIV(o) \
   (peas_plugin_loader_python_get_instance_private (o))
 
-static
-G_DEFINE_QUARK (peas-extension-type, extension_type)
+static GQuark quark_extension_type = 0;
 
 G_MODULE_EXPORT void
 peas_register_types (PeasObjectModule *module)
@@ -127,7 +126,7 @@ peas_plugin_loader_python_create_extension (PeasPluginLoader *loader,
   /* We have to remember which interface we are instantiating
    * for the deprecated peas_extension_get_extension_type().
    */
-  g_object_set_qdata (object, extension_type_quark (),
+  g_object_set_qdata (object, quark_extension_type,
                       GSIZE_TO_POINTER (exten_type));
 
   pyobject = pygobject_new (object);
@@ -341,6 +340,8 @@ peas_plugin_loader_python_class_init (PeasPluginLoaderPythonClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   PeasPluginLoaderClass *loader_class = PEAS_PLUGIN_LOADER_CLASS (klass);
 
+  quark_extension_type = g_quark_from_static_string ("peas-extension-type");
+
   object_class->finalize = peas_plugin_loader_python_finalize;
 
   loader_class->initialize = peas_plugin_loader_python_initialize;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]