]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change device and option descriptor init in mehtods
authorBastian Dehn <hhaalo@arcor.de>
Sat, 20 Jan 2024 18:02:39 +0000 (19:02 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 20 Jan 2024 18:02:39 +0000 (19:02 +0100)
src/kds_s2000w_net.c

index 6130f89b1d91214b4ed48f28159540ece1fdc49c..623077219dc680616a1563986a84d3030d6e5b96 100644 (file)
@@ -3,8 +3,6 @@
 #include <string.h>
 #include <sane/sane.h>
 
-SANE_Option_Descriptor* optionDescripor = NULL;
-
 SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize)
 {
        *version_code = SANE_VERSION_CODE(1, 0, 0);
@@ -13,8 +11,6 @@ SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback
 
 void _sane_kds_s2000w_net_exit(void)
 {
-       free(optionDescripor);
-       optionDescripor = NULL;
        printf("kds_s2000w_net exit\n");
 }
 
@@ -25,13 +21,13 @@ SANE_Status _sane_kds_s2000w_net_get_devices(SANE_Device*** device_list,
                return SANE_STATUS_NO_MEM;
        }
 
-       SANE_Device device;
-       device.name = "kds_s2000w_net";
-       device.vendor = "Kodak";
-       device.model = "Kodak Alaris s2000w series";
-       device.type = "document scanner";
+       SANE_Device* device = malloc(sizeof(SANE_Device));
+       device->name = "kds_s2000w_net";
+       device->vendor = "Kodak";
+       device->model = "Kodak Alaris s2000w series";
+       device->type = "document scanner";
 
-       **device_list = &device;
+       **device_list = device;
 
        return SANE_STATUS_GOOD;
 }
@@ -54,9 +50,7 @@ void _sane_kds_s2000w_net_close(SANE_Handle handle)
 const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
        SANE_Handle handle, SANE_Int option)
 {
-       printf("kds_s2000w_net get option descriptor\n");
-
-       optionDescripor = malloc(sizeof(SANE_Option_Descriptor));
+       SANE_Option_Descriptor* optionDescripor = malloc(sizeof(SANE_Option_Descriptor));
        optionDescripor->name = "test";
        optionDescripor->title = "test get option descriptor";
        optionDescripor->desc = "function get option descriptor test";