mirror of
https://git.busybox.net/busybox.git
synced 2024-11-23 21:53:25 +08:00
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>
This commit is contained in:
parent
926420795b
commit
cb6061a4e9
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user