cgen: minor fixes

This commit is contained in:
Alexander Medvednikov 2020-03-18 16:47:37 +01:00
parent c514f0b672
commit fe6707b26d
4 changed files with 8 additions and 7 deletions

View file

@ -392,10 +392,10 @@ fn (s string) add(a string) string {
str: malloc(new_len + 1)
}
for j in 0..s.len {
res[j] = s[j]
res.str[j] = s.str[j]
}
for j in 0..a.len {
res[s.len + j] = a[j]
res.str[s.len + j] = a.str[j]
}
res.str[new_len] = `\0` // V strings are not null terminated, but just in case
return res