aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-06-29 02:43:02 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-06-29 02:43:02 +0200
commitcb6061a4e9860bf3d529109b34103ce3bde6d735 (patch)
treea85a77b71742a124c70d852f39e1a7055a33eb2d
parent926420795b4191e045d4a316bfed19f84275a185 (diff)
downloadbusybox-w32-cb6061a4e9860bf3d529109b34103ce3bde6d735.tar.gz
busybox-w32-cb6061a4e9860bf3d529109b34103ce3bde6d735.tar.bz2
busybox-w32-cb6061a4e9860bf3d529109b34103ce3bde6d735.zip
awk: g_buf[] does not need a separate allocation
function old new delta exec_builtin 1400 1414 +14 evaluate 3132 3141 +9 getvar_s 121 125 +4 awk_main 902 886 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 27/-16) Total: 11 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/awk.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 08ff02adb..7e4f0d142 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -535,7 +535,6 @@ struct globals {
535 var *Fields; 535 var *Fields;
536 nvblock *g_cb; 536 nvblock *g_cb;
537 char *g_pos; 537 char *g_pos;
538 char *g_buf;
539 smallint icase; 538 smallint icase;
540 smallint exiting; 539 smallint exiting;
541 smallint nextrec; 540 smallint nextrec;
@@ -571,6 +570,8 @@ struct globals2 {
571 570
572 /* biggest and least used members go last */ 571 /* biggest and least used members go last */
573 tsplitter fsplitter, rsplitter; 572 tsplitter fsplitter, rsplitter;
573
574 char g_buf[MAXVARFMT + 1];
574}; 575};
575#define G1 (ptr_to_globals[-1]) 576#define G1 (ptr_to_globals[-1])
576#define G (*(struct globals2 *)ptr_to_globals) 577#define G (*(struct globals2 *)ptr_to_globals)
@@ -598,7 +599,6 @@ struct globals2 {
598#define Fields (G1.Fields ) 599#define Fields (G1.Fields )
599#define g_cb (G1.g_cb ) 600#define g_cb (G1.g_cb )
600#define g_pos (G1.g_pos ) 601#define g_pos (G1.g_pos )
601#define g_buf (G1.g_buf )
602#define icase (G1.icase ) 602#define icase (G1.icase )
603#define exiting (G1.exiting ) 603#define exiting (G1.exiting )
604#define nextrec (G1.nextrec ) 604#define nextrec (G1.nextrec )
@@ -612,6 +612,7 @@ struct globals2 {
612#define intvar (G.intvar ) 612#define intvar (G.intvar )
613#define fsplitter (G.fsplitter ) 613#define fsplitter (G.fsplitter )
614#define rsplitter (G.rsplitter ) 614#define rsplitter (G.rsplitter )
615#define g_buf (G.g_buf )
615#define INIT_G() do { \ 616#define INIT_G() do { \
616 SET_PTR_TO_GLOBALS((char*)xzalloc(sizeof(G1)+sizeof(G)) + sizeof(G1)); \ 617 SET_PTR_TO_GLOBALS((char*)xzalloc(sizeof(G1)+sizeof(G)) + sizeof(G1)); \
617 t_tclass = TS_OPTERM; \ 618 t_tclass = TS_OPTERM; \
@@ -3353,9 +3354,6 @@ int awk_main(int argc UNUSED_PARAM, char **argv)
3353 if (ENABLE_LOCALE_SUPPORT) 3354 if (ENABLE_LOCALE_SUPPORT)
3354 setlocale(LC_NUMERIC, "C"); 3355 setlocale(LC_NUMERIC, "C");
3355 3356
3356 /* allocate global buffer */
3357 g_buf = xmalloc(MAXVARFMT + 1);
3358
3359 vhash = hash_init(); 3357 vhash = hash_init();
3360 ahash = hash_init(); 3358 ahash = hash_init();
3361 fdhash = hash_init(); 3359 fdhash = hash_init();