Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh if HAVE_VASPRINTF (set ifdef BSD4_4), use vasprintf()...
details: https://anonhg.NetBSD.org/src/rev/ba5423579526
branches: trunk
changeset: 501816:ba5423579526
user: lukem <lukem%NetBSD.org@localhost>
date: Sun Jan 07 23:39:07 2001 +0000
description:
if HAVE_VASPRINTF (set ifdef BSD4_4), use vasprintf() instead of homegrown
code in doformat(). results in slightly smaller /bin/sh. idea suggested by
Witold J. Wnuk <witek%pd37.warszawa.sdi.tpnet.pl@localhost>, approved by christos.
diffstat:
bin/sh/output.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diffs (52 lines):
diff -r dde569542a8b -r ba5423579526 bin/sh/output.c
--- a/bin/sh/output.c Sun Jan 07 23:29:12 2001 +0000
+++ b/bin/sh/output.c Sun Jan 07 23:39:07 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: output.c,v 1.22 2001/01/07 22:19:53 lukem Exp $ */
+/* $NetBSD: output.c,v 1.23 2001/01/07 23:39:07 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: output.c,v 1.22 2001/01/07 22:19:53 lukem Exp $");
+__RCSID("$NetBSD: output.c,v 1.23 2001/01/07 23:39:07 lukem Exp $");
#endif
#endif /* not lint */
@@ -335,13 +335,24 @@
static const char digit[] = "0123456789ABCDEF";
+#ifdef BSD4_4
+#define HAVE_VASPRINTF 1
+#endif
+
void
doformat(dest, f, ap)
struct output *dest;
const char *f; /* format string */
va_list ap;
- {
+{
+#if HAVE_VASPRINTF
+ char *s;
+
+ vasprintf(&s, f, ap);
+ outstr(s, dest);
+ free(s);
+#else /* !HAVE_VASPRINTF */
char c;
char temp[TEMPSIZE];
int flushleft;
@@ -521,6 +532,7 @@
}
f++;
}
+#endif /* !HAVE_VASPRINTF */
}
Home |
Main Index |
Thread Index |
Old Index