mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
builtin: move C. calls to .c.v files (#11164)
This commit is contained in:
parent
c9e9556a92
commit
47884dfd1f
21 changed files with 288 additions and 206 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue