version 1.35, 2014/04/23 16:34:50 |
version 1.37, 2014/06/20 02:24:40 |
Line 85 static void buildnames(struct manpage *, sqlite3 *, |
|
Line 85 static void buildnames(struct manpage *, sqlite3 *, |
|
static char *buildoutput(sqlite3 *, sqlite3_stmt *, |
static char *buildoutput(sqlite3 *, sqlite3_stmt *, |
uint64_t, uint64_t); |
uint64_t, uint64_t); |
static void *hash_alloc(size_t, void *); |
static void *hash_alloc(size_t, void *); |
static void hash_free(void *, size_t, void *); |
static void hash_free(void *, void *); |
static void *hash_halloc(size_t, void *); |
static void *hash_calloc(size_t, size_t, void *); |
static struct expr *exprcomp(const struct mansearch *, |
static struct expr *exprcomp(const struct mansearch *, |
int, char *[]); |
int, char *[]); |
static void exprfree(struct expr *); |
static void exprfree(struct expr *); |
Line 171 mansearch(const struct mansearch *search, |
|
Line 171 mansearch(const struct mansearch *search, |
|
unsigned int idx; |
unsigned int idx; |
size_t i, j, cur, maxres; |
size_t i, j, cur, maxres; |
|
|
memset(&info, 0, sizeof(struct ohash_info)); |
info.calloc = hash_calloc; |
|
|
info.halloc = hash_halloc; |
|
info.alloc = hash_alloc; |
info.alloc = hash_alloc; |
info.hfree = hash_free; |
info.free = hash_free; |
info.key_offset = offsetof(struct match, pageid); |
info.key_offset = offsetof(struct match, pageid); |
|
|
*sz = cur = maxres = 0; |
*sz = cur = maxres = 0; |
Line 328 mansearch(const struct mansearch *search, |
|
Line 326 mansearch(const struct mansearch *search, |
|
mp = ohash_next(&htab, &idx)) { |
mp = ohash_next(&htab, &idx)) { |
if (cur + 1 > maxres) { |
if (cur + 1 > maxres) { |
maxres += 1024; |
maxres += 1024; |
*res = mandoc_realloc(*res, |
*res = mandoc_reallocarray(*res, |
maxres * sizeof(struct manpage)); |
maxres, sizeof(struct manpage)); |
} |
} |
mpage = *res + cur; |
mpage = *res + cur; |
mpage->form = mp->form; |
mpage->form = mp->form; |
Line 790 exprfree(struct expr *p) |
|
Line 788 exprfree(struct expr *p) |
|
} |
} |
|
|
static void * |
static void * |
hash_halloc(size_t sz, void *arg) |
hash_calloc(size_t nmemb, size_t sz, void *arg) |
{ |
{ |
|
|
return(mandoc_calloc(sz, 1)); |
return(mandoc_calloc(nmemb, sz)); |
} |
} |
|
|
static void * |
static void * |
Line 804 hash_alloc(size_t sz, void *arg) |
|
Line 802 hash_alloc(size_t sz, void *arg) |
|
} |
} |
|
|
static void |
static void |
hash_free(void *p, size_t sz, void *arg) |
hash_free(void *p, void *arg) |
{ |
{ |
|
|
free(p); |
free(p); |