[patch] size optimization for mkswap.c
Tito
farmatito at tiscali.it
Thu Mar 16 14:08:07 UTC 2006
On Thursday 16 March 2006 14:29, Bernhard Fischer wrote:
> Hi,
>
> Attached two patches do
> 1) shrink mkswap a little bit
> 2) make v0 support optional.
>
> text data bss dec hex filename
> 2093 8 28 2129 851 util-linux/mkswap.o.oorig
> 2044 8 28 2080 820 util-linux/mkswap.o.shrink
> 1698 4 28 1730 6c2 util-linux/mkswap.o.no-V0
>
> Comments? Ok to apply?
>
+ bb_opt_complementally = "?"; /* call bb_show_usage internally */
+ sz = bb_getopt_ulflags(argc, argv, "+cfv:", &tmp);
- if (sz & BB_GETOPT_ERROR)
- bb_show_usage();
- version = atoi(tmp);
/* check if value is correct */
+ version = bb_xgetlarg(tmp, 10, 0, 1);
/* check if value is correct or call bb_show_usage internally */
+ PAGES = bb_xgetlarg(arv[0], 0, min value?, max value?) / blocks_per_page;
- PAGES = strtol(argv[0], &tmp, 0) / blocks_per_page;
- if (*tmp)
- bb_show_usage();
Just an idea.
Ciao,
TIto
More information about the busybox
mailing list