summaryrefslogtreecommitdiff
path: root/lib/libcurses/safe_sprintf.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-08-15 19:06:39 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-08-15 19:06:39 +0000
commiteff1ef758b0ad22d72d2d0e6691e0dcf09870f56 (patch)
tree27184a5d40572d7e67fb966ffe6dc59eef81be77 /lib/libcurses/safe_sprintf.c
parent48794a3cba64d810b2e5ce122ccb0bc9fea78a10 (diff)
simplify a few things wrt realloc
Diffstat (limited to 'lib/libcurses/safe_sprintf.c')
-rw-r--r--lib/libcurses/safe_sprintf.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libcurses/safe_sprintf.c b/lib/libcurses/safe_sprintf.c
index 01f98d470cd..397ede9c605 100644
--- a/lib/libcurses/safe_sprintf.c
+++ b/lib/libcurses/safe_sprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safe_sprintf.c,v 1.3 1998/08/14 21:11:42 millert Exp $ */
+/* $OpenBSD: safe_sprintf.c,v 1.4 1998/08/15 19:06:38 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -232,10 +232,7 @@ _nc_printf_string(const char *fmt, va_list ap)
if (screen_lines > rows) rows = screen_lines;
if (screen_columns > cols) cols = screen_columns;
len = (rows * (cols + 1)) + 1;
- if (buf == 0)
- nbuf = malloc(len);
- else
- nbuf = realloc(buf, len);
+ nbuf = buf ? realloc(buf, len) : malloc(len);
if (nbuf == NULL) {
if (buf != NULL)
free(buf);