fix: segfault when using string.ustring_tmp()
parent
09c447e2b8
commit
58577f57c6
|
@ -653,6 +653,9 @@ pub fn (s string) ustring() ustring {
|
|||
// right away. Uses global buffer for storing runes []int array.
|
||||
__global g_ustring_runes []int
|
||||
pub fn (s string) ustring_tmp() ustring {
|
||||
if g_ustring_runes.len == 0 {
|
||||
g_ustring_runes = new_array(0, 128, sizeof(int))
|
||||
}
|
||||
mut res := ustring {
|
||||
s: s
|
||||
}
|
||||
|
@ -811,7 +814,7 @@ pub fn (s string) reverse() string {
|
|||
}
|
||||
|
||||
for i := s.len - 1; i >= 0; i-- {
|
||||
res[s.len-i-1] = s[i]
|
||||
res[s.len-i-1] = s[i]
|
||||
}
|
||||
|
||||
return res
|
||||
|
|
Loading…
Reference in New Issue