42 conf->parser.parse = initconf_parse; |
42 conf->parser.parse = initconf_parse; |
43 conf->file = file; |
43 conf->file = file; |
44 conf->directives = NULL; |
44 conf->directives = NULL; |
45 |
45 |
46 int r = cfg_parse_basic_file((ConfigParser*)conf, in); |
46 int r = cfg_parse_basic_file((ConfigParser*)conf, in); |
47 cfg_dlist_destr(conf->parser.mp, conf->directives); |
|
48 if(r != 0) { |
47 if(r != 0) { |
49 free_init_config(conf); |
48 free_init_config(conf); |
50 return NULL; |
49 return NULL; |
51 } |
50 } |
52 fclose(in); |
51 fclose(in); |
53 |
52 |
54 return conf; |
53 return conf; |
55 } |
54 } |
56 |
55 |
57 void free_init_config(InitConfig *conf) { |
56 void free_init_config(InitConfig *conf) { |
58 ucx_mempool_destroy(conf->parser.mp); |
57 ucx_mempool_destroy(conf->parser.mp->pool); |
59 free(conf); |
58 free(conf); |
60 } |
59 } |
61 |
60 |
62 int initconf_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line) { |
61 int initconf_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line) { |
63 InitConfig *conf = p; |
62 InitConfig *conf = p; |