version 1.26, 2011/12/08 01:00:58 |
version 1.27, 2011/12/08 02:24:31 |
Line 107 static void index_merge(const struct of *, struct m |
|
Line 107 static void index_merge(const struct of *, struct m |
|
recno_t, const recno_t *, size_t); |
recno_t, const recno_t *, size_t); |
static void index_prune(const struct of *, DB *, |
static void index_prune(const struct of *, DB *, |
const char *, DB *, const char *, |
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 void ofile_argbuild(int, char *[], struct of **); |
static int ofile_dirbuild(const char *, const char *, |
static int ofile_dirbuild(const char *, const char *, |
const char *, int, struct of **); |
const char *, int, struct of **); |
Line 390 main(int argc, char *argv[]) |
|
Line 391 main(int argc, char *argv[]) |
|
of = of->first; |
of = of->first; |
|
|
index_prune(of, db, fbuf, idx, ibuf, |
index_prune(of, db, fbuf, idx, ibuf, |
&maxrec, &recs, &recsz); |
&maxrec, &recs, &recsz, &reccur); |
|
|
/* |
/* |
* Go to the root of the respective manual tree |
* Go to the root of the respective manual tree |
Line 682 index_merge(const struct of *of, struct mparse *mp, |
|
Line 683 index_merge(const struct of *of, struct mparse *mp, |
|
*/ |
*/ |
static void |
static void |
index_prune(const struct of *ofile, DB *db, const char *dbf, |
index_prune(const struct of *ofile, DB *db, const char *dbf, |
DB *idx, const char *idxf, |
DB *idx, const char *idxf, recno_t *maxrec, |
recno_t *maxrec, recno_t **recs, size_t *recsz) |
recno_t **recs, size_t *recsz, size_t *reccur) |
{ |
{ |
const struct of *of; |
const struct of *of; |
const char *fn, *cp; |
const char *fn, *cp; |
struct db_val *vbuf; |
struct db_val *vbuf; |
unsigned seq, sseq; |
unsigned seq, sseq; |
DBT key, val; |
DBT key, val; |
size_t reccur; |
|
int ch; |
int ch; |
|
|
reccur = 0; |
*reccur = 0; |
seq = R_FIRST; |
seq = R_FIRST; |
while (0 == (ch = (*idx->seq)(idx, &key, &val, seq))) { |
while (0 == (ch = (*idx->seq)(idx, &key, &val, seq))) { |
seq = R_NEXT; |
seq = R_NEXT; |
Line 767 index_prune(const struct of *ofile, DB *db, const char |
|
Line 767 index_prune(const struct of *ofile, DB *db, const char |
|
if (ch < 0) |
if (ch < 0) |
break; |
break; |
cont: |
cont: |
if (reccur >= *recsz) { |
if (*reccur >= *recsz) { |
*recsz += MANDOC_SLOP; |
*recsz += MANDOC_SLOP; |
*recs = mandoc_realloc |
*recs = mandoc_realloc |
(*recs, *recsz * sizeof(recno_t)); |
(*recs, *recsz * sizeof(recno_t)); |
} |
} |
|
|
(*recs)[(int)reccur] = *maxrec; |
(*recs)[(int)*reccur] = *maxrec; |
reccur++; |
(*reccur)++; |
} |
} |
|
|
if (ch < 0) { |
if (ch < 0) { |