libbb: more compact API for bb_parse_mode()

function                                             old     new   delta
make_device                                         2182    2188      +6
parse_command                                       1440    1443      +3
parse_params                                        1497    1499      +2
install_main                                         773     769      -4
mkdir_main                                           168     160      -8
getoptscmd                                           641     632      -9
builtin_umask                                        158     147     -11
bb_parse_mode                                        431     410     -21
umaskcmd                                             286     258     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/6 up/down: 11/-81)            Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2015-10-07 17:55:33 +02:00
parent c1e2e005b4
commit 5711a2a4ad
10 changed files with 26 additions and 22 deletions

View File

@@ -1261,7 +1261,8 @@ static action*** parse_params(char **argv)
ap->perm_char = arg1[0];
arg1 = (arg1[0] == '/' ? arg1+1 : plus_minus_num(arg1));
/*ap->perm_mask = 0; - ALLOC_ACTION did it */
if (!bb_parse_mode(arg1, &ap->perm_mask))
ap->perm_mask = bb_parse_mode(arg1, ap->perm_mask);
if (ap->perm_mask == (mode_t)-1)
bb_error_msg_and_die("invalid mode '%s'", arg1);
}
#endif