1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-12-09 09:56:01 +02:00
imgproxy/vips/cached_c_strings.go
2021-12-10 19:54:34 +06:00

18 lines
255 B
Go

package vips
import "C"
import "sync"
var cStringsCache sync.Map
func cachedCString(str string) *C.char {
if cstr, ok := cStringsCache.Load(str); ok {
return cstr.(*C.char)
}
cstr := C.CString(str)
cStringsCache.Store(str, cstr)
return cstr
}