diff options
author | Denis Vlasenko | 2008-06-07 15:10:29 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-06-07 15:10:29 +0000 |
commit | 53354ac47df03bdccebad66bc22958fa2b4da520 (patch) | |
tree | b3d85b6cd19f81293848235560b24cbce86f77d7 /util-linux | |
parent | f0d6c255860509b10148c70ef7cb518eb81bea6d (diff) | |
download | busybox-53354ac47df03bdccebad66bc22958fa2b4da520.zip busybox-53354ac47df03bdccebad66bc22958fa2b4da520.tar.gz |
libbb: introduce and use print_flags().
Mostly by Natanael Copa <natanael.copa AT gmail.com>
function old new delta
print_e2flags - 189 +189
print_flags_separated - 86 +86
static.flag_labels - 60 +60
static.dma_wmode_masks - 32 +32
static.flag_masks - 28 +28
static.arp_labels - 16 +16
static.arp_masks - 12 +12
ls_main 836 843 +7
...
popstring 140 134 -6
arp_show 740 708 -32
print_flags 189 25 -164
ipaddr_list_or_flush 2396 2170 -226
process_dev 5306 4706 -600
------------------------------------------------------------------------------
(add/remove: 10/0 grow/shrink: 5/10 up/down: 458/-1043) Total: -585 bytes
text data bss dec hex filename
810564 624 7060 818248 c7c48 busybox_old
810002 624 7060 817686 c7a16 busybox_unstripped
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/fdisk_osf.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c index e281ea5..30c4255 100644 --- a/util-linux/fdisk_osf.c +++ b/util-linux/fdisk_osf.c @@ -502,6 +502,8 @@ xbsd_print_disklabel(int show_all) int i, j; if (show_all) { + static const int d_masks[] = { BSD_D_REMOVABLE, BSD_D_ECC, BSD_D_BADSECT }; + #if defined(__alpha__) printf("# %s:\n", disk_device); #else @@ -513,13 +515,8 @@ xbsd_print_disklabel(int show_all) printf("type: %d\n", lp->d_type); printf("disk: %.*s\n", (int) sizeof(lp->d_typename), lp->d_typename); printf("label: %.*s\n", (int) sizeof(lp->d_packname), lp->d_packname); - printf("flags:"); - if (lp->d_flags & BSD_D_REMOVABLE) - printf(" removable"); - if (lp->d_flags & BSD_D_ECC) - printf(" ecc"); - if (lp->d_flags & BSD_D_BADSECT) - printf(" badsect"); + printf("flags: "); + print_flags_separated(d_masks, "removable\0""ecc\0""badsect\0", lp->d_flags, " "); bb_putchar('\n'); /* On various machines the fields of *lp are short/int/long */ /* In order to avoid problems, we cast them all to long. */ |