From 55f7912ddaea7c21068a48841a6eb933e5f286ee Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 16 Jul 2008 11:00:16 +0000 Subject: libbb: get rid of statics in dump.c; code shrinks a lot too function old new delta alloc_dumper - 26 +26 hexdump_main 600 601 +1 static.done 1 - -1 static.ateof 1 - -1 bb_dump_vflag 1 - -1 static.savp 4 - -4 static.nextfs 4 - -4 static.curp 4 - -4 exitval 4 - -4 endfu 4 - -4 bb_dump_length 4 - -4 bb_dump_fshead 4 - -4 bb_dump_blocksize 4 - -4 _argv 4 - -4 bb_dump_add 365 358 -7 savaddress 8 - -8 eaddress 8 - -8 bb_dump_skip 8 - -8 address 8 - -8 bb_dump_dump 2748 2672 -76 next 538 445 -93 ------------------------------------------------------------------------------ (add/remove: 1/16 grow/shrink: 1/3 up/down: 27/-247) Total: -220 bytes text data bss dec hex filename 789458 607 6764 796829 c289d busybox_old 789309 601 6696 796606 c27be busybox_unstripped --- include/dump.h | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/dump.h b/include/dump.h index da3e66da9..44f2082b7 100644 --- a/include/dump.h +++ b/include/dump.h @@ -18,10 +18,10 @@ #define F_UINT 0x200 /* %[ouXx] */ #define F_TEXT 0x400 /* no conversions */ -enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */ +enum dump_vflag_t { ALL, DUP, FIRST, WAIT }; /* -v values */ -typedef struct _pr { - struct _pr *nextpr; /* next print unit */ +typedef struct PR { + struct PR *nextpr; /* next print unit */ unsigned flags; /* flag values */ int bcnt; /* byte count */ char *cchar; /* conversion character */ @@ -29,30 +29,31 @@ typedef struct _pr { char *nospace; /* no whitespace version */ } PR; -typedef struct _fu { - struct _fu *nextfu; /* next format unit */ - struct _pr *nextpr; /* next print unit */ +typedef struct FU { + struct FU *nextfu; /* next format unit */ + struct PR *nextpr; /* next print unit */ unsigned flags; /* flag values */ int reps; /* repetition count */ int bcnt; /* byte count */ char *fmt; /* format string */ } FU; -typedef struct _fs { /* format strings */ - struct _fs *nextfs; /* linked list of format strings */ - struct _fu *nextfu; /* linked list of format units */ +typedef struct FS { /* format strings */ + struct FS *nextfs; /* linked list of format strings */ + struct FU *nextfu; /* linked list of format units */ int bcnt; } FS; -extern void bb_dump_add(const char *fmt) FAST_FUNC; -extern int bb_dump_dump(char **argv) FAST_FUNC; -extern int bb_dump_size(FS * fs) FAST_FUNC; +typedef struct dumper_t { + off_t dump_skip; /* bytes to skip */ + int dump_length; /* max bytes to read */ + smallint dump_vflag; /*enum dump_vflag_t*/ + FS *fshead; +} dumper_t; -extern FS *bb_dump_fshead; /* head of format strings */ -extern int bb_dump_blocksize; /* data block size */ -extern int bb_dump_length; /* max bytes to read */ -extern smallint /*enum _vflag*/ bb_dump_vflag; -extern off_t bb_dump_skip; /* bytes to skip */ +dumper_t* alloc_dumper(void) FAST_FUNC; +extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC; +extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC; #if __GNUC_PREREQ(4,1) # pragma GCC visibility pop -- cgit v1.2.3