summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-10-07 13:29:03 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-10-07 13:29:03 +0000
commitfd572be14f6bd623f1ed47f0f88f91aa94741b0b (patch)
tree5dee4f51907c425c0e263ffdbbc647ac3e05b7de
parentf0a4f185f598931b1e16404e5094ce28d725dbcd (diff)
downloadmandoc-fd572be14f6bd623f1ed47f0f88f91aa94741b0b.tar.gz
mandoc-fd572be14f6bd623f1ed47f0f88f91aa94741b0b.tar.zst
mandoc-fd572be14f6bd623f1ed47f0f88f91aa94741b0b.zip
Lift hard-coded limit of results.
-rw-r--r--apropos.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/apropos.c b/apropos.c
index 6afd3ec8..2c293d02 100644
--- a/apropos.c
+++ b/apropos.c
@@ -1,4 +1,4 @@
-/* $Id: apropos.c,v 1.2 2011/10/07 13:22:33 kristaps Exp $ */
+/* $Id: apropos.c,v 1.3 2011/10/07 13:29:03 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -289,12 +289,13 @@ state_search(struct state *p, const struct opts *opts, char *q)
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 struct opts *opts, char *q)
* 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 struct opts *opts, char *q)
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);