--- a/src/server/config/serverconf.c Tue Jun 25 22:18:59 2013 +0200 +++ b/src/server/config/serverconf.c Wed Jun 26 15:09:54 2013 +0200 @@ -41,11 +41,11 @@ ServerConfig *conf = malloc(sizeof(ServerConfig)); conf->parser.parse = serverconf_parse; conf->file = file; - conf->objects = ucx_map_new(161); - + conf->objects = ucx_map_new(16); conf->obj = NULL; int r = cfg_parse_basic_file((ConfigParser*)conf, in); + cfg_map_destr(conf->parser.mp, conf->objects); if(r != 0) { // TODO: free return NULL; @@ -57,11 +57,13 @@ } void free_server_config(ServerConfig *conf) { - // TODO + ucx_mempool_free(conf->parser.mp); + free(conf); } int serverconf_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line){ ServerConfig *conf = p; + UcxMempool *mp = conf->parser.mp; begin->type = cfg_get_line_type(line); switch(begin->type) { @@ -79,7 +81,7 @@ // add object to server config UcxList *list = ucx_map_sstr_get(conf->objects, obj->type); - list = ucx_list_append(list, obj); + list = cfg_list_append(mp, list, obj); ucx_map_sstr_put(conf->objects, obj->type, list); conf->obj = obj; @@ -107,7 +109,7 @@ d->end = end; //printf("%s.%s\n", conf->obj->type.ptr, d->directive_type.ptr); - conf->obj->directives = ucx_dlist_append(conf->obj->directives, d); + conf->obj->directives = cfg_dlist_append(mp, conf->obj->directives, d); } } return 0;