aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c
index 19178f4..762db88 100644
--- a/main.c
+++ b/main.c
@@ -621,6 +621,7 @@ struct search_args
static int search_fn(const char *const fpath, const struct stat *const sb,
bool *const done, void *const user)
{
+ static const size_t limit = 200;
const struct search_args *const sa = user;
const char *rel = fpath + strlen(sa->root);
struct page_search *const res = sa->s;
@@ -650,7 +651,13 @@ static int search_fn(const char *const fpath, const struct stat *const sb,
}
res->results = results;
- res->n++;
+
+ if (++res->n >= limit)
+ {
+ sa->s->limit_exceeded = true;
+ *done = true;
+ }
+
return 0;
failure: