From: Bastian Dehn Date: Sat, 20 Jan 2024 18:02:39 +0000 (+0100) Subject: change device and option descriptor init in mehtods X-Git-Tag: v1.0.0^2~507 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=cf895d665825a097b85e784f93d837450080b7de;p=sane-kds-s2000w-net.git change device and option descriptor init in mehtods --- diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index 6130f89..6230772 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -3,8 +3,6 @@ #include #include -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";