Home | History | Annotate | Download | only in src

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,
135 bool config_has_section(const config_t* config, const char* section) {
137 CHECK(section != NULL);
139 return (section_find(config, section) != NULL);
142 bool config_has_key(const config_t* config, const char* section,
145 CHECK(section != NULL);
148 return (entry_find(config, section, key) != NULL);
151 int config_get_int(const config_t* config, const char* section, const char* key,
154 CHECK(section != NULL);
157 entry_t* entry = entry_find(config, section, key);
165 bool config_get_bool(const config_t* config, const char* section,
168 CHECK(section != NULL);
171 entry_t* entry = entry_find(config, section, key);
180 const char* config_get_string(const config_t* config, const char* section,
183 CHECK(section != NULL);
186 entry_t* entry = entry_find(config, section, key);
192 void config_set_int(config_t* config, const char* section, const char* key,
195 CHECK(section != NULL);
200 config_set_string(config, section, key, value_str);
203 void config_set_bool(config_t* config, const char* section, const char* key,
206 CHECK(section != NULL);
209 config_set_string(config, section, key, value ? "true" : "false");
212 void config_set_string(config_t* config, const char* section, const char* key,
214 section_t* sec = section_find(config, section);
216 sec = section_new(section);
234 bool config_remove_section(config_t* config, const char* section) {
236 CHECK(section != NULL);
238 section_t* sec = section_find(config, section);
244 bool config_remove_key(config_t* config, const char* section, const char* key) {
246 CHECK(section != NULL);
249 section_t* sec = section_find(config, section);
250 entry_t* entry = entry_find(config, section, key);
275 const section_t* section = (const section_t*)list_node(lnode);
276 return section->name;
327 const section_t* section = (const section_t*)list_node(node);
328 if (fprintf(fp, "[%s]\n", section->name) < 0) {
334 for (const list_node_t* enode = list_begin(section->entries);
335 enode != list_end(section->entries); enode = list_next(enode)) {
427 char section[1024];
428 strcpy(section, CONFIG_DEFAULT_SECTION);
440 LOG_DEBUG(LOG_TAG, "%s unterminated section name on line %d.", __func__,
444 strncpy(section, line_ptr + 1, len - 2);
445 section[len - 2] = '\0';
455 config_set_string(config, section, trim(line_ptr), trim(split + 1));
462 section_t* section = static_cast<section_t*>(osi_calloc(sizeof(section_t)));
464 section->name = osi_strdup(name);
465 section->entries = list_new(entry_free);
466 return section;
472 section_t* section = static_cast<section_t*>(ptr);
473 osi_free(section->name);
474 list_free(section->entries);
475 osi_free(section);
478 static section_t* section_find(const config_t* config, const char* section) {
482 if (!strcmp(sec->name, section)) return sec;
505 static entry_t* entry_find(const config_t* config, const char* section,
507 section_t* sec = section_find(config, section);