Skip to content

Commit f001561

Browse files
authored
strings: make strings end with zero in repeat() and repeat_string() (#25624)
1 parent e23835c commit f001561

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vlib/strings/strings.c.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn repeat(c u8, n int) string {
99
mut bytes := unsafe { malloc_noscan(n + 1) }
1010
unsafe {
1111
C.memset(bytes, c, n)
12-
bytes[n] = `0`
12+
bytes[n] = 0
1313
}
1414
return unsafe { bytes.vstring_with_len(n) }
1515
}
@@ -34,7 +34,7 @@ pub fn repeat_string(s string, n int) string {
3434
}
3535
}
3636
unsafe {
37-
bytes[blen] = `0`
37+
bytes[blen] = 0
3838
}
3939
return unsafe { bytes.vstring_with_len(blen) }
4040
}

0 commit comments

Comments
 (0)