=================================================================== RCS file: /cvs/mandoc/mandocdb.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -p -r1.26 -r1.27 --- mandoc/mandocdb.c 2011/12/08 01:00:58 1.26 +++ mandoc/mandocdb.c 2011/12/08 02:24:31 1.27 @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.26 2011/12/08 01:00:58 kristaps Exp $ */ +/* $Id: mandocdb.c,v 1.27 2011/12/08 02:24:31 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -107,7 +107,8 @@ static void index_merge(const struct of *, struct m recno_t, const recno_t *, size_t); static void index_prune(const struct of *, DB *, const char *, DB *, const char *, - recno_t *, recno_t **, size_t *); + recno_t *, recno_t **, size_t *, + size_t *); static void ofile_argbuild(int, char *[], struct of **); static int ofile_dirbuild(const char *, const char *, const char *, int, struct of **); @@ -390,7 +391,7 @@ main(int argc, char *argv[]) of = of->first; index_prune(of, db, fbuf, idx, ibuf, - &maxrec, &recs, &recsz); + &maxrec, &recs, &recsz, &reccur); /* * Go to the root of the respective manual tree @@ -682,18 +683,17 @@ index_merge(const struct of *of, struct mparse *mp, */ static void index_prune(const struct of *ofile, DB *db, const char *dbf, - DB *idx, const char *idxf, - recno_t *maxrec, recno_t **recs, size_t *recsz) + DB *idx, const char *idxf, recno_t *maxrec, + recno_t **recs, size_t *recsz, size_t *reccur) { const struct of *of; const char *fn, *cp; struct db_val *vbuf; unsigned seq, sseq; DBT key, val; - size_t reccur; int ch; - reccur = 0; + *reccur = 0; seq = R_FIRST; while (0 == (ch = (*idx->seq)(idx, &key, &val, seq))) { seq = R_NEXT; @@ -767,14 +767,14 @@ index_prune(const struct of *ofile, DB *db, const char if (ch < 0) break; cont: - if (reccur >= *recsz) { + if (*reccur >= *recsz) { *recsz += MANDOC_SLOP; *recs = mandoc_realloc (*recs, *recsz * sizeof(recno_t)); } - (*recs)[(int)reccur] = *maxrec; - reccur++; + (*recs)[(int)*reccur] = *maxrec; + (*reccur)++; } if (ch < 0) {