Changeset 272

Show
Ignore:
Timestamp:
04/16/06 17:27:54 (3 years ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r271 r272  
    112006-04-16  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/server.c (cherokee_server_read_config_string): It 
     4        doesn't make sente to keep the configuration nodes when the server 
     5        start running, so now it frees it as soon as everything is parsed. 
     6 
     7        * cherokee/config_node.h, 
     8        cherokee/config_node.c (cherokee_config_node_new, 
     9        cherokee_config_node_free): Added two new method (beside the 
     10        stack'ed version _init()/_mrproper()). 
    211 
    312        * cherokee/main_admin.c (config_server): Now it uses the new 
  • cherokee/trunk/cherokee/config_node.c

    r270 r272  
    4343 
    4444ret_t  
     45cherokee_config_node_new (cherokee_config_node_t **conf) 
     46{ 
     47        CHEROKEE_NEW_STRUCT(n,config_node); 
     48 
     49        cherokee_config_node_init (n); 
     50 
     51        *conf = n; 
     52        return ret_ok; 
     53} 
     54 
     55 
     56ret_t  
    4557cherokee_config_node_mrproper (cherokee_config_node_t *conf) 
    4658{ 
     59        list_t *i, *j; 
     60 
    4761        cherokee_buffer_mrproper (&conf->key); 
    4862        cherokee_buffer_mrproper (&conf->val); 
    4963 
     64        list_for_each_safe (i, j, &conf->child) { 
     65                cherokee_config_node_free (CONFIG_NODE(i)); 
     66        } 
     67 
     68        return ret_ok; 
     69} 
     70 
     71ret_t  
     72cherokee_config_node_free (cherokee_config_node_t *conf) 
     73{ 
     74        cherokee_config_node_mrproper (conf); 
     75 
     76        free (conf); 
    5077        return ret_ok; 
    5178} 
     
    6895} 
    6996 
     97 
    7098static cherokee_config_node_t * 
    7199add_new_child (cherokee_config_node_t *entry, cherokee_buffer_t *key) 
    72100{ 
     101        ret_t                   ret; 
    73102        cherokee_config_node_t *n; 
    74103 
    75         n = (cherokee_config_node_t *) malloc(sizeof(cherokee_config_node_t)); 
    76         if (unlikely(n==NULL)) return NULL; 
    77             
    78         cherokee_config_node_init (n); 
     104        ret = cherokee_config_node_new (&n); 
     105        if (ret != ret_ok) return NULL; 
     106 
    79107        cherokee_buffer_add_buffer (&n->key, key);          
    80108 
  • cherokee/trunk/cherokee/config_node.h

    r270 r272  
    5252typedef ret_t (* cherokee_config_node_list_func_t)  (char *, void *); 
    5353 
     54ret_t cherokee_config_node_new       (cherokee_config_node_t **conf); 
     55ret_t cherokee_config_node_free      (cherokee_config_node_t *conf); 
     56 
    5457ret_t cherokee_config_node_init      (cherokee_config_node_t *conf); 
    5558ret_t cherokee_config_node_mrproper  (cherokee_config_node_t *conf); 
  • cherokee/trunk/cherokee/server.c

    r270 r272  
    14591459        if (ret != ret_ok) return ret; 
    14601460 
    1461         return configure_server (srv); 
     1461        ret = configure_server (srv); 
     1462        if (ret != ret_ok) return ret; 
     1463 
     1464        /* Clean up 
     1465         */ 
     1466        ret = cherokee_config_node_mrproper (&srv->config); 
     1467        if (ret != ret_ok) return ret; 
     1468         
     1469        return ret_ok; 
    14621470} 
    14631471 
     
    14721480        if (ret != ret_ok) return ret; 
    14731481 
    1474         return configure_server (srv); 
     1482        ret = configure_server (srv); 
     1483        if (ret != ret_ok) return ret; 
     1484 
     1485        /* Clean up 
     1486         */ 
     1487        ret = cherokee_config_node_mrproper (&srv->config); 
     1488        if (ret != ret_ok) return ret; 
     1489 
     1490        return ret_ok; 
    14751491} 
    14761492