source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Lift hard-coded limit of results.
@ 2011-10-07 13:29 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-10-07 13:29 UTC (permalink / raw)
  To: source

Log Message:
-----------
Lift hard-coded limit of results.

Modified Files:
--------------
    mdocml:
        apropos.c

Revision Data
-------------
Index: apropos.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lapropos.c -Lapropos.c -u -p -r1.2 -r1.3
--- apropos.c
+++ apropos.c
@@ -289,12 +289,13 @@ state_search(struct state *p, const stru
 	recno_t		 rec;
 	uint32_t	 fl;
 	DBT		 key, val;
-	struct res	 res[MAXRESULTS];
+	struct res	*res;
 	regex_t		 reg;
 	regex_t		*regp;
 	char		 filebuf[10];
 	struct rec	 record;
 
+	res = NULL;
 	len = 0;
 	buf = NULL;
 	bufsz = 0;
@@ -341,10 +342,7 @@ state_search(struct state *p, const stru
 	 * Lastly, add it to the available records.
 	 */
 
-	while (len < MAXRESULTS) {
-		if ((ch = (*p->db->seq)(p->db, &key, &val, dflag)))
-			break;
-
+	while (0 == (ch = (*p->db->seq)(p->db, &key, &val, dflag))) {
 		dflag = R_NEXT;
 
 		/* 
@@ -411,6 +409,9 @@ state_search(struct state *p, const stru
 		if (i < len)
 			continue;
 
+		res = mandoc_realloc
+			(res, (len + 1) * sizeof(struct res));
+
 		/*
 		 * Now we have our filename, keywords, types, and all
 		 * other necessary information.  
@@ -471,6 +472,7 @@ send:
 		free(res[len].uri);
 	}
 
+	free(res);
 	free(buf);
 	mchars_free(mc);
 
--
 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-10-07 13:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 13:29 mdocml: Lift hard-coded limit of results kristaps

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).