aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/chattr.c
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-10-30 19:36:07 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-10-30 19:36:07 +0000
commitd059ddc1bbd7863f8ef8aa6484b6c3ba802b5dca (patch)
tree1d2d1fe01bc3c0939b14b1deed9f33daf3f54be1 /e2fsprogs/chattr.c
parent1641d614fa13b87b38688bb845159493c821e476 (diff)
downloadbusybox-d059ddc1bbd7863f8ef8aa6484b6c3ba802b5dca.tar.gz
busybox-d059ddc1bbd7863f8ef8aa6484b6c3ba802b5dca.tar.bz2
e2fsprogs: code shrink
text data bss dec hex filename 776594 974 9420 786988 c022c busybox_old 776494 974 9420 786888 c01c8 busybox_unstripped
Diffstat (limited to 'e2fsprogs/chattr.c')
-rw-r--r--e2fsprogs/chattr.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c
index db5437228..0f19af8e4 100644
--- a/e2fsprogs/chattr.c
+++ b/e2fsprogs/chattr.c
@@ -37,27 +37,9 @@ struct globals {
static unsigned long get_flag(char c)
{
- /* Two separate vectors take less space than vector of structs */
- static const char flags_letter[] ALIGN1 = "ASDacdijsutT";
- static const unsigned long flags_val[] = {
- /* A */ EXT2_NOATIME_FL,
- /* S */ EXT2_SYNC_FL,
- /* D */ EXT2_DIRSYNC_FL,
- /* a */ EXT2_APPEND_FL,
- /* c */ EXT2_COMPR_FL,
- /* d */ EXT2_NODUMP_FL,
- /* i */ EXT2_IMMUTABLE_FL,
- /* j */ EXT3_JOURNAL_DATA_FL,
- /* s */ EXT2_SECRM_FL,
- /* u */ EXT2_UNRM_FL,
- /* t */ EXT2_NOTAIL_FL,
- /* T */ EXT2_TOPDIR_FL,
- };
- const char *fp;
-
- for (fp = flags_letter; *fp; fp++)
- if (*fp == c)
- return flags_val[fp - flags_letter];
+ const char *fp = strchr(e2attr_flags_sname_chattr, c);
+ if (fp)
+ return e2attr_flags_value_chattr[fp - e2attr_flags_sname_chattr];
bb_show_usage();
}