52 |
52 |
53 return conf; |
53 return conf; |
54 } |
54 } |
55 |
55 |
56 void free_init_config(InitConfig *conf) { |
56 void free_init_config(InitConfig *conf) { |
57 ucx_mempool_destroy(conf->parser.mp->pool); |
57 // TODO: fix |
|
58 //ucx_mempool_destroy(conf->parser.mp->pool); |
58 free(conf); |
59 free(conf); |
59 } |
60 } |
60 |
61 |
61 int initconf_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line) { |
62 int initconf_parse(void *p, ConfigLine *begin, ConfigLine *end, cxmutstr line) { |
62 InitConfig *conf = p; |
63 InitConfig *conf = p; |
63 |
64 |
64 // parse directive |
65 // parse directive |
65 ConfigDirective *d = cfg_parse_directive(line, conf->parser.mp); |
66 ConfigDirective *d = cfg_parse_directive(line, conf->parser.mp); |
66 if(d == NULL) { |
67 if(d == NULL) { |
68 return 0; |
69 return 0; |
69 } |
70 } |
70 d->begin = begin; |
71 d->begin = begin; |
71 d->end = end; |
72 d->end = end; |
72 if(d->type_num == INIT_DIRECTIVE) { |
73 if(d->type_num == INIT_DIRECTIVE) { |
73 conf->directives = ucx_list_append(conf->directives, d); |
74 //conf->directives = ucx_list_append(conf->directives, d); |
|
75 ConfigDirectiveList *dir_entry = cxMalloc(conf->parser.mp, sizeof(ConfigDirectiveList)); |
|
76 dir_entry->directive = d; |
|
77 dir_entry->next = NULL; |
|
78 CFG_DIRECTIVES_ADD(&conf->directives, dir_entry); |
74 } else { |
79 } else { |
75 log_ereport(LOG_WARN, "Non Init directive in init.conf"); |
80 log_ereport(LOG_WARN, "Non Init directive in init.conf"); |
76 } |
81 } |
77 |
82 |
78 return 0; |
83 return 0; |