mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: str: do not free "true"/"false" literals
This commit is contained in:
parent
8fbbf488ab
commit
25b536d03f
@ -3310,7 +3310,10 @@ fn (mut g Gen) gen_str_for_array(info table.Array, styp, str_fn_name string) {
|
|||||||
g.auto_str_funcs.writeln('\t\tstring x = ${field_styp}_str(it);')
|
g.auto_str_funcs.writeln('\t\tstring x = ${field_styp}_str(it);')
|
||||||
}
|
}
|
||||||
g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, x);')
|
g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, x);')
|
||||||
g.auto_str_funcs.writeln('\t\tstring_free(x);')
|
if info.elem_type != table.bool_type {
|
||||||
|
// no need to free "true"/"false" literals
|
||||||
|
g.auto_str_funcs.writeln('\t\tstring_free(x);')
|
||||||
|
}
|
||||||
g.auto_str_funcs.writeln('\t\tif (i < a.len-1) {')
|
g.auto_str_funcs.writeln('\t\tif (i < a.len-1) {')
|
||||||
g.auto_str_funcs.writeln('\t\t\tstrings__Builder_write(&sb, tos3(", "));')
|
g.auto_str_funcs.writeln('\t\t\tstrings__Builder_write(&sb, tos3(", "));')
|
||||||
g.auto_str_funcs.writeln('\t\t}')
|
g.auto_str_funcs.writeln('\t\t}')
|
||||||
|
Loading…
Reference in New Issue
Block a user