Home | History | Annotate | Download | only in src

Lines Matching refs:section

55 static section_t *section_find(const config_t *config, const char *section);
59 static entry_t *entry_find(const config_t *config, const char *section, const char *key);
107 bool config_has_section(const config_t *config, const char *section) {
109 assert(section != NULL);
111 return (section_find(config, section) != NULL);
114 bool config_has_key(const config_t *config, const char *section, const char *key) {
116 assert(section != NULL);
119 return (entry_find(config, section, key) != NULL);
122 int config_get_int(const config_t *config, const char *section, const char *key, int def_value) {
124 assert(section != NULL);
127 entry_t *entry = entry_find(config, section, key);
136 bool config_get_bool(const config_t *config, const char *section, const char *key, bool def_value) {
138 assert(section != NULL);
141 entry_t *entry = entry_find(config, section, key);
153 const char *config_get_string(const config_t *config, const char *section, const char *key, const char *def_value) {
155 assert(section != NULL);
158 entry_t *entry = entry_find(config, section, key);
165 void config_set_int(config_t *config, const char *section, const char *key, int value) {
167 assert(section != NULL);
172 config_set_string(config, section, key, value_str);
175 void config_set_bool(config_t *config, const char *section, const char *key, bool value) {
177 assert(section != NULL);
180 config_set_string(config, section, key, value ? "true" : "false");
183 void config_set_string(config_t *config, const char *section, const char *key, const char *value) {
184 section_t *sec = section_find(config, section);
186 sec = section_new(section);
203 bool config_remove_section(config_t *config, const char *section) {
205 assert(section != NULL);
207 section_t *sec = section_find(config, section);
214 bool config_remove_key(config_t *config, const char *section, const char *key) {
216 assert(section != NULL);
219 section_t *sec = section_find(config, section);
220 entry_t *entry = entry_find(config, section, key);
245 const section_t *section = (const section_t *)list_node(lnode);
246 return section->name;
270 const section_t *section = (const section_t *)list_node(node);
271 fprintf(fp, "[%s]\n", section->name);
273 for (const list_node_t *enode = list_begin(section->entries); enode != list_end(section->entries); enode = list_next(enode)) {
327 char section[1024];
328 strcpy(section, CONFIG_DEFAULT_SECTION);
341 LOG_DEBUG("%s unterminated section name on line %d.", __func__, line_num);
344 strncpy(section, line_ptr + 1, len - 2);
345 section[len - 2] = '\0';
354 config_set_string(config, section, trim(line_ptr), trim(split + 1));
360 section_t *section = osi_calloc(sizeof(section_t));
361 if (!section)
364 section->name = osi_strdup(name);
365 section->entries = list_new(entry_free);
366 return section;
373 section_t *section = ptr;
374 osi_free(section->name);
375 list_free(section->entries);
376 osi_free(section);
379 static section_t *section_find(const config_t *config, const char *section) {
382 if (!strcmp(sec->name, section))
409 static entry_t *entry_find(const config_t *config, const char *section, const char *key) {
410 section_t *sec = section_find(config, section);