From b115f948b8e55e6c3cef4bfa81f62c190af37a59 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 17 Mar 2011 08:49:34 +0000 Subject: Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.h so that everybody can use them. This follows the convention of libXXXX.h being internal to a library and XXXX.h being the external interface. Not only does this allow the removal of lots of redundant NULL-checking code, it also sets the tone for adding new mandoc-global routines. --- term.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'term.c') diff --git a/term.c b/term.c index 6b48196b..a106224b 100644 --- a/term.c +++ b/term.c @@ -80,12 +80,7 @@ term_alloc(enum termenc enc) { struct termp *p; - p = calloc(1, sizeof(struct termp)); - if (NULL == p) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } - + p = mandoc_calloc(1, sizeof(struct termp)); p->enc = enc; return(p); } @@ -579,11 +574,7 @@ adjbuf(struct termp *p, size_t sz) while (sz >= p->maxcols) p->maxcols <<= 2; - p->buf = realloc(p->buf, p->maxcols); - if (NULL == p->buf) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } + p->buf = mandoc_realloc(p->buf, p->maxcols); } -- cgit