From 2f43254441ce1c833efd192b0348d6298b0ece9b Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Tue, 23 Jan 2024 19:57:51 +0100 Subject: [PATCH] add switch block for options --- src/kds_s2000w_handler.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/kds_s2000w_handler.c b/src/kds_s2000w_handler.c index a6debca..0be3ea6 100644 --- a/src/kds_s2000w_handler.c +++ b/src/kds_s2000w_handler.c @@ -82,11 +82,15 @@ void kds_s2000w_handler_get_option(int option, void* value) if (_all_options == NULL) return; - json_object* config = json_object_object_get(_all_options, "Configuration"); - int* num_options = (int*) value; - *num_options = 0; - *num_options = json_object_object_length(config); - *num_options++; + switch(option) { + default: + json_object* config = json_object_object_get(_all_options, "Configuration"); + int* num_options = (int*) value; + *num_options = 0; + *num_options = json_object_object_length(config); + *num_options++; + break; + } } void kds_s2000w_handler_set_option(int option, void* value) -- 2.39.5