mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: autofree math.bits and strconv.ftoa constants
This commit is contained in:
parent
6683f98eba
commit
ae03aab03e
@ -13,6 +13,7 @@ import v.util
|
||||
import v.depgraph
|
||||
import term
|
||||
|
||||
// NB: keywords after 'new' are reserved in C++
|
||||
const (
|
||||
c_reserved = ['delete', 'exit', 'unix', 'error', 'calloc', 'malloc', 'free', 'panic', 'auto',
|
||||
'char',
|
||||
@ -37,7 +38,6 @@ const (
|
||||
'void',
|
||||
'volatile',
|
||||
'while',
|
||||
// C++ keywords
|
||||
'new',
|
||||
'namespace',
|
||||
'class',
|
||||
@ -2500,7 +2500,22 @@ fn (mut g Gen) write_init_function() {
|
||||
g.writeln('array_free(&_const_os__args);')
|
||||
g.writeln('string_free(&_const_os__wd_at_startup);')
|
||||
}
|
||||
//
|
||||
g.writeln('array_free(&_const_math__bits__de_bruijn32tab);')
|
||||
g.writeln('array_free(&_const_math__bits__de_bruijn64tab);')
|
||||
g.writeln('array_free(&_const_math__bits__ntz_8_tab);')
|
||||
g.writeln('array_free(&_const_math__bits__pop_8_tab);')
|
||||
g.writeln('array_free(&_const_math__bits__rev_8_tab);')
|
||||
g.writeln('array_free(&_const_math__bits__len_8_tab);')
|
||||
g.writeln('array_free(&_const_strconv__ftoa__ten_pow_table_32);')
|
||||
g.writeln('array_free(&_const_strconv__ftoa__ten_pow_table_64);')
|
||||
g.writeln('array_free(&_const_strconv__ftoa__powers_of_10);')
|
||||
g.writeln('array_free(&_const_strconv__ftoa__pow5_split_32);')
|
||||
g.writeln('array_free(&_const_strconv__ftoa__pow5_inv_split_32);')
|
||||
g.writeln('array_free(&_const_strconv__ftoa__pow5_split_64);')
|
||||
g.writeln('array_free(&_const_strconv__ftoa__pow5_inv_split_64);')
|
||||
g.writeln('array_free(&_const_strconv__dec_round);')
|
||||
//
|
||||
g.writeln('}')
|
||||
if g.pref.printfn_list.len > 0 && '_vcleanup' in g.pref.printfn_list {
|
||||
println(g.out.after(fn_vcleanup_start_pos))
|
||||
@ -3833,7 +3848,7 @@ fn (mut g Gen) gen_str_for_varg(styp, str_fn_name string, has_str_method bool) {
|
||||
g.auto_str_funcs.writeln('\tfor(int i=0; i<it.len; i++) {')
|
||||
if has_str_method {
|
||||
g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, ${str_fn_name}(it.args[i]));')
|
||||
}else{
|
||||
} else {
|
||||
// autogenerated str methods take the indent level as a second argument:
|
||||
g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, ${str_fn_name}(it.args[i], 0));')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user