Commit ed327e64 authored by gwenn's avatar gwenn

To do: sqlite3_mprintf and oom.

parent 9d038bfc
...@@ -31,7 +31,7 @@ func Mprintf(format string, arg string) string { ...@@ -31,7 +31,7 @@ func Mprintf(format string, arg string) string {
defer C.sqlite3_free(unsafe.Pointer(zSQL)) defer C.sqlite3_free(unsafe.Pointer(zSQL))
return C.GoString(zSQL) return C.GoString(zSQL)
} }
func mPrintf(format, arg string) *C.char { func mPrintf(format, arg string) *C.char { // TODO may return nil when no memory...
cf := C.CString(format) cf := C.CString(format)
defer C.free(unsafe.Pointer(cf)) defer C.free(unsafe.Pointer(cf))
ca := C.CString(arg) ca := C.CString(arg)
...@@ -49,7 +49,7 @@ func Mprintf2(format string, arg1, arg2 string) string { ...@@ -49,7 +49,7 @@ func Mprintf2(format string, arg1, arg2 string) string {
defer C.free(unsafe.Pointer(ca1)) defer C.free(unsafe.Pointer(ca1))
ca2 := C.CString(arg2) ca2 := C.CString(arg2)
defer C.free(unsafe.Pointer(ca2)) defer C.free(unsafe.Pointer(ca2))
zSQL := C.my_mprintf2(cf, ca1, ca2) zSQL := C.my_mprintf2(cf, ca1, ca2) // TODO may return nil when no memory...
defer C.sqlite3_free(unsafe.Pointer(zSQL)) defer C.sqlite3_free(unsafe.Pointer(zSQL))
return C.GoString(zSQL) return C.GoString(zSQL)
} }
......
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