From 7e1bb4bc5c1e2724a00bb4ef18925c8ed6f44886 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 4 Jul 2010 17:16:44 +0200 Subject: libbb: reduce number of *error_msg[_and_die].c files by four No code changes. Signed-off-by: Denys Vlasenko --- libbb/Kbuild.src | 4 ---- libbb/error_msg.c | 19 ------------------- libbb/error_msg_and_die.c | 20 -------------------- libbb/herror_msg.c | 11 ++++++++++- libbb/herror_msg_and_die.c | 20 -------------------- libbb/perror_msg.c | 17 ++++++++++++++++- libbb/perror_msg_and_die.c | 26 -------------------------- libbb/verror_msg.c | 23 ++++++++++++++++++++--- 8 files changed, 46 insertions(+), 94 deletions(-) delete mode 100644 libbb/error_msg.c delete mode 100644 libbb/error_msg_and_die.c delete mode 100644 libbb/herror_msg_and_die.c delete mode 100644 libbb/perror_msg_and_die.c (limited to 'libbb') diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index cb1f8e954..5c567000a 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src @@ -32,8 +32,6 @@ lib-y += create_icmp_socket.o lib-y += default_error_retval.o lib-y += device_open.o lib-y += dump.o -lib-y += error_msg.o -lib-y += error_msg_and_die.o lib-y += execable.o lib-y += fclose_nonstdin.o lib-y += fflush_stdout_and_exit.o @@ -48,7 +46,6 @@ lib-y += getopt32.o lib-y += getpty.o lib-y += get_volsize.o lib-y += herror_msg.o -lib-y += herror_msg_and_die.o lib-y += human_readable.o lib-y += inet_common.o lib-y += info_msg.o @@ -72,7 +69,6 @@ lib-y += obscure.o lib-y += parse_mode.o lib-y += parse_config.o lib-y += perror_msg.o -lib-y += perror_msg_and_die.o lib-y += perror_nomsg.o lib-y += perror_nomsg_and_die.o lib-y += pidfile.o diff --git a/libbb/error_msg.c b/libbb/error_msg.c deleted file mode 100644 index 802fd5715..000000000 --- a/libbb/error_msg.c +++ /dev/null @@ -1,19 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * Utility routines. - * - * Copyright (C) 1999-2004 by Erik Andersen - * - * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. - */ - -#include "libbb.h" - -void FAST_FUNC bb_error_msg(const char *s, ...) -{ - va_list p; - - va_start(p, s); - bb_verror_msg(s, p, NULL); - va_end(p); -} diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c deleted file mode 100644 index 243433b2d..000000000 --- a/libbb/error_msg_and_die.c +++ /dev/null @@ -1,20 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * Utility routines. - * - * Copyright (C) 1999-2004 by Erik Andersen - * - * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. - */ - -#include "libbb.h" - -void FAST_FUNC bb_error_msg_and_die(const char *s, ...) -{ - va_list p; - - va_start(p, s); - bb_verror_msg(s, p, NULL); - va_end(p); - xfunc_die(); -} diff --git a/libbb/herror_msg.c b/libbb/herror_msg.c index 7e4f64045..ca9274cf7 100644 --- a/libbb/herror_msg.c +++ b/libbb/herror_msg.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ - #include "libbb.h" void FAST_FUNC bb_herror_msg(const char *s, ...) @@ -17,3 +16,13 @@ void FAST_FUNC bb_herror_msg(const char *s, ...) bb_verror_msg(s, p, hstrerror(h_errno)); va_end(p); } + +void FAST_FUNC bb_herror_msg_and_die(const char *s, ...) +{ + va_list p; + + va_start(p, s); + bb_verror_msg(s, p, hstrerror(h_errno)); + va_end(p); + xfunc_die(); +} diff --git a/libbb/herror_msg_and_die.c b/libbb/herror_msg_and_die.c deleted file mode 100644 index 230fe645a..000000000 --- a/libbb/herror_msg_and_die.c +++ /dev/null @@ -1,20 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * Utility routines. - * - * Copyright (C) 1999-2004 by Erik Andersen - * - * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. - */ - -#include "libbb.h" - -void FAST_FUNC bb_herror_msg_and_die(const char *s, ...) -{ - va_list p; - - va_start(p, s); - bb_verror_msg(s, p, hstrerror(h_errno)); - va_end(p); - xfunc_die(); -} diff --git a/libbb/perror_msg.c b/libbb/perror_msg.c index 6c8e1b51e..cbba805fb 100644 --- a/libbb/perror_msg.c +++ b/libbb/perror_msg.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ - #include "libbb.h" void FAST_FUNC bb_perror_msg(const char *s, ...) @@ -19,7 +18,23 @@ void FAST_FUNC bb_perror_msg(const char *s, ...) va_end(p); } +void FAST_FUNC bb_perror_msg_and_die(const char *s, ...) +{ + va_list p; + + va_start(p, s); + /* Guard against ": Success" */ + bb_verror_msg(s, p, errno ? strerror(errno) : NULL); + va_end(p); + xfunc_die(); +} + void FAST_FUNC bb_simple_perror_msg(const char *s) { bb_perror_msg("%s", s); } + +void FAST_FUNC bb_simple_perror_msg_and_die(const char *s) +{ + bb_perror_msg_and_die("%s", s); +} diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c deleted file mode 100644 index 15615fa22..000000000 --- a/libbb/perror_msg_and_die.c +++ /dev/null @@ -1,26 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * Utility routines. - * - * Copyright (C) 1999-2004 by Erik Andersen - * - * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. - */ - -#include "libbb.h" - -void FAST_FUNC bb_perror_msg_and_die(const char *s, ...) -{ - va_list p; - - va_start(p, s); - /* Guard against ": Success" */ - bb_verror_msg(s, p, errno ? strerror(errno) : NULL); - va_end(p); - xfunc_die(); -} - -void FAST_FUNC bb_simple_perror_msg_and_die(const char *s) -{ - bb_perror_msg_and_die("%s", s); -} diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c index 613432906..c5fbc380c 100644 --- a/libbb/verror_msg.c +++ b/libbb/verror_msg.c @@ -76,12 +76,9 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr) free(msg); } - #ifdef VERSION_WITH_WRITEV - /* Code size is approximately the same, but currently it's the only user * of writev in entire bbox. __libc_writev in uclibc is ~50 bytes. */ - void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr) { int strerr_len, msgeol_len; @@ -139,3 +136,23 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr) free(msgc); } #endif + + +void FAST_FUNC bb_error_msg_and_die(const char *s, ...) +{ + va_list p; + + va_start(p, s); + bb_verror_msg(s, p, NULL); + va_end(p); + xfunc_die(); +} + +void FAST_FUNC bb_error_msg(const char *s, ...) +{ + va_list p; + + va_start(p, s); + bb_verror_msg(s, p, NULL); + va_end(p); +} -- cgit v1.2.3