diff options
-rw-r--r-- | chars.c | 15 | ||||
-rw-r--r-- | html.c | 14 | ||||
-rw-r--r-- | libmandoc.h | 5 | ||||
-rw-r--r-- | main.c | 8 | ||||
-rw-r--r-- | mandoc.h | 14 | ||||
-rw-r--r-- | out.c | 4 | ||||
-rw-r--r-- | term.c | 15 | ||||
-rw-r--r-- | term_ps.c | 9 |
8 files changed, 23 insertions, 61 deletions
@@ -1,4 +1,4 @@ -/* $Id: chars.c,v 1.32 2011/01/30 16:05:37 schwarze Exp $ */ +/* $Id: chars.c,v 1.33 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -92,17 +92,8 @@ chars_init(enum chars type) * (they're in-line re-ordered during lookup). */ - tab = malloc(sizeof(struct ctab)); - if (NULL == tab) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } - - htab = calloc(PRINT_HI - PRINT_LO + 1, sizeof(struct ln **)); - if (NULL == htab) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } + tab = mandoc_malloc(sizeof(struct ctab)); + htab = mandoc_calloc(PRINT_HI - PRINT_LO + 1, sizeof(struct ln **)); for (i = 0; i < LINES_MAX; i++) { hash = (int)lines[i].code[0] - PRINT_LO; @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.127 2011/03/15 16:23:51 kristaps Exp $ */ +/* $Id: html.c,v 1.128 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -120,11 +120,7 @@ ml_alloc(char *outopts, enum htmltype type) toks[2] = "includes"; toks[3] = NULL; - h = calloc(1, sizeof(struct html)); - if (NULL == h) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } + h = mandoc_calloc(1, sizeof(struct html)); h->type = type; h->tags.head = NULL; @@ -400,11 +396,7 @@ print_otag(struct html *h, enum htmltag tag, /* Push this tags onto the stack of open scopes. */ if ( ! (HTML_NOSTACK & htmltags[tag].flags)) { - t = malloc(sizeof(struct tag)); - if (NULL == t) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } + t = mandoc_malloc(sizeof(struct tag)); t->tag = tag; t->next = h->tags.head; h->tags.head = t; diff --git a/libmandoc.h b/libmandoc.h index 3a8559b9..eadaf257 100644 --- a/libmandoc.h +++ b/libmandoc.h @@ -1,4 +1,4 @@ -/* $Id: libmandoc.h,v 1.11 2011/03/07 01:35:51 schwarze Exp $ */ +/* $Id: libmandoc.h,v 1.12 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -20,10 +20,7 @@ __BEGIN_DECLS int mandoc_special(char *); -void *mandoc_calloc(size_t, size_t); char *mandoc_strdup(const char *); -void *mandoc_malloc(size_t); -void *mandoc_realloc(void *, size_t); char *mandoc_getarg(char **, mandocmsg, void *, int, int *); char *mandoc_normdate(char *, mandocmsg, void *, int, int); int mandoc_eos(const char *, size_t, int); @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.151 2011/03/16 15:28:35 kristaps Exp $ */ +/* $Id: main.c,v 1.152 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -405,11 +405,7 @@ resize_buf(struct buf *buf, size_t initial) { buf->sz = buf->sz > initial/2 ? 2 * buf->sz : initial; - buf->buf = realloc(buf->buf, buf->sz); - if (NULL == buf->buf) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } + buf->buf = mandoc_realloc(buf->buf, buf->sz); } @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.58 2011/03/07 01:35:51 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.59 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -312,14 +312,14 @@ struct regset { struct reg regs[REG__MAX]; }; +typedef int (*mandocmsg)(enum mandocerr, void *, + int, int, const char *); + __BEGIN_DECLS -/* - * Callback function for warnings, errors, and fatal errors as they - * occur in the compilers libroff, libmdoc, and libman. - */ -typedef int (*mandocmsg)(enum mandocerr, void *, - int, int, const char *); +void *mandoc_calloc(size_t, size_t); +void *mandoc_malloc(size_t); +void *mandoc_realloc(void *, size_t); __END_DECLS @@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.38 2011/03/15 16:23:51 kristaps Exp $ */ +/* $Id: out.c,v 1.39 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -431,7 +431,7 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp) */ assert(NULL == tbl->cols); - tbl->cols = calloc + tbl->cols = mandoc_calloc ((size_t)sp->tbl->cols, sizeof(struct roffcol)); hp = sp->head; @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.178 2011/03/15 16:23:51 kristaps Exp $ */ +/* $Id: term.c,v 1.179 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -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); } @@ -1,4 +1,4 @@ -/* $Id: term_ps.c,v 1.47 2011/03/07 01:58:24 schwarze Exp $ */ +/* $Id: term_ps.c,v 1.48 2011/03/17 08:49:34 kristaps Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -366,14 +366,9 @@ ps_growbuf(struct termp *p, size_t sz) p->engine.ps.psmargsz += sz; - p->engine.ps.psmarg = realloc + p->engine.ps.psmarg = mandoc_realloc (p->engine.ps.psmarg, p->engine.ps.psmargsz); - - if (NULL == p->engine.ps.psmarg) { - perror(NULL); - exit((int)MANDOCLEVEL_SYSERR); - } } static double ps_hspan(const struct termp *, |