diff options
author | Davidlohr Bueso | 2010-10-22 17:25:46 +0200 |
---|---|---|
committer | Karel Zak | 2010-11-01 15:17:10 +0100 |
commit | f0961db21f912511ed6ac7fee02e26b40efe0d8c (patch) | |
tree | 558e42aa2578012216d3b2e63855abe7e59926d8 /text-utils/ul.c | |
parent | col: use err.h and EXIT_* macros (diff) | |
download | kernel-qcow2-util-linux-f0961db21f912511ed6ac7fee02e26b40efe0d8c.tar.gz kernel-qcow2-util-linux-f0961db21f912511ed6ac7fee02e26b40efe0d8c.tar.xz kernel-qcow2-util-linux-f0961db21f912511ed6ac7fee02e26b40efe0d8c.zip |
ul: use xalloc for memory allocation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'text-utils/ul.c')
-rw-r--r-- | text-utils/ul.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/text-utils/ul.c b/text-utils/ul.c index ab0a6e77c..30f24e9d5 100644 --- a/text-utils/ul.c +++ b/text-utils/ul.c @@ -49,8 +49,9 @@ #include <signal.h> /* for signal() */ #include <err.h> #include <errno.h> -#include "nls.h" +#include "nls.h" +#include "xalloc.h" #include "widechar.h" #ifdef HAVE_WIDECHAR @@ -426,9 +427,7 @@ void initbuf(void) { if (obuf == NULL) { /* First time. */ obuflen = INITBUF; - obuf = malloc(sizeof(struct CHAR) * obuflen); - if (obuf == NULL) - err(EXIT_FAILURE, _("unable to allocate buffer")); + obuf = xmalloc(sizeof(struct CHAR) * obuflen); } /* assumes NORMAL == 0 */ @@ -594,9 +593,7 @@ needcol(int col) { : obuflen * 2; /* Now we can try to expand obuf. */ - obuf = realloc(obuf, sizeof(struct CHAR) * obuflen); - if (obuf == NULL) - err(EXIT_FAILURE, _("growing buffer failed")); + obuf = xrealloc(obuf, sizeof(struct CHAR) * obuflen); } } |