From 66d0e245b73c53decf69c4ad708a4eb18c02e1c7 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Mon, 22 Jan 2024 20:37:09 +0100 Subject: [PATCH] make callback function private --- src/kds_s2000w_client.c | 6 +++--- src/kds_s2000w_client.h | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/kds_s2000w_client.c b/src/kds_s2000w_client.c index da787e0..628fe64 100644 --- a/src/kds_s2000w_client.c +++ b/src/kds_s2000w_client.c @@ -3,7 +3,7 @@ #include #include "kds_s2000w_client.h" -size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata) +size_t kds_s2000w_client_callback(char *ptr, size_t size, size_t nmemb, void *userdata) { response* data = (response*) userdata; size_t fullsize = size * nmemb; @@ -55,7 +55,7 @@ int kds_s2000w_client_open_session(const char* username, response* response) curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_POST, 1L); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, kds_s2000w_client_callback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*) response); CURLcode result = curl_easy_perform(curl); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response->code); @@ -105,7 +105,7 @@ int kds_s2000w_client_get_option(int64_t sessionid, response* response) curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, kds_s2000w_client_callback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*) response); CURLcode result = curl_easy_perform(curl); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response->code); diff --git a/src/kds_s2000w_client.h b/src/kds_s2000w_client.h index 79c85f7..ca0b123 100644 --- a/src/kds_s2000w_client.h +++ b/src/kds_s2000w_client.h @@ -5,9 +5,6 @@ typedef struct { long code; } response; -// TODO: private method -size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata); - response* kds_s2000w_client_response_init(); void kds_s2000w_client_response_free(response* response); int kds_s2000w_client_open_session(const char* username, response* response); -- 2.39.5