diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-07-12 21:08:30 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-07-12 21:08:30 +0000 |
commit | 411df6592d91b72d1e98d0e50a1012477f3ca312 (patch) | |
tree | 536780d7c650d2deb6798423b703fe1ad38fb41d /usr.bin/mandoc/mdoc.c | |
parent | 475001105e136851bef0c0389f449eb102901714 (diff) |
sync to 1.7.23: pass error code to mdoc_nerr() instead of error string
and use the so improved mdoc_nerr() at many places
Diffstat (limited to 'usr.bin/mandoc/mdoc.c')
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 5b90dbb41bf..e780ff806cf 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.14 2009/07/12 20:30:27 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.15 2009/07/12 21:08:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -329,24 +329,6 @@ mdoc_vwarn(struct mdoc *mdoc, int ln, int pos, const char *fmt, ...) int -mdoc_nerr(struct mdoc *mdoc, const struct mdoc_node *node, - const char *fmt, ...) -{ - char buf[256]; - va_list ap; - - if (NULL == mdoc->cb.mdoc_err) - return(0); - - va_start(ap, fmt); - (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap); - va_end(ap); - return((*mdoc->cb.mdoc_err)(mdoc->data, - node->line, node->pos, buf)); -} - - -int mdoc_warn(struct mdoc *mdoc, enum mdoc_warn type, const char *fmt, ...) { @@ -534,8 +516,7 @@ node_alloc(struct mdoc *mdoc, int line, struct mdoc_node *p; if (NULL == (p = calloc(1, sizeof(struct mdoc_node)))) { - (void)perr(mdoc, (mdoc)->last->line, - (mdoc)->last->pos, EMALLOC); + (void)mdoc_nerr(mdoc, mdoc->last, EMALLOC); return(NULL); } @@ -631,10 +612,10 @@ mdoc_word_alloc(struct mdoc *mdoc, if (NULL == p) return(0); if (NULL == (p->string = strdup(word))) { - (void)perr(mdoc, (mdoc)->last->line, - (mdoc)->last->pos, EMALLOC); + (void)mdoc_nerr(mdoc, mdoc->last, EMALLOC); return(0); } + return(node_append(mdoc, p)); } |