aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-01 04:14:14 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-01 04:14:14 +0000
commitbdec20eae6e2b2f2fa464025170b85076a6ae68f (patch)
tree04dab8325e4c0f6bdf723e5cc86e8cd70a9dc93c
parent62befa7fcd92427df4055e759c9da7358b13ef9e (diff)
downloadmandoc-bdec20eae6e2b2f2fa464025170b85076a6ae68f.tar.gz
mandoc-bdec20eae6e2b2f2fa464025170b85076a6ae68f.tar.zst
mandoc-bdec20eae6e2b2f2fa464025170b85076a6ae68f.zip
The file read.c is part of the parser, so it cannot include main.h,
which is not part of the parser. Besides, the parser *does* modify the input buffer, so marking it "const" in the mparse_readmem() interface is an outright lie. Fix all this by killing the const, the UNCONST, and the bogus inclusion.
-rw-r--r--mandoc.h4
-rw-r--r--read.c7
2 files changed, 5 insertions, 6 deletions
diff --git a/mandoc.h b/mandoc.h
index cc8ee6f5..29eeb995 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.174 2014/12/01 04:05:32 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.175 2014/12/01 04:14:14 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -437,7 +437,7 @@ void mparse_free(struct mparse *);
void mparse_keep(struct mparse *);
enum mandoclevel mparse_open(struct mparse *, int *, const char *);
enum mandoclevel mparse_readfd(struct mparse *, int, const char *);
-enum mandoclevel mparse_readmem(struct mparse *, const void *, size_t,
+enum mandoclevel mparse_readmem(struct mparse *, void *, size_t,
const char *);
void mparse_reset(struct mparse *);
void mparse_result(struct mparse *,
diff --git a/read.c b/read.c
index f4c1eb90..8d6cb103 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.103 2014/11/30 05:29:00 schwarze Exp $ */
+/* $Id: read.c,v 1.104 2014/12/01 04:14:14 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -41,7 +41,6 @@
#include "libmandoc.h"
#include "mdoc.h"
#include "man.h"
-#include "main.h"
#define REPARSE_LIMIT 1000
@@ -756,12 +755,12 @@ mparse_parse_buffer(struct mparse *curp, struct buf blk, const char *file)
}
enum mandoclevel
-mparse_readmem(struct mparse *curp, const void *buf, size_t len,
+mparse_readmem(struct mparse *curp, void *buf, size_t len,
const char *file)
{
struct buf blk;
- blk.buf = UNCONST(buf);
+ blk.buf = buf;
blk.sz = len;
mparse_parse_buffer(curp, blk, file);