llgo/ssa: StringData/StringLen
This commit is contained in:
14
py/bytes.go
14
py/bytes.go
@@ -26,17 +26,17 @@ import (
|
||||
|
||||
// String returns a new bytes object from a C string.
|
||||
//
|
||||
//go:linkname StringFrom C.PyBytes_FromString
|
||||
func StringFrom(s *c.Char) *Object
|
||||
//go:linkname FromCStr C.PyBytes_FromString
|
||||
func FromCStr(s *c.Char) *Object
|
||||
|
||||
// FromString returns a new bytes object from a Go string.
|
||||
func FromString(s string) *Object {
|
||||
return stringFromStringAndSize(c.GoStringData(s), uintptr(len(s)))
|
||||
}
|
||||
|
||||
//go:linkname stringFromStringAndSize C.PyBytes_FromStringAndSize
|
||||
func stringFromStringAndSize(s *c.Char, size uintptr) *Object
|
||||
|
||||
// String returns a new bytes object from a Go string.
|
||||
func String(s string) *Object {
|
||||
return stringFromStringAndSize(c.GoStringData(s), uintptr(len(s)))
|
||||
}
|
||||
|
||||
// CStr returns the content of a bytes object as a C string.
|
||||
//
|
||||
// llgo:link (*Object).CStr C.PyBytes_AsString
|
||||
|
||||
Reference in New Issue
Block a user