Commit 78a62ead authored by gwenn's avatar gwenn

Fix warning: built-in function ‘free’ declared as non-function

parent 6f042750
...@@ -17,6 +17,9 @@ package sqlite ...@@ -17,6 +17,9 @@ package sqlite
// #define SQLITE_STATIC ((sqlite3_destructor_type)0) // #define SQLITE_STATIC ((sqlite3_destructor_type)0)
// #define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) // #define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
static inline int my_bind_text(sqlite3_stmt *stmt, int pidx, const char *data, int data_len) {
return sqlite3_bind_text(stmt, pidx, data, data_len, free);
}
static inline int my_bind_empty_text(sqlite3_stmt *stmt, int pidx) { static inline int my_bind_empty_text(sqlite3_stmt *stmt, int pidx) {
return sqlite3_bind_text(stmt, pidx, "", 0, SQLITE_STATIC); return sqlite3_bind_text(stmt, pidx, "", 0, SQLITE_STATIC);
} }
...@@ -355,8 +358,7 @@ func (s *Stmt) BindByIndex(index int, value interface{}) error { ...@@ -355,8 +358,7 @@ func (s *Stmt) BindByIndex(index int, value interface{}) error {
if i64 && len(value) > math.MaxInt32 { if i64 && len(value) > math.MaxInt32 {
return s.specificError("string too big: %d at index %d", len(value), index) return s.specificError("string too big: %d at index %d", len(value), index)
} }
f := C.sqlite3_destructor_type(C.free) rv = C.my_bind_text(s.stmt, i, C.CString(value), C.int(len(value)))
rv = C.sqlite3_bind_text(s.stmt, i, C.CString(value), C.int(len(value)), f)
} }
case int: case int:
if i64 { if i64 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment