Lines Matching defs:section

31 static section_t *section_find(const config_t *config, const char *section);
35 static entry_t *entry_find(const config_t *config, const char *section, const char *key);
69 bool config_has_section(const config_t *config, const char *section) {
71 assert(section != NULL);
73 return (section_find(config, section) != NULL);
76 bool config_has_key(const config_t *config, const char *section, const char *key) {
78 assert(section != NULL);
81 return (entry_find(config, section, key) != NULL);
84 int config_get_int(const config_t *config, const char *section, const char *key, int def_value) {
86 assert(section != NULL);
89 entry_t *entry = entry_find(config, section, key);
98 bool config_get_bool(const config_t *config, const char *section, const char *key, bool def_value) {
100 assert(section != NULL);
103 entry_t *entry = entry_find(config, section, key);
115 const char *config_get_string(const config_t *config, const char *section, const char *key, const char *def_value) {
117 assert(section != NULL);
120 entry_t *entry = entry_find(config, section, key);
127 void config_set_int(config_t *config, const char *section, const char *key, int value) {
129 assert(section != NULL);
134 config_set_string(config, section, key, value_str);
137 void config_set_bool(config_t *config, const char *section, const char *key, bool value) {
139 assert(section != NULL);
142 config_set_string(config, section, key, value ? "true" : "false");
145 void config_set_string(config_t *config, const char *section, const char *key, const char *value) {
146 section_t *sec = section_find(config, section);
148 sec = section_new(section);
186 char section[1024];
187 strcpy(section, CONFIG_DEFAULT_SECTION);
200 ALOGD("%s unterminated section name on line %d.", __func__, line_num);
203 strncpy(section, line_ptr + 1, len - 2);
204 section[len - 2] = '\0';
213 config_set_string(config, section, trim(line_ptr), trim(split + 1));
219 section_t *section = calloc(1, sizeof(section_t));
220 if (!section)
223 section->name = strdup(name);
224 section->entries = list_new(entry_free);
225 return section;
232 section_t *section = ptr;
233 free(section->name);
234 list_free(section->entries);
237 static section_t *section_find(const config_t *config, const char *section) {
240 if (!strcmp(sec->name, section))
266 static entry_t *entry_find(const config_t *config, const char *section, const char *key) {
267 section_t *sec = section_find(config, section);