summaryrefslogtreecommitdiff
path: root/request.h
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-13 08:40:26 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-13 08:40:26 +0800
commitdaf858c02db1a5a12151d142ce55dfe9fbb2b715 (patch)
treed6343c4f8b7ef9bad9e3a17264b201f6b8012791 /request.h
parent0a6e2943843ca894abc562ba98bcbf3399769481 (diff)
Merge catalog and product to client
Diffstat (limited to 'request.h')
-rw-r--r--request.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/request.h b/request.h
index a43a44a..19ed118 100644
--- a/request.h
+++ b/request.h
@@ -4,11 +4,10 @@
#if defined __ANDROID__ && defined DEBUG
#include <android/log.h>
#endif
-#include <string.h>
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdbool.h>
+#include <stdarg.h>
+#include <string.h>
#ifndef __EMSCRIPTEN__
#include <curl/curl.h>
#endif
@@ -29,12 +28,11 @@ extern CURL *curl;
extern char *server_url;
#endif
-inline bool icclient_request_init(const char *url, const char *certificate)
+inline void icclient_request_init(const char *url, const char *certificate)
{
#ifdef __EMSCRIPTEN__
emscripten_fetch_attr_init(&attr);
attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY;
- return true;
#else
curl_global_init(CURL_GLOBAL_SSL);
curl = curl_easy_init();
@@ -47,13 +45,12 @@ inline bool icclient_request_init(const char *url, const char *certificate)
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
#endif
size_t length = strlen(url);
- bool append = !(bool)(url[length - 1] == '/');
- server_url = malloc(length + (size_t)append + 1);
+ size_t append = !(url[length - 1] == '/');
+ server_url = malloc(length + append + 1);
strcpy(server_url, url);
if (append)
strcat(server_url, "/");
}
- return (bool)curl;
#endif
}