]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
Revert "change only custom strdup callback"
authorBastian Dehn <hhaalo@arcor.de>
Sun, 2 Feb 2025 16:48:18 +0000 (17:48 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 2 Feb 2025 16:48:18 +0000 (17:48 +0100)
This reverts commit 3513b4b432295757070e992fa361190564707fe6.

src/kds_s2000w_client.c

index 164437d1e79cb14c833742e8c0056ac182dbc06e..799b7409d91e3e69637adbe861af4e51101f4a4a 100644 (file)
@@ -26,6 +26,18 @@ CURL* curl = NULL;
 program_config* config = NULL;
 char* errbuf = NULL;
 
+void *_kds_s2000w_client_malloc_cb(size_t size)
+{
+       return malloc(size);
+}
+void _kds_s2000w_client_free_cb(void * ptr)
+{
+       free(ptr);
+}
+void *_kds_s2000w_client_realloc_cb(void * ptr, size_t size)
+{
+       return realloc(ptr, size);
+}
 char *_kds_s2000w_client_strdup_cb(const char * str)
 {
        if (strlen(str) == 0) {
@@ -34,6 +46,10 @@ char *_kds_s2000w_client_strdup_cb(const char * str)
 
        return strdup(str);
 }
+void *_kds_s2000w_client_calloc_cb(size_t nmemb, size_t size)
+{
+       return calloc(nmemb, size);
+}
 
 void _kds_s2000w_client_print_error_status(CURL* curl)
 {
@@ -77,11 +93,11 @@ void kds_s2000w_client_init()
        char* config_stream = kds_s2000w_config_read(CONFIG_FILE);
        config = kds_s2000w_load_config(config_stream);
        curl_global_init_mem(CURL_GLOBAL_DEFAULT,
-               malloc,
-               free,
-               realloc,
+               _kds_s2000w_client_malloc_cb,
+               _kds_s2000w_client_free_cb,
+               _kds_s2000w_client_realloc_cb,
                _kds_s2000w_client_strdup_cb,
-               calloc);
+               _kds_s2000w_client_calloc_cb);
        curl = curl_easy_init();
        errbuf = malloc(CURL_ERROR_SIZE);
        memset(errbuf, 0, CURL_ERROR_SIZE);