void cmdnames_free (GList *list) { GList *it; command_name_t *cmd; for (it = g_list_first (list); it != NULL; it = g_list_next (it)) { cmd = it->data; cmdnames_free (cmd->subcommands); g_free (cmd->name); g_free (cmd); } g_list_free (list); }
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); }