Lines Matching refs:section

59 static section_t *section_find(const config_t *config, const char *section);
63 static entry_t *entry_find(const config_t *config, const char *section, const char *key);
136 bool config_has_section(const config_t *config, const char *section) { in config_has_section() argument
138 assert(section != NULL); in config_has_section()
140 return (section_find(config, section) != NULL); in config_has_section()
143 bool config_has_key(const config_t *config, const char *section, const char *key) { in config_has_key() argument
145 assert(section != NULL); in config_has_key()
148 return (entry_find(config, section, key) != NULL); in config_has_key()
151 int config_get_int(const config_t *config, const char *section, const char *key, int def_value) { in config_get_int() argument
153 assert(section != NULL); in config_get_int()
156 entry_t *entry = entry_find(config, section, key); in config_get_int()
165 bool config_get_bool(const config_t *config, const char *section, const char *key, bool def_value) { in config_get_bool() argument
167 assert(section != NULL); in config_get_bool()
170 entry_t *entry = entry_find(config, section, key); in config_get_bool()
182 const char *config_get_string(const config_t *config, const char *section, const char *key, const c… in config_get_string() argument
184 assert(section != NULL); in config_get_string()
187 entry_t *entry = entry_find(config, section, key); in config_get_string()
194 void config_set_int(config_t *config, const char *section, const char *key, int value) { in config_set_int() argument
196 assert(section != NULL); in config_set_int()
201 config_set_string(config, section, key, value_str); in config_set_int()
204 void config_set_bool(config_t *config, const char *section, const char *key, bool value) { in config_set_bool() argument
206 assert(section != NULL); in config_set_bool()
209 config_set_string(config, section, key, value ? "true" : "false"); in config_set_bool()
212 void config_set_string(config_t *config, const char *section, const char *key, const char *value) { in config_set_string() argument
213 section_t *sec = section_find(config, section); in config_set_string()
215 sec = section_new(section); in config_set_string()
232 bool config_remove_section(config_t *config, const char *section) { in config_remove_section() argument
234 assert(section != NULL); in config_remove_section()
236 section_t *sec = section_find(config, section); in config_remove_section()
243 bool config_remove_key(config_t *config, const char *section, const char *key) { in config_remove_key() argument
245 assert(section != NULL); in config_remove_key()
248 section_t *sec = section_find(config, section); in config_remove_key()
249 entry_t *entry = entry_find(config, section, key); in config_remove_key()
274 const section_t *section = (const section_t *)list_node(lnode); in config_section_name() local
275 return section->name; in config_section_name()
322 const section_t *section = (const section_t *)list_node(node); in config_save() local
323 if (fprintf(fp, "[%s]\n", section->name) < 0) { in config_save()
328 …for (const list_node_t *enode = list_begin(section->entries); enode != list_end(section->entries);… in config_save()
415 char section[1024]; in config_parse() local
416 strcpy(section, CONFIG_DEFAULT_SECTION); in config_parse()
432 strncpy(section, line_ptr + 1, len - 2); in config_parse()
433 section[len - 2] = '\0'; in config_parse()
442 config_set_string(config, section, trim(line_ptr), trim(split + 1)); in config_parse()
449 section_t *section = osi_calloc(sizeof(section_t)); in section_new() local
451 section->name = osi_strdup(name); in section_new()
452 section->entries = list_new(entry_free); in section_new()
453 return section; in section_new()
460 section_t *section = ptr; in section_free() local
461 osi_free(section->name); in section_free()
462 list_free(section->entries); in section_free()
463 osi_free(section); in section_free()
466 static section_t *section_find(const config_t *config, const char *section) { in section_find() argument
469 if (!strcmp(sec->name, section)) in section_find()
494 static entry_t *entry_find(const config_t *config, const char *section, const char *key) { in entry_find() argument
495 section_t *sec = section_find(config, section); in entry_find()