builtin: move C. calls to .c.v files (#11164)

This commit is contained in:
Delyan Angelov 2021-08-12 21:46:38 +03:00 committed by GitHub
parent c9e9556a92
commit 47884dfd1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 288 additions and 206 deletions

View file

@ -1,6 +1,6 @@
module builtin
// NB: this file will be removed soon
// NB: this file will be removed soon
// byteptr.vbytes() - makes a V []byte structure from a C style memory buffer. NB: the data is reused, NOT copied!
[unsafe]
@ -15,7 +15,7 @@ pub fn (data byteptr) vbytes(len int) []byte {
pub fn (bp byteptr) vstring() string {
return string{
str: bp
len: unsafe { C.strlen(&char(bp)) }
len: unsafe { vstrlen(bp) }
}
}
@ -36,7 +36,7 @@ pub fn (bp byteptr) vstring_with_len(len int) string {
pub fn (cp charptr) vstring() string {
return string{
str: byteptr(cp)
len: unsafe { C.strlen(&char(cp)) }
len: unsafe { vstrlen_char(cp) }
is_lit: 0
}
}
@ -63,7 +63,7 @@ pub fn (cp charptr) vstring_with_len(len int) string {
pub fn (bp byteptr) vstring_literal() string {
return string{
str: bp
len: unsafe { C.strlen(&char(bp)) }
len: unsafe { vstrlen(bp) }
is_lit: 1
}
}
@ -86,7 +86,7 @@ pub fn (bp byteptr) vstring_literal_with_len(len int) string {
pub fn (cp charptr) vstring_literal() string {
return string{
str: byteptr(cp)
len: unsafe { C.strlen(&char(cp)) }
len: unsafe { vstrlen_char(cp) }
is_lit: 1
}
}