diff options
Diffstat (limited to 'src/rototiller.c')
-rw-r--r-- | src/rototiller.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/rototiller.c b/src/rototiller.c index 92821c2..7203ca2 100644 --- a/src/rototiller.c +++ b/src/rototiller.c @@ -162,17 +162,18 @@ static int setup_video(settings_t *settings, setting_desc_t **next_setting) "sdl", NULL, }; - - desc = setting_desc_new("Video Backend", - NULL, - "[a-z]+", - DEFAULT_VIDEO, - values, - NULL); - if (!desc) - return -ENOMEM; - - *next_setting = desc; + int r; + + r = setting_desc_clone(&(setting_desc_t){ + .name = "Video Backend", + .key = NULL, + .regex = "[a-z]+", + .preferred = DEFAULT_VIDEO, + .values = values, + .annotations = NULL + }, next_setting); + if (r < 0) + return r; return 1; } @@ -207,22 +208,23 @@ static int setup_module(settings_t *settings, setting_desc_t **next_setting) const char *annotations[nelems(modules) + 1] = {}; setting_desc_t *desc; unsigned i; + int r; for (i = 0; i < nelems(modules); i++) { values[i] = modules[i]->name; annotations[i] = modules[i]->description; } - desc = setting_desc_new("Renderer Module", - NULL, - "[a-zA-Z0-9]+", - DEFAULT_MODULE, - values, - annotations); - if (!desc) - return -ENOMEM; - - *next_setting = desc; + r = setting_desc_clone(&(setting_desc_t){ + .name = "Renderer Module", + .key = NULL, + .regex = "[a-zA-Z0-9]+", + .preferred = DEFAULT_MODULE, + .values = values, + .annotations = annotations + }, next_setting); + if (r < 0) + return r; return 1; } |