mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-24 08:12:38 +02:00
18 lines
255 B
Go
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
|
|
}
|