void unloadConfigFile (struct configFile *cfg) { if (!cfg) return; hashFreeTable (cfg->sections, unloadConfigSection); free(cfg->bbdg); free(cfg); }
/** *\brief unload the structure cfg and free all the memory space *\param cfg : the config file struct *\date 2008/04/03 *\return void */ void unloadConfigFile(struct configFile *cfg) { /* by enya #ifdef _GLOBAL_CFG return; #endif */ if (!cfg) return; hashFreeTable(cfg->sections, unloadConfigSection); free(cfg->bbdg); free(cfg); }
/* This function called by hashFreeTable, itself called from unloadConfigFile. * Memory-based data structure of config file is a hash table (config sections) * of hash tables (config options). This function frees the config options * hashtables as each config section is freed. */ void unloadConfigSection (void *data) { struct hash_table *sectionTable = data; hashFreeTable (sectionTable, NULL); }
/*\brief This function called by hashFreeTable, itself called from unloadConfigFile. * * Memory-based data structure of config file is a hash table (config sections) * of hash tables (config options). This function frees the config options * hashtables as each config section is freed. * * \param data : the config section data * \data 2008/04/03 * \return void */ static void unloadConfigSection(void *data) { struct hash_table *sectionTable = (struct hash_table*)data; hashFreeTable(sectionTable, free); }