From: Bastian Dehn Date: Tue, 7 Oct 2025 16:27:45 +0000 (+0200) Subject: change optimize get option X-Git-Tag: v1.1.9^2~1^2~16 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=041f922883352cd90e424fc36d0836a7151eddd3;p=sane-kds-s2000w-net.git change optimize get option --- diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index 8ea46f0..2acd930 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -336,20 +336,17 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value _kds_s2000w_handler_opts_set_options(h); } - if (h->current_scanner_config != NULL) - config = json_object_object_get(h->current_scanner_config, "Configuration"); + config = json_object_object_get(h->current_scanner_config, "Configuration"); option_descriptor* descriptor = kds_s2000w_option_descriptors_full_get_by_number(option); - json_object* value_object = NULL; if (strcmp(descriptor->config_name, OPTION_COUNT) == 0) { - config = json_object_object_get(h->current_scanner_config, "Configuration"); - int32_t* int_value_ptr = (int32_t*) value; - *int_value_ptr = kds_s2000w_option_descriptors_get_max_option_count(); + int32_t* int_value = (int32_t*) value; + *int_value = kds_s2000w_option_descriptors_get_max_option_count(); return; } + json_object* value_object = json_object_object_get(config, descriptor->config_name); if (strcmp(descriptor->config_name, SCAN_SOURCE) == 0) { - value_object = json_object_object_get(config, descriptor->config_name); _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor->type, value); if (strcmp(value, "Flatbed") == 0) @@ -364,7 +361,6 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value return; } - value_object = json_object_object_get(config, descriptor->config_name); _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor->type, value); }