From 6e7e001a89895df6b39b81bb2c0a40e6ae50e664 Mon Sep 17 00:00:00 2001 From: Nikita Kolotov Date: Mon, 19 Dec 2022 23:55:43 +0300 Subject: [PATCH] Renamed cfree wrapper to avoid conflict with standard library. --- func.go | 2 +- sqlite.go | 2 +- wrappers.c | 2 +- wrappers.h | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/func.go b/func.go index e080599..3b2d309 100644 --- a/func.go +++ b/func.go @@ -77,7 +77,7 @@ func (ctx Context) ResultText(v string) { if len(v) != 0 { cv = C.CString(v) } - C.sqlite3_result_text(ctx.ptr, cv, C.int(len(v)), (*[0]byte)(C.cfree)) + C.sqlite3_result_text(ctx.ptr, cv, C.int(len(v)), (*[0]byte)(C.sqlitego_free)) } func (ctx Context) ResultError(err error) { if err, isError := err.(Error); isError { diff --git a/sqlite.go b/sqlite.go index 415eb30..eec5846 100644 --- a/sqlite.go +++ b/sqlite.go @@ -827,7 +827,7 @@ func (stmt *Stmt) BindText(param int, value string) { v = emptyCstr } else { v = C.CString(value) - free = (*[0]byte)(C.cfree) + free = (*[0]byte)(C.sqlitego_free) } res := C.sqlite3_bind_text(stmt.stmt, C.int(param), v, C.int(len(value)), free) stmt.handleBindErr("BindText", res) diff --git a/wrappers.c b/wrappers.c index cbe5d3b..c91e248 100644 --- a/wrappers.c +++ b/wrappers.c @@ -18,7 +18,7 @@ #include #include -void cfree(void *p) { +void sqlitego_free(void *p) { free(p); }; diff --git a/wrappers.h b/wrappers.h index 4dc38fc..a7f40b7 100644 --- a/wrappers.h +++ b/wrappers.h @@ -17,8 +17,8 @@ #ifndef WRAPPERS_H #define WRAPPERS_H -/* cfree wraps free to fix https://github.com/crawshaw/sqlite/issues/60 */ -void cfree(void *p); +/* wraps free to fix https://github.com/crawshaw/sqlite/issues/60 */ +void sqlitego_free(void *p); int c_strm_w_tramp(void*, const void*, int); int c_strm_r_tramp(void*, const void*, int*);