=================================================================== RCS file: /cvs/mandoc/Attic/apropos_db.c,v retrieving revision 1.20 retrieving revision 1.23 diff -u -p -r1.20 -r1.23 --- mandoc/Attic/apropos_db.c 2011/12/03 12:09:07 1.20 +++ mandoc/Attic/apropos_db.c 2011/12/10 21:46:59 1.23 @@ -1,4 +1,4 @@ -/* $Id: apropos_db.c,v 1.20 2011/12/03 12:09:07 kristaps Exp $ */ +/* $Id: apropos_db.c,v 1.23 2011/12/10 21:46:59 kristaps Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -153,7 +153,6 @@ btree_open(void) DB *db; memset(&info, 0, sizeof(BTREEINFO)); - info.lorder = 4321; info.flags = R_DUP; db = dbopen(MANDOC_DB, O_RDONLY, 0, DB_BTREE, &info); @@ -542,13 +541,16 @@ single_search(struct rectree *tree, const struct opts if (opts->cat && strcasecmp(opts->cat, r.res.cat)) continue; - if (opts->arch && strcasecmp(opts->arch, r.res.arch)) - continue; + if (opts->arch && *r.res.arch) + if (strcasecmp(opts->arch, r.res.arch)) + continue; + tree->node = rs = mandoc_realloc (rs, (tree->len + 1) * sizeof(struct rec)); memcpy(&rs[tree->len], &r, sizeof(struct rec)); + memset(&r, 0, sizeof(struct rec)); rs[tree->len].matches = mandoc_calloc(terms, sizeof(int)); @@ -564,7 +566,6 @@ single_search(struct rectree *tree, const struct opts } else root = tree->len; - memset(&r, 0, sizeof(struct rec)); tree->len++; } @@ -572,6 +573,7 @@ single_search(struct rectree *tree, const struct opts (*idx->close)(idx); free(buf); + recfree(&r); return(1 == ch); }