1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

strings: use memdup_noscan in Builder.str()

This commit is contained in:
Delyan Angelov 2021-10-28 17:00:10 +03:00
parent a987440e2f
commit 2c3e44eb20
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -150,7 +150,7 @@ pub fn (b &Builder) after(n int) string {
// .str() call.
pub fn (mut b Builder) str() string {
b << byte(0)
bcopy := unsafe { &byte(memdup(b.data, b.len)) }
bcopy := unsafe { &byte(memdup_noscan(b.data, b.len)) }
s := unsafe { bcopy.vstring_with_len(b.len - 1) }
b.trim(0)
return s