aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2012-06-08 12:05:27 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2012-06-08 12:05:27 +0000
commite7cf06ea5e3276e5c093c7d3e902116b91a6be0d (patch)
treea344ca4638fd025d77fabc9a9373a7772e985926 /mandocdb.c
parent905febe44eb2b872425a1c4331184e02d4ab7e52 (diff)
downloadmandoc-e7cf06ea5e3276e5c093c7d3e902116b91a6be0d.tar.gz
mandoc-e7cf06ea5e3276e5c093c7d3e902116b91a6be0d.tar.zst
mandoc-e7cf06ea5e3276e5c093c7d3e902116b91a6be0d.zip
Use C99 syntax for declaring the string-hash key array.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 824a72d7..d0f0fd1d 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.50 2012/06/08 10:43:01 kristaps Exp $ */
+/* $Id: mandocdb.c,v 1.51 2012/06/08 12:05:27 kristaps Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -79,7 +79,7 @@ struct str {
const struct of *of; /* if set, the owning parse */
struct str *next; /* next in owning parse sequence */
uint64_t mask; /* bitmask in sequence */
- char key[1]; /* the string itself */
+ char key[]; /* the string itself */
};
struct id {
@@ -1538,7 +1538,7 @@ straddbuf(const char *cp, size_t sz)
if (NULL != (s = hashget(cp, sz)))
return(s->key);
- s = mandoc_calloc(sizeof(struct str) + sz, 1);
+ s = mandoc_calloc(sizeof(struct str) + sz + 1, 1);
memcpy(s->key, cp, sz);
end = cp + sz;
@@ -1585,7 +1585,7 @@ wordaddbuf(const struct of *of,
s->mask |= v;
return;
} else if (NULL == s) {
- s = mandoc_calloc(sizeof(struct str) + sz, 1);
+ s = mandoc_calloc(sizeof(struct str) + sz + 1, 1);
memcpy(s->key, cp, sz);
end = cp + sz;
index = ohash_qlookupi(&strings, cp, &end);