Use gslices and build-time api version
authorMyhailo Danylenko <isbear@ukrpost.net>
Sun, 22 Jul 2012 15:53:23 +0300
changeset 17 82331654a753
parent 16 e7c65942ce5c
child 18 aeb36f2945de
Use gslices and build-time api version
templatecmd.c
--- a/templatecmd.c	Thu Jun 30 16:23:20 2011 +0300
+++ b/templatecmd.c	Sun Jul 22 15:53:23 2012 +0300
@@ -33,9 +33,9 @@
 
 #define DESCRIPTION ( "Templated commands\nProvides command /templatecmd (and any commands, you define with it)" )
 
-static module_info_t info_templatecmd_dev = {
-	.branch      = "dev",
-	.api         = 20,
+module_info_t info_templatecmd = {
+	.branch      = MCABBER_BRANCH,
+	.api         = MCABBER_API_VERSION,
 	.version     = PROJECT_VERSION,
 	.description = DESCRIPTION,
 	.requires    = NULL,
@@ -44,17 +44,6 @@
 	.next        = NULL,
 };
 
-module_info_t info_templatecmd = {
-	.branch      = "0.10.1",
-	.api         = 1,
-	.version     = PROJECT_VERSION,
-	.description = DESCRIPTION,
-	.requires    = NULL,
-	.init        = tcmd_init,
-	.uninit      = tcmd_uninit,
-	.next        = &info_templatecmd_dev,
-};
-
 typedef struct {
 	gchar    *name;
 #ifdef MCABBER_API_HAVE_CMD_ID
@@ -184,13 +173,13 @@
 					template_commands = g_slist_remove (template_commands, template_command);
 					g_free (template_command -> name);
 					g_free (template_command -> template);
-					g_free (template_command);
+					g_slice_free (tcmd_t, template_command);
 				}
 				return;
 			}
 
 			if (!template_command) {
-				template_command = g_new (tcmd_t, 1);
+				template_command = g_slice_new (tcmd_t);
 				template_command -> name = g_strndup (arg, len);
 			} else
 				g_free (template_command -> template);
@@ -266,7 +255,7 @@
 #endif
 		g_free (template_command -> name);
 		g_free (template_command -> template);
-		g_free (template_command);
+		g_slice_free (tcmd_t, template_command);
 	}
 
 	g_slist_free (template_commands);