summaryrefslogtreecommitdiff
path: root/config/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config/config.c')
-rw-r--r--config/config.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/config/config.c b/config/config.c
index d86f7c649..af8f4f9b2 100644
--- a/config/config.c
+++ b/config/config.c
@@ -122,18 +122,25 @@ device_is_duplicate(const char *config_info)
return FALSE;
}
-void
+/**
+ * Allocate a new option and append to the list.
+ *
+ * @return A pointer to the newly allocated InputOption struct.
+ */
+InputOption*
add_option(InputOption **options, const char *key, const char *value)
{
if (!value || *value == '\0')
- return;
+ return NULL;
for (; *options; options = &(*options)->next)
;
*options = calloc(sizeof(**options), 1);
if (!*options) /* Yeesh. */
- return;
+ return NULL;
(*options)->key = strdup(key);
(*options)->value = strdup(value);
(*options)->next = NULL;
+
+ return *options;
}