Lines Matching refs:section

47 static section_t *section_find(const config_t *config, const char *section);
51 static entry_t *entry_find(const config_t *config, const char *section, const char *key);
112 bool config_has_section(const config_t *config, const char *section) in config_has_section() argument
115 assert(section != NULL); in config_has_section()
117 return (section_find(config, section) != NULL); in config_has_section()
120 bool config_has_key(const config_t *config, const char *section, const char *key) in config_has_key() argument
123 assert(section != NULL); in config_has_key()
126 return (entry_find(config, section, key) != NULL); in config_has_key()
133 const section_t *section = (const section_t *)list_node(node); in config_has_key_in_section() local
135 …for (const list_node_t *node = list_begin(section->entries); node != list_end(section->entries); n… in config_has_key_in_section()
148 int config_get_int(const config_t *config, const char *section, const char *key, int def_value) in config_get_int() argument
151 assert(section != NULL); in config_get_int()
154 entry_t *entry = entry_find(config, section, key); in config_get_int()
164 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()
185 const char *config_get_string(const config_t *config, const char *section, const char *key, const c… in config_get_string() argument
188 assert(section != NULL); in config_get_string()
191 entry_t *entry = entry_find(config, section, key); in config_get_string()
199 void config_set_int(config_t *config, const char *section, const char *key, int value) in config_set_int() argument
202 assert(section != NULL); in config_set_int()
207 config_set_string(config, section, key, value_str, false); in config_set_int()
210 void config_set_bool(config_t *config, const char *section, const char *key, bool value) in config_set_bool() argument
213 assert(section != NULL); in config_set_bool()
216 config_set_string(config, section, key, value ? "true" : "false", false); in config_set_bool()
219 void config_set_string(config_t *config, const char *section, const char *key, const char *value, b… in config_set_string() argument
221 section_t *sec = section_find(config, section); in config_set_string()
223 sec = section_new(section); in config_set_string()
244 bool config_remove_section(config_t *config, const char *section) in config_remove_section() argument
247 assert(section != NULL); in config_remove_section()
249 section_t *sec = section_find(config, section); in config_remove_section()
257 bool config_update_newest_section(config_t *config, const char *section) in config_update_newest_section() argument
260 assert(section != NULL); in config_update_newest_section()
267 if (strcmp(first_sec->name, section) == 0) { in config_update_newest_section()
273 if (strcmp(sec->name, section) == 0) { in config_update_newest_section()
283 bool config_remove_key(config_t *config, const char *section, const char *key) in config_remove_key() argument
286 assert(section != NULL); in config_remove_key()
290 section_t *sec = section_find(config, section); in config_remove_key()
291 entry_t *entry = entry_find(config, section, key); in config_remove_key()
298 OSI_TRACE_DEBUG("%s remove section name:%s",__func__, section); in config_remove_key()
299 ret &= config_remove_section(config, section); in config_remove_key()
326 const section_t *section = (const section_t *)list_node(lnode); in config_section_name() local
327 return section->name; in config_section_name()
337 const section_t *section = (const section_t *)list_node(node); in get_config_size() local
338 w_len = strlen(section->name) + strlen("[]\n");// format "[section->name]\n" in get_config_size()
341 …for (const list_node_t *enode = list_begin(section->entries); enode != list_end(section->entries);… in get_config_size()
434 const section_t *section = (const section_t *)list_node(node); in config_save() local
435 w_cnt = snprintf(line, 1024, "[%s]\n", section->name); in config_save()
446 …OSI_TRACE_DEBUG("section name: %s, w_cnt + w_cnt_total = %d\n", section->name, w_cnt + w_cnt_total… in config_save()
450 …for (const list_node_t *enode = list_begin(section->entries); enode != list_end(section->entries);… in config_save()
567 char *section = osi_calloc(1024); in config_parse() local
577 if (!line || !section || !buf || !keyname) { in config_parse()
607 strcpy(section, CONFIG_DEFAULT_SECTION); in config_parse()
634 strncpy(section, line_ptr + 1, len - 2); in config_parse()
635 section[len - 2] = '\0'; in config_parse()
643 config_set_string(config, section, trim(line_ptr), trim(split + 1), true); in config_parse()
654 if (section) { in config_parse()
655 osi_free(section); in config_parse()
667 section_t *section = osi_calloc(sizeof(section_t)); in section_new() local
668 if (!section) { in section_new()
672 section->name = osi_strdup(name); in section_new()
673 section->entries = list_new(entry_free); in section_new()
674 return section; in section_new()
683 section_t *section = ptr; in section_free() local
684 osi_free(section->name); in section_free()
685 list_free(section->entries); in section_free()
686 osi_free(section); in section_free()
689 static section_t *section_find(const config_t *config, const char *section) in section_find() argument
693 if (!strcmp(sec->name, section)) { in section_find()
725 static entry_t *entry_find(const config_t *config, const char *section, const char *key) in entry_find() argument
727 section_t *sec = section_find(config, section); in entry_find()