diff options
author | Denys Vlasenko | 2021-06-29 02:43:02 +0200 |
---|---|---|
committer | Denys Vlasenko | 2021-06-29 02:43:02 +0200 |
commit | cb6061a4e9860bf3d529109b34103ce3bde6d735 (patch) | |
tree | a85a77b71742a124c70d852f39e1a7055a33eb2d | |
parent | 926420795b4191e045d4a316bfed19f84275a185 (diff) | |
download | busybox-cb6061a4e9860bf3d529109b34103ce3bde6d735.zip busybox-cb6061a4e9860bf3d529109b34103ce3bde6d735.tar.gz |
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.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/editors/awk.c b/editors/awk.c index 08ff02a..7e4f0d1 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -535,7 +535,6 @@ struct globals { var *Fields; nvblock *g_cb; char *g_pos; - char *g_buf; smallint icase; smallint exiting; smallint nextrec; @@ -571,6 +570,8 @@ struct globals2 { /* biggest and least used members go last */ tsplitter fsplitter, rsplitter; + + char g_buf[MAXVARFMT + 1]; }; #define G1 (ptr_to_globals[-1]) #define G (*(struct globals2 *)ptr_to_globals) @@ -598,7 +599,6 @@ struct globals2 { #define Fields (G1.Fields ) #define g_cb (G1.g_cb ) #define g_pos (G1.g_pos ) -#define g_buf (G1.g_buf ) #define icase (G1.icase ) #define exiting (G1.exiting ) #define nextrec (G1.nextrec ) @@ -612,6 +612,7 @@ struct globals2 { #define intvar (G.intvar ) #define fsplitter (G.fsplitter ) #define rsplitter (G.rsplitter ) +#define g_buf (G.g_buf ) #define INIT_G() do { \ SET_PTR_TO_GLOBALS((char*)xzalloc(sizeof(G1)+sizeof(G)) + sizeof(G1)); \ t_tclass = TS_OPTERM; \ @@ -3353,9 +3354,6 @@ int awk_main(int argc UNUSED_PARAM, char **argv) if (ENABLE_LOCALE_SUPPORT) setlocale(LC_NUMERIC, "C"); - /* allocate global buffer */ - g_buf = xmalloc(MAXVARFMT + 1); - vhash = hash_init(); ahash = hash_init(); fdhash = hash_init(); |