summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-11-08 00:15:23 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-11-08 00:15:23 +0000
commit7f5351a1e9d07e9a65c22430e56ff4c50c4a9bdf (patch)
treee11bfd5999a90dc1e0b895076fb6eb87f5b41506
parent9830303b6541ca2717331d52b40997c9e566a48b (diff)
downloadmandoc-7f5351a1e9d07e9a65c22430e56ff4c50c4a9bdf.tar.gz
Const-ify some mchars arguments. I think these are non-const for historical
dumbness on my part.
-rw-r--r--chars.c15
-rw-r--r--mandoc.34
-rw-r--r--mandoc.h4
3 files changed, 13 insertions, 10 deletions
diff --git a/chars.c b/chars.c
index 924497d3..4aa92bac 100644
--- a/chars.c
+++ b/chars.c
@@ -51,7 +51,8 @@ struct mchars {
struct ln **htab;
};
-static const struct ln *find(struct mchars *, const char *, size_t);
+static const struct ln *find(const struct mchars *,
+ const char *, size_t);
void
mchars_free(struct mchars *arg)
@@ -96,7 +97,7 @@ mchars_alloc(void)
}
int
-mchars_spec2cp(struct mchars *arg, const char *p, size_t sz)
+mchars_spec2cp(const struct mchars *arg, const char *p, size_t sz)
{
const struct ln *ln;
@@ -113,7 +114,8 @@ mchars_num2char(const char *p, size_t sz)
if ((i = mandoc_strntoi(p, sz, 10)) < 0)
return('\0');
- return(i > 0 && i < 256 && isprint(i) ? i : '\0');
+ return(i > 0 && i < 256 && isprint(i) ?
+ /* LINTED */ i : '\0');
}
int
@@ -128,7 +130,8 @@ mchars_num2uc(const char *p, size_t sz)
}
const char *
-mchars_spec2str(struct mchars *arg, const char *p, size_t sz, size_t *rsz)
+mchars_spec2str(const struct mchars *arg,
+ const char *p, size_t sz, size_t *rsz)
{
const struct ln *ln;
@@ -143,9 +146,9 @@ mchars_spec2str(struct mchars *arg, const char *p, size_t sz, size_t *rsz)
}
static const struct ln *
-find(struct mchars *tab, const char *p, size_t sz)
+find(const struct mchars *tab, const char *p, size_t sz)
{
- struct ln *pp;
+ const struct ln *pp;
int hash;
assert(p);
diff --git a/mandoc.3 b/mandoc.3
index 058c4a12..b7a2e6a4 100644
--- a/mandoc.3
+++ b/mandoc.3
@@ -76,14 +76,14 @@
.Fn mchars_num2uc "const char *cp" "size_t sz"
.Ft "const char *"
.Fo mchars_spec2str
-.Fa "struct mchars *p"
+.Fa "const struct mchars *p"
.Fa "const char *cp"
.Fa "size_t sz"
.Fa "size_t *rsz"
.Fc
.Ft int
.Fo mchars_spec2cp
-.Fa "struct mchars *p"
+.Fa "const struct mchars *p"
.Fa "const char *cp"
.Fa "size_t sz"
.Ft "const char *"
diff --git a/mandoc.h b/mandoc.h
index fc7e19df..85724bed 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -409,9 +409,9 @@ struct mchars *mchars_alloc(void);
void mchars_free(struct mchars *);
char mchars_num2char(const char *, size_t);
int mchars_num2uc(const char *, size_t);
-int mchars_spec2cp(struct mchars *,
+int mchars_spec2cp(const struct mchars *,
const char *, size_t);
-const char *mchars_spec2str(struct mchars *,
+const char *mchars_spec2str(const struct mchars *,
const char *, size_t, size_t *);
struct mparse *mparse_alloc(enum mparset,
enum mandoclevel, mandocmsg, void *);