mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-29 08:22:11 +02:00
17 lines
239 B
Go
17 lines
239 B
Go
|
package main
|
||
|
|
||
|
import "C"
|
||
|
|
||
|
var cStringsCache = make(map[string]*C.char)
|
||
|
|
||
|
func cachedCString(str string) *C.char {
|
||
|
if cstr, ok := cStringsCache[str]; ok {
|
||
|
return cstr
|
||
|
}
|
||
|
|
||
|
cstr := C.CString(str)
|
||
|
cStringsCache[str] = cstr
|
||
|
|
||
|
return cstr
|
||
|
}
|