libbb: reduce number of *error_msg[_and_die].c files by four

No code changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-07-04 17:16:44 +02:00
parent 926031b764
commit 7e1bb4bc5c
8 changed files with 46 additions and 94 deletions

View File

@ -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

View File

@ -1,19 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Utility routines.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* 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);
}

View File

@ -1,20 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Utility routines.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* 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();
}

View File

@ -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();
}

View File

@ -1,20 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Utility routines.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* 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();
}

View File

@ -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 "<error message>: 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);
}

View File

@ -1,26 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Utility routines.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* 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 "<error message>: 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);
}

View File

@ -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);
}