src/server/config/objconf.c

changeset 79
f48cea237ec3
parent 62
c47e081b6c0f
child 83
28433f06d5ee
--- a/src/server/config/objconf.c	Tue Jun 25 22:18:59 2013 +0200
+++ b/src/server/config/objconf.c	Wed Jun 26 15:09:54 2013 +0200
@@ -50,7 +50,7 @@
     conf->conditions = NULL;
     conf->levels = NULL;
     conf->objects = NULL;
-    conf->lines = NULL;
+    //conf->lines = NULL;
 
     int r = cfg_parse_basic_file((ConfigParser*)conf, in);
     if(r != 0) {
@@ -64,33 +64,10 @@
 }
 
 void free_object_config(ObjectConfig *conf) {
-    // free all objects
-    UcxDlist *objects = conf->objects;
-    while(objects != NULL) {
-        ConfigObject *obj = objects->data;
-        // free all directive lists
-        for(int i=0;i<6;i++) {
-            if(obj->directives[i]) {
-                ucx_dlist_free(obj->directives[i]);
-            }
-        }
-
-        objects = objects->next;
-    }
-    if(conf->objects) {
-        ucx_dlist_free(conf->objects);
-    }
-
     // free other lists
     if(conf->levels) {
         ucx_list_free(conf->levels);
     }
-    if(conf->lines) {
-        ucx_dlist_free(conf->lines);
-    }
-    if(conf->conditions) {
-        ucx_dlist_free(conf->conditions);
-    }
 
     // free mempool
     ucx_mempool_free(conf->parser.mp);
@@ -145,6 +122,7 @@
 }
 
 int objconf_on_begin_tag(ObjectConfig *conf, ConfigTag *tag) {
+    UcxMempool *mp = conf->parser.mp;
     if(tag->type_num != TAG_OBJECT) {
         ConfigParserLevel *l = conf->levels->data;
         if(l->tag->type_num != TAG_OBJECT) {
@@ -163,7 +141,7 @@
             obj->ppath = cfg_param_get(tag->param, sstr("ppath"));
 
             conf->obj = obj;
-            conf->objects = ucx_dlist_append(conf->objects, obj);
+            conf->objects = cfg_dlist_append(mp, conf->objects, obj);
 
             // create tree level object
             ConfigParserLevel *lvl = OBJ_NEW(conf->parser.mp, ConfigParserLevel);
@@ -251,7 +229,8 @@
     }
 
     // add directive to current object
-    conf->obj->directives[dir->type_num] = ucx_dlist_append(
+    conf->obj->directives[dir->type_num] = cfg_dlist_append(
+            conf->parser.mp,
             conf->obj->directives[dir->type_num],
             dir);
 

mercurial