source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Lift hard-coded limit of results.
Date: Fri, 7 Oct 2011 09:29:03 -0400 (EDT)	[thread overview]
Message-ID: <201110071329.p97DT3UC010479@krisdoz.my.domain> (raw)

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

                 reply	other threads:[~2011-10-07 13:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110071329.p97DT3UC010479@krisdoz.my.domain \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).