comparison config.c @ 1485:369da70ee2c2 nuklear_ui

Filter file list in Nuklear UI
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Nov 2017 18:33:36 -0800
parents 4490c9c12272
children 637fbc3b5063
comparison
equal deleted inserted replaced
1484:d82af64c94d2 1485:369da70ee2c2
153 fatal_error("Failed to find a config file in the BlastEm executable directory and the config directory path could not be determined\n"); 153 fatal_error("Failed to find a config file in the BlastEm executable directory and the config directory path could not be determined\n");
154 } 154 }
155 //this will never get reached, but the compiler doesn't know that. Let's make it happy 155 //this will never get reached, but the compiler doesn't know that. Let's make it happy
156 return NULL; 156 return NULL;
157 } 157 }
158
159 char **get_extension_list(tern_node *config, uint32_t *num_exts_out)
160 {
161 char *ext_filter = strdup(tern_find_path_default(config, "ui\0extensions\0", (tern_val){.ptrval = "bin gen md smd sms gg"}, TVAL_PTR).ptrval);
162 uint32_t num_exts = 0, ext_storage = 5;
163 char **ext_list = malloc(sizeof(char *) * ext_storage);
164 char *cur_filter = ext_filter;
165 while (*cur_filter)
166 {
167 if (num_exts == ext_storage) {
168 ext_storage *= 2;
169 ext_list = realloc(ext_list, sizeof(char *) * ext_storage);
170 }
171 ext_list[num_exts++] = cur_filter;
172 cur_filter = split_keyval(cur_filter);
173 }
174 free(ext_filter);
175 *num_exts_out = num_exts;
176 return ext_list;
177 }