Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41f7c29031 |
2 changed files with 9 additions and 6 deletions
|
|
@ -199,8 +199,9 @@ static int ackmate_dir_match(const char *dir_name) {
|
|||
if (opts.ackmate_dir_filter == NULL) {
|
||||
return 0;
|
||||
}
|
||||
int wspace[20];
|
||||
/* we just care about the match, not where the matches are */
|
||||
return pcre_exec(opts.ackmate_dir_filter, NULL, dir_name, strlen(dir_name), 0, 0, NULL, 0);
|
||||
return pcre_dfa_exec(opts.ackmate_dir_filter, NULL, dir_name, strlen(dir_name), 0, 0, NULL, 0, wspace, 20);
|
||||
}
|
||||
|
||||
/* This is the hottest code in Ag. 10-15% of all execution time is spent here */
|
||||
|
|
|
|||
12
src/search.c
12
src/search.c
|
|
@ -99,9 +99,10 @@ void search_buf(const char *buf, const size_t buf_len,
|
|||
}
|
||||
} else {
|
||||
int offset_vector[3];
|
||||
int wspace[20];
|
||||
if (opts.multiline) {
|
||||
while (buf_offset < buf_len &&
|
||||
(pcre_exec(opts.re, opts.re_extra, buf, buf_len, buf_offset, 0, offset_vector, 3)) >= 0) {
|
||||
(pcre_dfa_exec(opts.re, opts.re_extra, buf, buf_len, buf_offset, 0, offset_vector, 3, wspace, 20)) >= 0) {
|
||||
log_debug("Regex match found. File %s, offset %i bytes.", dir_full_path, offset_vector[0]);
|
||||
buf_offset = offset_vector[1];
|
||||
if (offset_vector[0] == offset_vector[1]) {
|
||||
|
|
@ -129,7 +130,7 @@ void search_buf(const char *buf, const size_t buf_len,
|
|||
}
|
||||
size_t line_offset = 0;
|
||||
while (line_offset < line_len) {
|
||||
int rv = pcre_exec(opts.re, opts.re_extra, line, line_len, line_offset, 0, offset_vector, 3);
|
||||
int rv = pcre_dfa_exec(opts.re, opts.re_extra, line, line_len, line_offset, 0, offset_vector, 3, wspace, 20);
|
||||
if (rv < 0) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -310,7 +311,7 @@ void search_file(const char *file_full_path) {
|
|||
}
|
||||
|
||||
if (!opts.literal && f_len > INT_MAX) {
|
||||
log_err("Skipping %s: pcre_exec() can't handle files larger than %i bytes.", file_full_path, INT_MAX);
|
||||
log_err("Skipping %s: pcre_dfa_exec() can't handle files larger than %i bytes.", file_full_path, INT_MAX);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -584,8 +585,9 @@ void search_dir(ignores *ig, const char *base_path, const char *path, const int
|
|||
|
||||
if (!is_directory(path, dir)) {
|
||||
if (opts.file_search_regex) {
|
||||
rc = pcre_exec(opts.file_search_regex, NULL, dir_full_path, strlen(dir_full_path),
|
||||
0, 0, offset_vector, 3);
|
||||
int wspace[20];
|
||||
rc = pcre_dfa_exec(opts.file_search_regex, NULL, dir_full_path, strlen(dir_full_path),
|
||||
0, 0, offset_vector, 3, wspace, 20);
|
||||
if (rc < 0) { /* no match */
|
||||
log_debug("Skipping %s due to file_search_regex.", dir_full_path);
|
||||
goto cleanup;
|
||||
|
|
|
|||
Loading…
Reference in a new issue