-/* $Id: mandocdb.c,v 1.119 2014/03/23 11:25:26 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.120 2014/03/23 12:11:18 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
return(0);
}
- if (-1 == asprintf(&cp, "%s(%s)", n->string, n->next->string)) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&cp, "%s(%s)", n->string, n->next->string);
putkey(mpage, cp, TYPE_Xr);
free(cp);
return(0);
-/* $Id: mansearch.c,v 1.23 2014/03/23 11:25:26 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.24 2014/03/23 12:11:18 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
(strcmp(sec, prevsec) ||
strcmp(arch, prevarch))) {
sep2 = '\0' == *prevarch ? "" : "/";
- if (-1 == asprintf(&newnames, "%s(%s%s%s)",
- oldnames, prevsec, sep2, prevarch)) {
- perror(0);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&newnames, "%s(%s%s%s)",
+ oldnames, prevsec, sep2, prevarch);
free(mpage->names);
oldnames = mpage->names = newnames;
free(prevsec);
/* Append the new name. */
- if (-1 == asprintf(&newnames, "%s%s%s",
- oldnames, sep1, name)) {
- perror(0);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&newnames, "%s%s%s",
+ oldnames, sep1, name);
free(mpage->names);
mpage->names = newnames;
fsec = "0";
}
sep2 = '\0' == *arch ? "" : "/";
- if (-1 == asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s",
- path, sep1, sec, sep2, arch, name, fsec)) {
- perror(0);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s",
+ path, sep1, sec, sep2, arch, name, fsec);
}
if (SQLITE_DONE != c)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
if (NULL != prevsec) {
sep2 = '\0' == *prevarch ? "" : "/";
- if (-1 == asprintf(&newnames, "%s(%s%s%s)",
- mpage->names, prevsec, sep2, prevarch)) {
- perror(0);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&newnames, "%s(%s%s%s)",
+ mpage->names, prevsec, sep2, prevarch);
free(mpage->names);
mpage->names = newnames;
free(prevsec);
sep1 = " # ";
}
data = sqlite3_column_text(s, 1);
- if (-1 == asprintf(&newoutput, "%s%s%s",
- oldoutput, sep1, data)) {
- perror(0);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&newoutput, "%s%s%s",
+ oldoutput, sep1, data);
free(output);
output = newoutput;
}
if (NULL == value)
return(cur);
- if (-1 == asprintf(&cp, format, value)) {
- perror(0);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&cp, format, value);
cur->next = mandoc_calloc(1, sizeof(struct expr));
cur = cur->next;
cur->and = 1;
-/* $Id: mdoc.c,v 1.209 2014/03/23 11:25:26 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.210 2014/03/23 12:11:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
n = mdoc->last;
addstr = roff_strdup(mdoc->roff, p);
- if (-1 == asprintf(&newstr, "%s %s", n->string, addstr)) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ mandoc_asprintf(&newstr, "%s %s", n->string, addstr);
free(addstr);
free(n->string);
n->string = newstr;
-/* $Id: mdoc_validate.c,v 1.203 2014/03/23 11:25:26 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.204 2014/03/23 12:11:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
if (-1 == uname(&utsname)) {
mdoc_nmsg(mdoc, n, MANDOCERR_UNAME);
defbuf = mandoc_strdup("UNKNOWN");
- } else if (-1 == asprintf(&defbuf, "%s %s",
- utsname.sysname, utsname.release)) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ } else
+ mandoc_asprintf(&defbuf, "%s %s",
+ utsname.sysname, utsname.release);
}
mdoc->meta.os = mandoc_strdup(defbuf);
#endif /*!OSNAME*/
-/* $Id: roff.c,v 1.201 2014/03/23 11:25:26 schwarze Exp $ */
+/* $Id: roff.c,v 1.202 2014/03/23 12:11:18 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
/* Spring the input line trap. */
if (1 == roffit_lines) {
- isz = asprintf(&p, "%s\n.%s", *bufp, roffit_macro);
- if (-1 == isz) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
+ isz = mandoc_asprintf(&p, "%s\n.%s", *bufp, roffit_macro);
free(*bufp);
*bufp = p;
*szp = isz + 1;