11
// strData transforms a string to a form that can be passed to cgo
12
// without copying data.
13
func strData(s string) C.StrData {
14
h := (*reflect.StringHeader)(unsafe.Pointer(&s))
16
data: (*C.char)(unsafe.Pointer(h.Data)),
17
length: C.long(len(s)),
21
// byteData transforms a byte array into the same format strData() produces.
22
func byteData(b []byte) C.StrData {
30
data: (*C.char)(unsafe.Pointer(&b[0])),
31
length: C.long(len(b)),
36
func joinedStrData(a []string) C.StrData {
41
buf := make([]byte, total)
44
copy(buf[i:i+len(s)], s)