From 44ec797349713f28314bd329bee940cd55fad411 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 10 Nov 2019 18:49:28 -0800 Subject: settings: s/setting_desc_new/setting_desc_clone/ Slight refactor to make call sites less annoying. Now takes a (setting_desc_t *) instead of the members as discrete parameters, and returns an errno on error so callers can simply propagate error codes out rather than having to get access to errno defines, check for NULL and return -ENOMEM etc. It also makes the call sites self documenting by employing designated initializers in compound literals for the supplied setting_desc_t. This is in prep for runtime-configurable module settings. --- src/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settings.h') diff --git a/src/settings.h b/src/settings.h index fe35b19..6803d09 100644 --- a/src/settings.h +++ b/src/settings.h @@ -30,7 +30,7 @@ int settings_add_value(settings_t *settings, const char *key, const char *value) char * settings_as_arg(const settings_t *settings); int settings_apply_desc_generators(const settings_t *settings, const setting_desc_generator_t generators[], unsigned n_generators, void *setup_context, setting_desc_t **next_setting); -setting_desc_t * setting_desc_new(const char *name, const char *key, const char *regex, const char *preferred, const char *values[], const char *annotations[]); +int setting_desc_clone(const setting_desc_t *desc, setting_desc_t **res_desc); void setting_desc_free(setting_desc_t *desc); #endif -- cgit v1.2.1