summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2017-04-29 21:48:11 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2017-04-29 21:48:11 +0000
commit342b089bcabe39424149ef0f654713a062623657 (patch)
tree98c2f4139049f17f7330747ce27c54731d8edc5d
parent10e0318afac9a26bd6ef86585033783be4888582 (diff)
Notes
-rw-r--r--usr.bin/printf/printf.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
index f21a0152a477c..62704416599e0 100644
--- a/usr.bin/printf/printf.c
+++ b/usr.bin/printf/printf.c
@@ -70,20 +70,15 @@ static const char rcsid[] =
#endif
#define PF(f, func) do { \
- char *b = NULL; \
if (havewidth) \
if (haveprec) \
- (void)asprintf(&b, f, fieldwidth, precision, func); \
+ (void)printf(f, fieldwidth, precision, func); \
else \
- (void)asprintf(&b, f, fieldwidth, func); \
+ (void)printf(f, fieldwidth, func); \
else if (haveprec) \
- (void)asprintf(&b, f, precision, func); \
+ (void)printf(f, precision, func); \
else \
- (void)asprintf(&b, f, func); \
- if (b) { \
- (void)fputs(b, stdout); \
- free(b); \
- } \
+ (void)printf(f, func); \
} while (0)
static int asciicode(void);
@@ -394,7 +389,8 @@ printf_doformat(char *fmt, int *rval)
char p;
p = getchr();
- PF(start, p);
+ if (p != '\0')
+ PF(start, p);
break;
}
case 's': {