aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-06-20 02:24:40 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-06-20 02:24:40 +0000
commitc2201e153e701130fbd08c75765b330f9280144f (patch)
tree2486817a616731edd1f5e98834c12ed2b786a044 /mandocdb.c
parent4b68a3c80b4d2c00a2dd66f531e52f4677a118c6 (diff)
downloadmandoc-c2201e153e701130fbd08c75765b330f9280144f.tar.gz
mandoc-c2201e153e701130fbd08c75765b330f9280144f.tar.zst
mandoc-c2201e153e701130fbd08c75765b330f9280144f.zip
Merge from OpenBSD - Marc Espie improved the ohash interface:
* rename the halloc callback to calloc, provide overflow protection * rename the hfree callback to free, drop the useless size argument * prevent integer overflows in ohash_resize
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 4066025a..930133cc 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.151 2014/06/20 01:21:48 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.152 2014/06/20 02:24:40 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -145,8 +145,8 @@ static int dbopen(int);
static void dbprune(void);
static void filescan(const char *);
static void *hash_alloc(size_t, void *);
-static void hash_free(void *, size_t, void *);
-static void *hash_halloc(size_t, void *);
+static void hash_free(void *, void *);
+static void *hash_calloc(size_t, size_t, void *);
static void mlink_add(struct mlink *, const struct stat *);
static void mlink_check(struct mpage *, struct mlink *);
static void mlink_free(struct mlink *);
@@ -336,8 +336,8 @@ main(int argc, char *argv[])
memset(&dirs, 0, sizeof(struct manpaths));
mpages_info.alloc = mlinks_info.alloc = hash_alloc;
- mpages_info.halloc = mlinks_info.halloc = hash_halloc;
- mpages_info.hfree = mlinks_info.hfree = hash_free;
+ mpages_info.calloc = mlinks_info.calloc = hash_calloc;
+ mpages_info.free = mlinks_info.free = hash_free;
mpages_info.key_offset = offsetof(struct mpage, inodev);
mlinks_info.key_offset = offsetof(struct mlink, file);
@@ -1088,8 +1088,8 @@ mpages_merge(struct mchars *mc, struct mparse *mp)
enum mandoclevel lvl;
str_info.alloc = hash_alloc;
- str_info.halloc = hash_halloc;
- str_info.hfree = hash_free;
+ str_info.calloc = hash_calloc;
+ str_info.free = hash_free;
str_info.key_offset = offsetof(struct str, key);
if (0 == nodb)
@@ -2348,10 +2348,10 @@ prepare_statements:
}
static void *
-hash_halloc(size_t sz, void *arg)
+hash_calloc(size_t n, size_t sz, void *arg)
{
- return(mandoc_calloc(1, sz));
+ return(mandoc_calloc(n, sz));
}
static void *
@@ -2362,7 +2362,7 @@ hash_alloc(size_t sz, void *arg)
}
static void
-hash_free(void *p, size_t sz, void *arg)
+hash_free(void *p, void *arg)
{
free(p);