make g_str_buf a static buffer of size 1K (#3321)

pull/3326/head
Delyan Angelov 2020-01-04 18:53:37 +02:00 committed by Alexander Medvednikov
parent 7bc5cfc53a
commit 778a1cc34a
2 changed files with 1 additions and 3 deletions

View File

@ -146,7 +146,7 @@ $c_common_macros
#define DEFAULT_GT(a, b) (a > b) #define DEFAULT_GT(a, b) (a > b)
#define DEFAULT_GE(a, b) (a >= b) #define DEFAULT_GE(a, b) (a >= b)
//================================== GLOBALS =================================*/ //================================== GLOBALS =================================*/
byteptr g_str_buf; byte g_str_buf[1024];
int load_so(byteptr); int load_so(byteptr);
void reload_so(); void reload_so();
' '

View File

@ -485,7 +485,6 @@ fn (v mut V) generate_init() {
if !v.pref.is_bare { if !v.pref.is_bare {
// vlib can't have `init_consts()` // vlib can't have `init_consts()`
v.cgen.genln('void init() { v.cgen.genln('void init() {
g_str_buf=malloc(1000);
#if VPREALLOC #if VPREALLOC
g_m2_buf = malloc(50 * 1000 * 1000); g_m2_buf = malloc(50 * 1000 * 1000);
g_m2_ptr = g_m2_buf; g_m2_ptr = g_m2_buf;
@ -596,7 +595,6 @@ pub fn (v mut V) generate_main() {
v.gen_main_start(true) v.gen_main_start(true)
cgen.genln(' main__main();') cgen.genln(' main__main();')
if !v.pref.is_bare { if !v.pref.is_bare {
cgen.genln('free(g_str_buf);')
cgen.genln('#if VPREALLOC') cgen.genln('#if VPREALLOC')
cgen.genln('free(g_m2_buf);') cgen.genln('free(g_m2_buf);')
cgen.genln('puts("freed mem buf");') cgen.genln('puts("freed mem buf");')