static void command_trie_free_with_udata (gpointer elem, gpointer userdata) { command_trie_t *trie = (command_trie_t *) elem; command_trie_free (trie); }
void command_trie_free (command_trie_t *trie) { /* Free the trie recursively */ if (trie->match.type == COMMAND_TRIE_MATCH_ACTION) { command_action_free (trie->match.action); } else if (trie->match.type == COMMAND_TRIE_MATCH_SUBTRIE) { command_action_free (trie->match.action); command_trie_free (trie->match.subtrie); } g_list_foreach (trie->next, command_trie_free_with_udata, NULL); g_list_free (trie->next); g_free (trie); }
void cli_context_free (cli_context_t *ctx) { if (ctx->conn) { xmmsc_unref (ctx->conn); } if (ctx->mode == CLI_EXECUTION_MODE_SHELL) { readline_free (); } command_trie_free (ctx->commands); cli_cache_free (ctx->cache); configuration_free (ctx->config); cmdnames_free (ctx->cmdnames); g_free (ctx); }
CLEANUP () { command_trie_free (trie); trie = NULL; return 0; }