From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id p97DT3H7018205 for ; Fri, 7 Oct 2011 09:29:04 -0400 (EDT) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id p97DT3UC010479; Fri, 7 Oct 2011 09:29:03 -0400 (EDT) Date: Fri, 7 Oct 2011 09:29:03 -0400 (EDT) Message-Id: <201110071329.p97DT3UC010479@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Lift hard-coded limit of results. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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