From 778a1cc34ae5674c345d73e2a507bce9f77dea1b Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 4 Jan 2020 18:53:37 +0200 Subject: [PATCH] make g_str_buf a static buffer of size 1K (#3321) --- vlib/compiler/cheaders.v | 2 +- vlib/compiler/main.v | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/vlib/compiler/cheaders.v b/vlib/compiler/cheaders.v index d31d96f508..ba13d0eb6f 100644 --- a/vlib/compiler/cheaders.v +++ b/vlib/compiler/cheaders.v @@ -146,7 +146,7 @@ $c_common_macros #define DEFAULT_GT(a, b) (a > b) #define DEFAULT_GE(a, b) (a >= b) //================================== GLOBALS =================================*/ -byteptr g_str_buf; +byte g_str_buf[1024]; int load_so(byteptr); void reload_so(); ' diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index 74f3bb1f01..0e8f1bb14c 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -485,7 +485,6 @@ fn (v mut V) generate_init() { if !v.pref.is_bare { // vlib can't have `init_consts()` v.cgen.genln('void init() { -g_str_buf=malloc(1000); #if VPREALLOC g_m2_buf = malloc(50 * 1000 * 1000); g_m2_ptr = g_m2_buf; @@ -596,7 +595,6 @@ pub fn (v mut V) generate_main() { v.gen_main_start(true) cgen.genln(' main__main();') if !v.pref.is_bare { - cgen.genln('free(g_str_buf);') cgen.genln('#if VPREALLOC') cgen.genln('free(g_m2_buf);') cgen.genln('puts("freed mem buf");')