Default max-count to infinite. This fixes #516.

This commit is contained in:
Geoff Greer 2014-11-29 13:15:37 -08:00
parent c5d9cba631
commit 59df36e1a7
3 changed files with 4 additions and 4 deletions

View file

@ -110,7 +110,7 @@ void init_options(void) {
#else
opts.color = TRUE;
#endif
opts.max_matches_per_file = 10000;
opts.max_matches_per_file = 0;
opts.max_search_depth = DEFAULT_MAX_SEARCH_DEPTH;
opts.path_sep = '\n';
opts.print_break = TRUE;

View file

@ -48,7 +48,7 @@ typedef struct {
int literal;
int literal_starts_wordchar;
int literal_ends_wordchar;
int max_matches_per_file;
size_t max_matches_per_file;
int max_search_depth;
char path_sep;
char *path_to_agignore;

View file

@ -85,7 +85,7 @@ void search_buf(const char *buf, const size_t buf_len,
matches_len++;
match_ptr += opts.query_len;
if (matches_len >= opts.max_matches_per_file) {
if (opts.max_matches_per_file > 0 && matches_len >= opts.max_matches_per_file) {
log_err("Too many matches in %s. Skipping the rest of this file.", dir_full_path);
break;
}
@ -107,7 +107,7 @@ void search_buf(const char *buf, const size_t buf_len,
matches[matches_len].end = offset_vector[1];
matches_len++;
if (matches_len >= opts.max_matches_per_file) {
if (opts.max_matches_per_file > 0 && matches_len >= opts.max_matches_per_file) {
log_err("Too many matches in %s. Skipping the rest of this file.", dir_full_path);
break;
}