From ab9c44b1a41c9a17cd0f8a8f1e5517756ccb8bf0 Mon Sep 17 00:00:00 2001
From: Denis Vlasenko <vda.linux@googlemail.com>
Date: Wed, 15 Aug 2007 20:07:53 +0000
Subject: v[hp]error_msg have 2-3 callsites only -> incorporate there.

---
 libbb/Kbuild               |  2 --
 libbb/herror_msg.c         |  2 +-
 libbb/herror_msg_and_die.c |  2 +-
 libbb/perror_msg.c         |  5 +----
 libbb/perror_msg_and_die.c |  5 +----
 libbb/vherror_msg.c        | 15 ---------------
 libbb/vperror_msg.c        | 15 ---------------
 libbb/xfuncs.c             |  4 ++--
 8 files changed, 6 insertions(+), 44 deletions(-)
 delete mode 100644 libbb/vherror_msg.c
 delete mode 100644 libbb/vperror_msg.c

(limited to 'libbb')

diff --git a/libbb/Kbuild b/libbb/Kbuild
index 3ffda1240..1800bde8f 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -87,8 +87,6 @@ lib-y += uuencode.o
 lib-y += vdprintf.o
 lib-y += verror_msg.o
 lib-y += vfork_daemon_rexec.o
-lib-y += vherror_msg.o
-lib-y += vperror_msg.o
 lib-y += warn_ignoring_args.o
 lib-y += wfopen.o
 lib-y += wfopen_input.o
diff --git a/libbb/herror_msg.c b/libbb/herror_msg.c
index 943702c68..264690ba0 100644
--- a/libbb/herror_msg.c
+++ b/libbb/herror_msg.c
@@ -14,6 +14,6 @@ void bb_herror_msg(const char *s, ...)
 	va_list p;
 
 	va_start(p, s);
-	bb_vherror_msg(s, p);
+	bb_verror_msg(s, p, hstrerror(h_errno));
 	va_end(p);
 }
diff --git a/libbb/herror_msg_and_die.c b/libbb/herror_msg_and_die.c
index 8c77378d7..894c80f38 100644
--- a/libbb/herror_msg_and_die.c
+++ b/libbb/herror_msg_and_die.c
@@ -14,7 +14,7 @@ void bb_herror_msg_and_die(const char *s, ...)
 	va_list p;
 
 	va_start(p, s);
-	bb_vherror_msg(s, p);
+	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 2ec1a9b2a..a958cff00 100644
--- a/libbb/perror_msg.c
+++ b/libbb/perror_msg.c
@@ -15,9 +15,6 @@ void bb_perror_msg(const char *s, ...)
 
 	va_start(p, s);
 	/* Guard against "<error message>: Success" */
-	if (!errno)
-		bb_verror_msg(s, p, NULL);
-	else
-		bb_vperror_msg(s, p);
+	bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
 	va_end(p);
 }
diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c
index 90f56e04c..15f46fc05 100644
--- a/libbb/perror_msg_and_die.c
+++ b/libbb/perror_msg_and_die.c
@@ -15,10 +15,7 @@ void bb_perror_msg_and_die(const char *s, ...)
 
 	va_start(p, s);
 	/* Guard against "<error message>: Success" */
-	if (!errno)
-		bb_verror_msg(s, p, NULL);
-	else
-		bb_vperror_msg(s, p);
+	bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
 	va_end(p);
 	xfunc_die();
 }
diff --git a/libbb/vherror_msg.c b/libbb/vherror_msg.c
deleted file mode 100644
index 04446a090..000000000
--- a/libbb/vherror_msg.c
+++ /dev/null
@@ -1,15 +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 bb_vherror_msg(const char *s, va_list p)
-{
-	bb_verror_msg(s, p, hstrerror(h_errno));
-}
diff --git a/libbb/vperror_msg.c b/libbb/vperror_msg.c
deleted file mode 100644
index c3f79c23b..000000000
--- a/libbb/vperror_msg.c
+++ /dev/null
@@ -1,15 +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 bb_vperror_msg(const char *s, va_list p)
-{
-	bb_verror_msg(s, p, strerror(errno));
-}
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 4e17c28bd..64061e4f0 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -648,7 +648,7 @@ void ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,..
 
 	if (ioctl(fd, request, argp) < 0) {
 		va_start(p, fmt);
-		bb_vperror_msg(fmt, p);
+		bb_verror_msg(fmt, p, strerror(errno));
 		/* xfunc_die can actually longjmp, so be nice */
 		va_end(p);
 		xfunc_die();
@@ -662,7 +662,7 @@ int ioctl_or_perror(int fd, int request, void *argp, const char *fmt,...)
 
 	if (ret < 0) {
 		va_start(p, fmt);
-		bb_vperror_msg(fmt, p);
+		bb_verror_msg(fmt, p, strerror(errno));
 		va_end(p);
 	}
 	return ret;
-- 
cgit v1.2.3-55-g6feb