From 8960e72d3b9db874563a9b5e020125ba2aaf083b Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 28 Apr 2020 21:58:11 +0300 Subject: [PATCH] update to the latest ABI --- src/wrapper.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/wrapper.c b/src/wrapper.c index 7657f47..26f971f 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -15,14 +15,38 @@ int init() { int g_isInited = 0; +void store(char *ptr, unsigned char byte) { + *ptr = byte; +} + +void sqlite_store(char *ptr, unsigned char byte) { + store(ptr, byte); +} + +unsigned char load(const unsigned char *ptr) { + return *ptr; +} + +unsigned char sqlite_load(const unsigned char *ptr) { + return load(ptr); +} + void* allocate(size_t size) { return malloc(size + 1); } +void* sqlite_allocate(size_t size) { + return allocate(size); +} + void deallocate(void *ptr, int size) { free(ptr); } +void sqlite_deallocate(void *ptr, int size) { + deallocate(ptr, size); +} + char *write_response(char *response, int response_size) { char *result_response = allocate(response_size + 4); @@ -36,9 +60,9 @@ char *write_response(char *response, int response_size) { typedef struct ShellText ShellText; struct ShellText { - char *z; - int n; - int nAlloc; + char *z; + int n; + int nAlloc; }; static void initText(ShellText *p){ @@ -112,7 +136,7 @@ const char *invoke(char *request, int request_size) { init(); #if LOG_ENABLED - const char successInitMessage[] = "Sqlite has been initialized"; + const char successInitMessage[] = "Sqlite has been initialized\n"; log_utf8_string(successInitMessage, sizeof(successInitMessage)); #endif @@ -150,3 +174,6 @@ const char *invoke(char *request, int request_size) { return response; } +const char *sqlite_invoke(char *request, int request_size) { + return invoke(request, request_size); +}