mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-12-09 09:56:01 +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
|
|
}
|