From db5546ca101846f18294a43b39883bc4ff53613a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 5 Jan 2022 22:16:06 +0100 Subject: libbb: code shrink: introduce and use [_]exit_SUCCESS() function old new delta exit_SUCCESS - 7 +7 _exit_SUCCESS - 7 +7 run_pipe 1562 1567 +5 pseudo_exec_argv 399 400 +1 finish 86 87 +1 start_stop_daemon_main 1109 1107 -2 shutdown_on_signal 38 36 -2 runsv_main 1662 1660 -2 redirect 1070 1068 -2 read_line 79 77 -2 pause_and_low_level_reboot 54 52 -2 list_i2c_busses_and_exit 483 481 -2 less_exit 12 10 -2 identify 4123 4121 -2 grep_file 1161 1159 -2 getty_main 1519 1517 -2 fsck_minix_main 2681 2679 -2 free_session 132 130 -2 fdisk_main 4739 4737 -2 clean_up_and_exit 53 51 -2 bsd_select 1566 1564 -2 bb_daemonize_or_rexec 198 196 -2 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/17 up/down: 21/-34) Total: -13 bytes Signed-off-by: Denys Vlasenko --- miscutils/devfsd.c | 4 ++-- miscutils/hdparm.c | 2 +- miscutils/i2c_tools.c | 2 +- miscutils/less.c | 4 ++-- miscutils/watchdog.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'miscutils') diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index e5bb8a2..839d00f 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -453,7 +453,7 @@ int devfsd_main(int argc, char **argv) DEVFSD_PROTOCOL_REVISION_DAEMON, bb_msg_proto_rev, proto_rev); if (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) bb_error_msg_and_die("%s mismatch!", bb_msg_proto_rev); - exit(EXIT_SUCCESS); /* -v */ + exit_SUCCESS(); /* -v */ } /* Tell kernel we are special(i.e. we get to see hidden entries) */ xioctl(fd, DEVFSDIOC_SET_EVENT_MASK, 0); @@ -474,7 +474,7 @@ int devfsd_main(int argc, char **argv) dir_operation(SERVICE, mount_point, 0, NULL); if (ENABLE_DEVFSD_FG_NP && no_polling) - exit(EXIT_SUCCESS); + exit_SUCCESS(); if (ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG) logmode = LOGMODE_BOTH; diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 01b4e8e..d8d8f61 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -1271,7 +1271,7 @@ static void identify(uint16_t *val) } } - exit(EXIT_SUCCESS); + exit_SUCCESS(); } #endif diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index b25d497..e3741ee 100644 --- a/miscutils/i2c_tools.c +++ b/miscutils/i2c_tools.c @@ -1212,7 +1212,7 @@ static void NORETURN list_i2c_busses_and_exit(void) } } - exit(EXIT_SUCCESS); + exit_SUCCESS(); } static void NORETURN no_support(const char *cmd) diff --git a/miscutils/less.c b/miscutils/less.c index 6825e55..82c4b21 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -333,10 +333,10 @@ static void restore_tty(void) clear_line(); } -static void less_exit(void) +static NOINLINE void less_exit(void) { restore_tty(); - exit(EXIT_SUCCESS); + exit_SUCCESS(); } #if (ENABLE_FEATURE_LESS_DASHCMD && ENABLE_FEATURE_LESS_LINENUMS) \ diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index d8e9c78..9f5a4b8 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c @@ -76,7 +76,7 @@ static void shutdown_on_signal(int sig UNUSED_PARAM) { remove_pidfile_std_path_and_ext("watchdog"); shutdown_watchdog(); - _exit(EXIT_SUCCESS); + _exit_SUCCESS(); } static void watchdog_open(const char* device) -- cgit v1.1