diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-17 00:47:23 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-17 00:47:23 +0200 |
commit | 4958c18134eb7ad169cdaf22a9ad957ad4f4858c (patch) | |
tree | 41998c2be7208ca30088107c7f44f1b3abca745c /libbb | |
parent | 2df4e0a3707ff3b70398177e9e001070e47ca9c5 (diff) | |
download | busybox-w32-4958c18134eb7ad169cdaf22a9ad957ad4f4858c.tar.gz busybox-w32-4958c18134eb7ad169cdaf22a9ad957ad4f4858c.tar.bz2 busybox-w32-4958c18134eb7ad169cdaf22a9ad957ad4f4858c.zip |
libbb: code shrink bb_parse_mode
function old new delta
bb_parse_mode 393 398 +5
static.who_mask 16 8 -8
static.perm_mask 24 12 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 5/-20) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/parse_mode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c index dc65860f6..1d238e1e0 100644 --- a/libbb/parse_mode.c +++ b/libbb/parse_mode.c | |||
@@ -16,13 +16,14 @@ | |||
16 | 16 | ||
17 | int FAST_FUNC bb_parse_mode(const char *s, unsigned current_mode) | 17 | int FAST_FUNC bb_parse_mode(const char *s, unsigned current_mode) |
18 | { | 18 | { |
19 | static const mode_t who_mask[] = { | 19 | /* should be mode_t really, but in all Unixes these constants fit into uint16 */ |
20 | static const uint16_t who_mask[] ALIGN2 = { | ||
20 | S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO, /* a */ | 21 | S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO, /* a */ |
21 | S_ISUID | S_IRWXU, /* u */ | 22 | S_ISUID | S_IRWXU, /* u */ |
22 | S_ISGID | S_IRWXG, /* g */ | 23 | S_ISGID | S_IRWXG, /* g */ |
23 | S_IRWXO /* o */ | 24 | S_IRWXO /* o */ |
24 | }; | 25 | }; |
25 | static const mode_t perm_mask[] = { | 26 | static const uint16_t perm_mask[] ALIGN2 = { |
26 | S_IRUSR | S_IRGRP | S_IROTH, /* r */ | 27 | S_IRUSR | S_IRGRP | S_IROTH, /* r */ |
27 | S_IWUSR | S_IWGRP | S_IWOTH, /* w */ | 28 | S_IWUSR | S_IWGRP | S_IWOTH, /* w */ |
28 | S_IXUSR | S_IXGRP | S_IXOTH, /* x */ | 29 | S_IXUSR | S_IXGRP | S_IXOTH, /* x */ |