mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: move C. calls to .c.v files (#11164)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user