introduce and use exitcode_t
function old new delta strings_main 422 420 -2 setfattr_main 175 173 -2 brctl_main 1548 1546 -2 makedevs_main 979 975 -4 rev_main 337 332 -5 getfattr_main 307 302 -5 cut_main 1201 1196 -5 cksum_main 398 393 -5 umount_main 573 565 -8 ln_main 516 508 -8 expand_main 660 652 -8 df_main 1068 1060 -8 renice_main 346 332 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/13 up/down: 0/-76) Total: -76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a6a102ec4c
commit
c484846c44
18 changed files with 26 additions and 19 deletions
|
@ -39,7 +39,7 @@ int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int cksum_main(int argc UNUSED_PARAM, char **argv)
|
int cksum_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
uint32_t *crc32_table = crc32_filltable(NULL, IS_CKSUM);
|
uint32_t *crc32_table = crc32_filltable(NULL, IS_CKSUM);
|
||||||
int exit_code = EXIT_SUCCESS;
|
exitcode_t exit_code = EXIT_SUCCESS;
|
||||||
|
|
||||||
#if ENABLE_DESKTOP
|
#if ENABLE_DESKTOP
|
||||||
getopt32(argv, ""); /* cksum coreutils 6.9 compat */
|
getopt32(argv, ""); /* cksum coreutils 6.9 compat */
|
||||||
|
|
|
@ -311,7 +311,7 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int retval = EXIT_SUCCESS;
|
exitcode_t retval = EXIT_SUCCESS;
|
||||||
|
|
||||||
if (!*argv)
|
if (!*argv)
|
||||||
*--argv = (char *)"-";
|
*--argv = (char *)"-";
|
||||||
|
|
|
@ -375,7 +375,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
|
||||||
OP_oflag_direct,
|
OP_oflag_direct,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
smallint exitcode = EXIT_FAILURE;
|
exitcode_t exitcode = EXIT_FAILURE;
|
||||||
int i;
|
int i;
|
||||||
size_t ibs = 512;
|
size_t ibs = 512;
|
||||||
char *ibuf;
|
char *ibuf;
|
||||||
|
|
|
@ -113,7 +113,7 @@ int df_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int df_main(int argc UNUSED_PARAM, char **argv)
|
int df_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
unsigned long df_disp_hr = 1024;
|
unsigned long df_disp_hr = 1024;
|
||||||
int status = EXIT_SUCCESS;
|
exitcode_t status = EXIT_SUCCESS;
|
||||||
unsigned opt;
|
unsigned opt;
|
||||||
FILE *mount_table;
|
FILE *mount_table;
|
||||||
struct mntent *mount_entry;
|
struct mntent *mount_entry;
|
||||||
|
|
|
@ -192,7 +192,7 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
|
||||||
FILE *file;
|
FILE *file;
|
||||||
unsigned tab_size;
|
unsigned tab_size;
|
||||||
unsigned opt;
|
unsigned opt;
|
||||||
int exit_status = EXIT_SUCCESS;
|
exitcode_t exit_status = EXIT_SUCCESS;
|
||||||
|
|
||||||
init_unicode();
|
init_unicode();
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ int fold_main(int argc UNUSED_PARAM, char **argv)
|
||||||
char *line_out = NULL;
|
char *line_out = NULL;
|
||||||
const char *w_opt = "80";
|
const char *w_opt = "80";
|
||||||
unsigned width;
|
unsigned width;
|
||||||
smallint exitcode = EXIT_SUCCESS;
|
exitcode_t exitcode = EXIT_SUCCESS;
|
||||||
|
|
||||||
init_unicode();
|
init_unicode();
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
int ln_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int ln_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int ln_main(int argc, char **argv)
|
int ln_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int status = EXIT_SUCCESS;
|
exitcode_t status = EXIT_SUCCESS;
|
||||||
int opts;
|
int opts;
|
||||||
char *last;
|
char *last;
|
||||||
char *src_name;
|
char *src_name;
|
||||||
|
|
|
@ -77,7 +77,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int opts;
|
int opts;
|
||||||
smalluint status = EXIT_SUCCESS;
|
exitcode_t status = EXIT_SUCCESS;
|
||||||
#if ENABLE_FEATURE_TOUCH_SUSV3
|
#if ENABLE_FEATURE_TOUCH_SUSV3
|
||||||
char *reference_file;
|
char *reference_file;
|
||||||
char *date_str;
|
char *date_str;
|
||||||
|
|
|
@ -1444,6 +1444,13 @@ void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
|
||||||
void bb_die_memory_exhausted(void) NORETURN FAST_FUNC;
|
void bb_die_memory_exhausted(void) NORETURN FAST_FUNC;
|
||||||
void bb_logenv_override(void) FAST_FUNC;
|
void bb_logenv_override(void) FAST_FUNC;
|
||||||
|
|
||||||
|
/* x86 benefits from narrow exit code variables
|
||||||
|
* (because it has no widening MOV imm8,word32 insn, has to use MOV imm32,w
|
||||||
|
* for "exitcode = EXIT_FAILURE" and similar. The downside is that sometimes
|
||||||
|
* gcc widens the variable to int in various ugly suboptimal ways).
|
||||||
|
*/
|
||||||
|
typedef smalluint exitcode_t;
|
||||||
|
|
||||||
#if ENABLE_FEATURE_SYSLOG_INFO
|
#if ENABLE_FEATURE_SYSLOG_INFO
|
||||||
void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
|
void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
|
||||||
void bb_simple_info_msg(const char *s) FAST_FUNC;
|
void bb_simple_info_msg(const char *s) FAST_FUNC;
|
||||||
|
|
|
@ -77,7 +77,7 @@ int getfattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int getfattr_main(int argc UNUSED_PARAM, char **argv)
|
int getfattr_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
int status;
|
exitcode_t status;
|
||||||
int opt;
|
int opt;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
size_t bufsize = 0;
|
size_t bufsize = 0;
|
||||||
|
|
|
@ -181,7 +181,7 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
parser_t *parser;
|
parser_t *parser;
|
||||||
char *line = (char *)"-";
|
char *line = (char *)"-";
|
||||||
int ret = EXIT_SUCCESS;
|
exitcode_t ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
getopt32(argv, "^" "d:" "\0" "=1", &line);
|
getopt32(argv, "^" "d:" "\0" "=1", &line);
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
|
@ -32,7 +32,7 @@ int setfattr_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *value = "";
|
const char *value = "";
|
||||||
int status;
|
exitcode_t status;
|
||||||
int opt;
|
int opt;
|
||||||
enum {
|
enum {
|
||||||
OPT_h = (1 << 0),
|
OPT_h = (1 << 0),
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
int strings_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int strings_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int strings_main(int argc UNUSED_PARAM, char **argv)
|
int strings_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
int n, c, status = EXIT_SUCCESS;
|
int n, c;
|
||||||
|
exitcode_t status = EXIT_SUCCESS;
|
||||||
unsigned count;
|
unsigned count;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
|
@ -538,7 +538,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
|
||||||
DIR *net;
|
DIR *net;
|
||||||
struct dirent *ent;
|
struct dirent *ent;
|
||||||
int need_hdr = 1;
|
int need_hdr = 1;
|
||||||
int exitcode = EXIT_SUCCESS;
|
exitcode_t exitcode = EXIT_SUCCESS;
|
||||||
|
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
/* "show BR1 BR2 BR3" */
|
/* "show BR1 BR2 BR3" */
|
||||||
|
|
|
@ -502,7 +502,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
|
||||||
};
|
};
|
||||||
struct rtnl_handle rth;
|
struct rtnl_handle rth;
|
||||||
struct tcmsg msg;
|
struct tcmsg msg;
|
||||||
int ret, obj, cmd, arg;
|
int obj, cmd, arg;
|
||||||
char *dev = NULL;
|
char *dev = NULL;
|
||||||
|
|
||||||
INIT_G();
|
INIT_G();
|
||||||
|
@ -510,7 +510,6 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
|
||||||
if (!*++argv)
|
if (!*++argv)
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
xrtnl_open(&rth);
|
xrtnl_open(&rth);
|
||||||
ret = EXIT_SUCCESS;
|
|
||||||
|
|
||||||
obj = index_in_substrings(objects, *argv++);
|
obj = index_in_substrings(objects, *argv++);
|
||||||
if (obj < 0)
|
if (obj < 0)
|
||||||
|
@ -625,5 +624,5 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||||
rtnl_close(&rth);
|
rtnl_close(&rth);
|
||||||
}
|
}
|
||||||
return ret;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ int renice_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
static const char Xetpriority_msg[] ALIGN1 = "%cetpriority";
|
static const char Xetpriority_msg[] ALIGN1 = "%cetpriority";
|
||||||
|
|
||||||
int retval = EXIT_SUCCESS;
|
exitcode_t retval = EXIT_SUCCESS;
|
||||||
int which = PRIO_PROCESS; /* Default 'which' value. */
|
int which = PRIO_PROCESS; /* Default 'which' value. */
|
||||||
int use_relative = 0;
|
int use_relative = 0;
|
||||||
int adjustment, new_priority;
|
int adjustment, new_priority;
|
||||||
|
|
|
@ -51,7 +51,7 @@ static void strrev(CHAR_T *s, int len)
|
||||||
int rev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int rev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int rev_main(int argc UNUSED_PARAM, char **argv)
|
int rev_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
int retval;
|
exitcode_t retval;
|
||||||
size_t bufsize;
|
size_t bufsize;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
|
||||||
struct mntent me;
|
struct mntent me;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *fstype = NULL;
|
char *fstype = NULL;
|
||||||
int status = EXIT_SUCCESS;
|
exitcode_t status = EXIT_SUCCESS;
|
||||||
unsigned opt;
|
unsigned opt;
|
||||||
struct mtab_list {
|
struct mtab_list {
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue