# HG changeset patch # User Myhailo Danylenko # Date 1342959951 -10800 # Node ID 170801fe3bdf5cead154dae9910ac7273bbf0121 # Parent dc9cf0b65d1c52ab398a125ef4686be6859952ee Use gslices and build-time api diff -r dc9cf0b65d1c -r 170801fe3bdf disco.c --- a/disco.c Thu Jun 30 16:05:58 2011 +0300 +++ b/disco.c Sun Jul 22 15:25:51 2012 +0300 @@ -47,9 +47,9 @@ #define DESCRIPTION ( "Service discovery requests\nProvides command /disco" ) -static module_info_t info_disco_dev = { - .branch = "dev", - .api = 20, +module_info_t info_disco = { + .branch = MCABBER_BRANCH, + .api = MCABBER_API_VERSION, .version = PROJECT_VERSION, .description = DESCRIPTION, .requires = NULL, @@ -58,28 +58,6 @@ .next = NULL, }; -module_info_t info_disco_0_10_0 = { - .branch = "0.10.0", - .api = 1, - .version = PROJECT_VERSION, - .description = DESCRIPTION, - .requires = NULL, - .init = disco_init, - .uninit = disco_uninit, - .next = &info_disco_dev, -}; - -module_info_t info_disco = { - .branch = "0.10.1", - .api = 1, - .version = PROJECT_VERSION, - .description = DESCRIPTION, - .requires = NULL, - .init = disco_init, - .uninit = disco_uninit, - .next = &info_disco_0_10_0, -}; - // // private types // @@ -125,7 +103,7 @@ disco_info_reply_handler_t *cb = data; if (cb -> notify) cb -> notify (cb -> data); - g_free (cb); + g_slice_free (disco_info_reply_handler_t, cb); return; } @@ -134,7 +112,7 @@ disco_items_reply_handler_t *cb = data; if (cb -> notify) cb -> notify (cb -> data); - g_free (cb); + g_slice_free (disco_items_reply_handler_t, cb); return; } @@ -143,7 +121,7 @@ disco_handler_t *cb = data; g_free (cb -> jid); g_free (cb -> node); - g_free (cb); + g_slice_free (disco_handler_t, cb); return; } @@ -175,7 +153,7 @@ if (node->children) for (node = node->children; node; node = node->next) if (!strcasecmp (node->name, "identity")) { - disco_identity_t *identity = g_new (disco_identity_t, 1); + disco_identity_t *identity = g_slice_new (disco_identity_t); identity -> category = lm_message_node_get_attribute (node, "category"); identity -> type = lm_message_node_get_attribute (node, "type"); @@ -193,7 +171,7 @@ GSList *iel; for (iel = identities; iel; iel = iel -> next) - g_free (iel -> data); + g_slice_free (disco_identity_t, iel -> data); g_slist_free (identities); g_slist_free (features); @@ -255,7 +233,7 @@ if (node->children) for (node = node->children; node; node = node->next) if (!strcasecmp (node->name, "item")) { - disco_item_t *item = g_new (disco_item_t, 1); + disco_item_t *item = g_slice_new (disco_item_t); item -> name = lm_message_node_get_attribute (node, "name"); item -> jid = lm_message_node_get_attribute (node, "jid"); @@ -271,7 +249,7 @@ GSList *iel; for (iel = items; iel; iel = iel -> next) - g_free (iel -> data); + g_slice_free (disco_item_t, iel -> data); g_slist_free (items); } @@ -368,7 +346,7 @@ lm_message_node_set_attribute (node, "node", dnode); { - disco_info_reply_handler_t *cb = g_new (disco_info_reply_handler_t, 1); + disco_info_reply_handler_t *cb = g_slice_new (disco_info_reply_handler_t); lhandler = lm_message_handler_new (disco_info_reply_handler, cb, disco_info_reply_handler_destroy_notify); @@ -417,7 +395,7 @@ lm_message_node_set_attribute (node, "node", dnode); { - disco_items_reply_handler_t *cb = g_new (disco_items_reply_handler_t, 1); + disco_items_reply_handler_t *cb = g_slice_new (disco_items_reply_handler_t); lhandler = lm_message_handler_new (disco_items_reply_handler, cb, disco_items_reply_handler_destroy_notify); @@ -622,7 +600,7 @@ // XXX send to all resources/current resource? { - disco_handler_t *cb = g_new (disco_handler_t, 1); + disco_handler_t *cb = g_slice_new (disco_handler_t); cb -> jid = to; cb -> node = dnode;