cgen: string buffer fix

pull/5032/head
Alexander Medvednikov 2020-05-26 00:04:13 +02:00
parent b0cfd3fa67
commit 0f92800921
2 changed files with 7 additions and 1 deletions

View File

@ -2489,6 +2489,11 @@ fn (mut g Gen) write_init_function() {
}
fn_vinit_start_pos := g.out.len
g.writeln('void _vinit() {')
if g.pref.autofree {
// Pre-allocate the string buffer
// TODO make it configurable
g.writeln('g_str_buf = malloc(1024 * 1000);')
}
g.writeln('\tbuiltin_init();')
g.writeln('\tvinit_string_literals();')
g.writeln(g.inits.str())

View File

@ -240,7 +240,8 @@ void* g_live_info = NULL;
#endif
//================================== GLOBALS =================================*/
byte g_str_buf[1024];
//byte g_str_buf[1024];
byte* g_str_buf;
int load_so(byteptr);
void reload_so();
void _vinit();