source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: bugfix: make reclaiming of index slots actually work;
@ 2011-12-08  2:24 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2011-12-08  2:24 UTC (permalink / raw)
  To: source

Log Message:
-----------
bugfix: make reclaiming of index slots actually work;
index_prune always counted the free slots,
but didn't tell anybody about them, so they weren't reused

Modified Files:
--------------
    mdocml:
        mandocdb.c

Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.26 -r1.27
--- mandocdb.c
+++ mandocdb.c
@@ -107,7 +107,8 @@ static	void		  index_merge(const struct 
 				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 
  */
 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 *
 		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) {
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-08  2:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-08  2:24 mdocml: bugfix: make reclaiming of index slots actually work; schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).