Solve minor bug (double value_destroy) in configuration object map.
@@ -51,8 +51,6 @@ static char * configuration_object_read(const char * path);
static int configuration_object_childs_cb_iterate(set s, set_key key, set_value val, set_cb_iterate_args args);
-static int configuration_object_destroy_cb_iterate(set s, set_key key, set_value val, set_cb_iterate_args args);
-
/* -- Methods -- */
int configuration_object_initialize_cb_iterate(set s, set_key key, set_value val, set_cb_iterate_args args)
@@ -327,22 +325,6 @@ value configuration_object_get(configuration config, const char * key)
return set_get(config->map, (set_key)key);
}
-int configuration_object_destroy_cb_iterate(set s, set_key key, set_value val, set_cb_iterate_args args)
-{
- (void)s;
- (void)key;
- (void)args;
-
- if (val != NULL)
- {
- value v = val;
-
- value_destroy(v);
- }
-
- return 0;
-}
-
void configuration_object_destroy(configuration config)
{
if (config->name != NULL)
@@ -357,24 +339,7 @@ void configuration_object_destroy(configuration config)
if (config->v != NULL)
{
- size_t index, size = value_type_size(config->v) / sizeof(value);
-
- value * v_map = value_to_map(config->v);
-
- for (index = 0; index < size; ++index)
- {
- value iterator = v_map[index];
-
- value * tupla = value_to_array(iterator);
-
- value_destroy(tupla[0]);
-
- value_destroy(tupla[1]);
-
- value_destroy(iterator);
- }
-
- value_destroy(config->v);
+ value_type_destroy(config->v);
}
if (config->source != NULL)
@@ -382,8 +347,6 @@ void configuration_object_destroy(configuration config)
free(config->source);
}
- set_iterate(config->map, &configuration_object_destroy_cb_iterate, NULL);
-
set_destroy(config->map);
free(config);
