diff --git a/contrib/mandoc/mdoc.c b/contrib/mandoc/mdoc.c --- a/contrib/mandoc/mdoc.c +++ b/contrib/mandoc/mdoc.c @@ -165,8 +165,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs) { struct roff_node *n; - const char *cp, *sp; - char *c, *ws, *end; + char *c, *ws, *end, *cp, *sp; n = mdoc->last; diff --git a/contrib/mandoc/out.c b/contrib/mandoc/out.c --- a/contrib/mandoc/out.c +++ b/contrib/mandoc/out.c @@ -457,8 +457,8 @@ tblcalc_literal(struct rofftbl *tbl, struct roffcol *col, const struct tbl_dat *dp, size_t mw) { - const char *str; /* Beginning of the first line. */ - const char *beg; /* Beginning of the current line. */ + char *str; /* Beginning of the first line. */ + char *beg; /* Beginning of the current line. */ char *end; /* End of the current line. */ /* Widths in basic units. */ diff --git a/contrib/mandoc/read.c b/contrib/mandoc/read.c --- a/contrib/mandoc/read.c +++ b/contrib/mandoc/read.c @@ -628,7 +628,7 @@ int mparse_open(struct mparse *curp, const char *file) { - char *cp; + const char *cp; int fd, save_errno; cp = strrchr(file, '.'); @@ -645,10 +645,12 @@ */ if ( ! curp->gzip) { + char *fn; + save_errno = errno; - mandoc_asprintf(&cp, "%s.gz", file); - fd = open(cp, O_RDONLY); - free(cp); + mandoc_asprintf(&fn, "%s.gz", file); + fd = open(fn, O_RDONLY); + free(fn); errno = save_errno; if (fd != -1) { curp->gzip = 1;