/soc/2013/ankitkv/gobjectification: b9b2b5697680: Removed PURPLE...

Ankit Vani a at nevitus.org
Sat Sep 7 16:39:31 EDT 2013


Changeset: b9b2b5697680e2387b033ac0a25e2a42501d648a
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-08 00:12 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b9b2b5697680

Description:

Removed PURPLE_PLUGIN_INIT_VAL and PURPLE_PROTOCOL_DEFINE* macros.
Will be adding generic static/dynamic type registration macros based on those of GTypeModule.

diffstat:

 libpurple/plugins.h  |  32 -------------------
 libpurple/protocol.h |  87 ----------------------------------------------------
 2 files changed, 0 insertions(+), 119 deletions(-)

diffs (139 lines):

diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -209,38 +209,6 @@ struct _PurplePluginAction {
 	}
 #endif
 
-/**
- * PURPLE_PLUGIN_INIT_VAL:
- *
- * Defines the plugin's entry points and makes a PurplePlugin pointer hold this
- * plugin's reference while the plugin is loaded.
- */
-#if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PROTOCOL)
-#define PURPLE_PLUGIN_INIT_VAL(plugin,pluginname,pluginquery,pluginload,pluginunload) \
-	void pluginname##_plugin_initval(void); \
-	void pluginname##_plugin_initval(void) { \
-		plugin = NULL; \
-	} \
-	PURPLE_PLUGIN_INIT(pluginname,pluginquery,pluginload,pluginunload)
-#else /* PURPLE_PLUGINS  && !PURPLE_STATIC_PROTOCOL */
-#define PURPLE_PLUGIN_INIT_VAL(plugin,pluginname,pluginquery,pluginload,pluginunload) \
-	G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e); \
-	G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e) { \
-		plugin = NULL; \
-		return GPLUGIN_PLUGIN_INFO(pluginquery(e)); \
-	} \
-	G_MODULE_EXPORT gboolean gplugin_plugin_load(GPluginNativePlugin *p, GError **e); \
-	G_MODULE_EXPORT gboolean gplugin_plugin_load(GPluginNativePlugin *p, GError **e) { \
-		plugin = PURPLE_PLUGIN(p); \
-		return pluginload(plugin, e); \
-	} \
-	G_MODULE_EXPORT gboolean gplugin_plugin_unload(GPluginNativePlugin *p, GError **e); \
-	G_MODULE_EXPORT gboolean gplugin_plugin_unload(GPluginNativePlugin *p, GError **e) { \
-		plugin = NULL; \
-		return pluginunload(PURPLE_PLUGIN(p), e); \
-	}
-#endif
-
 G_BEGIN_DECLS
 
 /**************************************************************************/
diff --git a/libpurple/protocol.h b/libpurple/protocol.h
--- a/libpurple/protocol.h
+++ b/libpurple/protocol.h
@@ -574,93 +574,6 @@ struct _PurpleProtocolInterface
 #define PURPLE_PROTOCOL_IMPLEMENTS(protocol,func) \
 	(PURPLE_PROTOCOL_GET_INTERFACE(protocol)->func != NULL)
 
-/**
- * Defines a protocol type in a plugin (given as a PurplePlugin *) by using the
- * CamelCase type name of the protocol and the function prefix for the
- * generated *_get_type(), and the *_init(), *_class_init() and
- * *_interface_init() functions used by the protocol.
- *
- * The type may be registered statically or dynamically.
- */
-#define PURPLE_PROTOCOL_DEFINE(plugin, TypeName, func_prefix) \
-	PURPLE_PROTOCOL_DEFINE_EXTENDED(plugin, TypeName, func_prefix, \
-	                                PURPLE_TYPE_PROTOCOL, 0)
-
-/**
- * PURPLE_PROTOCOL_DEFINE_EXTENDED:
- *
- * Defines a protocol type similar to PURPLE_PROTOCOL_DEFINE, by additionally
- * specifying the base type and the type flags.
- *
- * The type may be registered statically or dynamically.
- */
-#if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PROTOCOL)
-#define PURPLE_PROTOCOL_DEFINE_EXTENDED(plugin, TypeName, func_prefix, BaseType, TypeFlags) \
-	PURPLE_PROTOCOL_DEFINE_STATIC(TypeName, func_prefix, BaseType, TypeFlags)
-#else
-#define PURPLE_PROTOCOL_DEFINE_EXTENDED(plugin, TypeName, func_prefix, BaseType, TypeFlags) \
-	PURPLE_PROTOCOL_DEFINE_DYNAMIC(plugin, TypeName, func_prefix, BaseType, TypeFlags)
-#endif
-
-/**
- * Defines a protocol type statically using the type name, function prefix,
- * base type and type flags.
- */
-#define PURPLE_PROTOCOL_DEFINE_STATIC(TypeName, func_prefix, BaseType, TypeFlags) \
-	GType func_prefix##_get_type(void) \
-	{ \
-		static GType type = 0; \
-		if (G_UNLIKELY(type == 0)) { \
-			static const GTypeInfo info = { \
-				.class_size = sizeof(TypeName##Class), \
-				.class_init = (GClassInitFunc)func_prefix##_class_init, \
-				.instance_size = sizeof(TypeName), \
-				.instance_init = (GInstanceInitFunc)func_prefix##_init, \
-			}; \
-			static const GInterfaceInfo iface_info = { \
-				.interface_init = (GInterfaceInitFunc)func_prefix##_interface_init, \
-			}; \
-			type = g_type_register_static(BaseType, #TypeName, \
-					                      &info, TypeFlags); \
-			if (type != G_TYPE_INVALID) \
-				g_type_add_interface_static(type, PURPLE_TYPE_PROTOCOL_INTERFACE, \
-				                            &iface_info); \
-		} \
-		return type; \
-	}
-
-/**
- * Defines a protocol type dynamically using the plugin, type name,
- * function prefix, base type and type flags.
- */
-#define PURPLE_PROTOCOL_DEFINE_DYNAMIC(plugin, TypeName, func_prefix, BaseType, TypeFlags) \
-	GType func_prefix##_get_type(void) \
-	{ \
-		static GType type = 0; \
-		if (G_UNLIKELY(type == 0)) { \
-			static const GTypeInfo info = { \
-				.class_size = sizeof(TypeName##Class), \
-				.class_init = (GClassInitFunc)func_prefix##_class_init, \
-				.instance_size = sizeof(TypeName), \
-				.instance_init = (GInstanceInitFunc)func_prefix##_init, \
-			}; \
-			static const GInterfaceInfo iface_info = { \
-				.interface_init = (GInterfaceInitFunc)func_prefix##_interface_init, \
-			}; \
-			if (plugin == NULL) { \
-				purple_debug_error(#TypeName, "Failed to use the type " #TypeName \
-					               " as it's plugin has not been loaded"); \
-				return G_TYPE_INVALID; \
-			} \
-			type = purple_plugin_register_type(plugin, BaseType, #TypeName, \
-				                               &info, TypeFlags); \
-			if (type != G_TYPE_INVALID) \
-				g_type_add_interface_static(type, PURPLE_TYPE_PROTOCOL_INTERFACE, \
-				                            &iface_info); \
-		} \
-		return type; \
-	}
-
 G_BEGIN_DECLS
 
 /**************************************************************************/



More information about the Commits mailing list