multiplier suffixes are short, store them directly in struct suffix_mult
function old new delta xstrtoul_range_sfx 226 217 -9 xstrtoull_range_sfx 291 280 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-20) Total: -20 bytes text data bss dec hex filename 669128 2668 13616 685412 a7564 busybox_old 669108 2668 13616 685392 a7550 busybox_unstripped
This commit is contained in:
parent
7587870617
commit
f868963c67
@ -25,7 +25,7 @@ static const struct suffix_mult dd_suffixes[] = {
|
||||
{ "M", 1048576 },
|
||||
{ "GD", 1000000000 },
|
||||
{ "G", 1073741824 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
|
||||
struct globals {
|
||||
|
@ -25,7 +25,7 @@ static const struct suffix_mult head_suffixes[] = {
|
||||
{ "b", 512 },
|
||||
{ "k", 1024 },
|
||||
{ "m", 1024*1024 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -981,7 +981,7 @@ parse_old_offset(const char *s, off_t *offset)
|
||||
static const struct suffix_mult Bb[] = {
|
||||
{ "B", 1024 },
|
||||
{ "b", 512 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
char *p;
|
||||
int radix;
|
||||
@ -1204,7 +1204,7 @@ int od_main(int argc, char **argv)
|
||||
{ "b", 512 },
|
||||
{ "k", 1024 },
|
||||
{ "m", 1024*1024 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
unsigned opt;
|
||||
int l_c_m;
|
||||
|
@ -29,7 +29,7 @@ static const struct suffix_mult sfx[] = {
|
||||
{ "m", 60 },
|
||||
{ "h", 60*60 },
|
||||
{ "d", 24*60*60 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@ static const struct suffix_mult split_suffices[] = {
|
||||
#if ENABLE_FEATURE_SPLIT_FANCY
|
||||
{ "g", 1024*1024*1024 },
|
||||
#endif
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
|
||||
/* Increment the suffix part of the filename.
|
||||
|
@ -527,7 +527,7 @@ static const struct suffix_mult stty_suffixes[] = {
|
||||
{ "b", 512 },
|
||||
{ "k", 1024 },
|
||||
{ "B", 1024 },
|
||||
{NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
|
||||
static const struct mode_info *find_mode(const char *name)
|
||||
|
@ -30,7 +30,7 @@ static const struct suffix_mult tail_suffixes[] = {
|
||||
{ "b", 512 },
|
||||
{ "k", 1024 },
|
||||
{ "m", 1024*1024 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
|
||||
struct globals {
|
||||
|
@ -760,10 +760,10 @@ static action*** parse_params(char **argv)
|
||||
static const struct suffix_mult find_suffixes[] = {
|
||||
{ "c", 1 },
|
||||
{ "w", 2 },
|
||||
{ "b"+1, 512 },
|
||||
{ "", 512 },
|
||||
{ "b", 512 },
|
||||
{ "k", 1024 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
action_size *ap;
|
||||
ap = ALLOC_ACTION(size);
|
||||
|
@ -451,7 +451,7 @@ const char *make_human_readable_str(unsigned long long size,
|
||||
char *bin2hex(char *buf, const char *cp, int count);
|
||||
|
||||
struct suffix_mult {
|
||||
const char *suffix;
|
||||
char suffix[4];
|
||||
unsigned mult;
|
||||
};
|
||||
#include "xatonum.h"
|
||||
|
@ -490,7 +490,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
|
||||
static const struct suffix_mult km_suffixes[] = {
|
||||
{ "k", 1024 },
|
||||
{ "m", 1024*1024 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
ld->sizemax = xatou_sfx(&s[1], km_suffixes);
|
||||
break;
|
||||
@ -506,7 +506,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
|
||||
{ "m", 60 },
|
||||
{ "h", 60*60 },
|
||||
/*{ "d", 24*60*60 },*/
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
ld->tmax = xatou_sfx(&s[1], mh_suffixes);
|
||||
if (ld->tmax) {
|
||||
|
@ -51,7 +51,7 @@ static const struct suffix_mult suffixes[] = {
|
||||
{ "b", 512 },
|
||||
{ "k", 1024 },
|
||||
{ "m", 1024*1024 },
|
||||
{ NULL, 0 }
|
||||
{ }
|
||||
};
|
||||
|
||||
int hexdump_main(int argc, char **argv);
|
||||
|
Loading…
Reference in New Issue
Block a user