summaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-02-02 03:20:43 -0500
committerJunio C Hamano <gitster@pobox.com>2012-02-02 10:36:08 -0800
commit94ad9d9e075d3f7802cf56641ebb342d43fb46e3 (patch)
treef309236155445727ba387091062cf75238710e78 /grep.h
parentc876d6da88d9bf1f3377d4eed66fc7705e31c30e (diff)
downloadgit-94ad9d9e075d3f7802cf56641ebb342d43fb46e3.tar.gz
grep: cache userdiff_driver in grep_source
Right now, grep only uses the userdiff_driver for one thing: looking up funcname patterns for "-p" and "-W". As new uses for userdiff drivers are added to the grep code, we want to minimize attribute lookups, which can be expensive. It might seem at first that this would also optimize multiple lookups when the funcname pattern for a file is needed multiple times. However, the compiled funcname pattern is already cached in struct grep_opt's "priv" member, so multiple lookups are already suppressed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.h')
-rw-r--r--grep.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/grep.h b/grep.h
index 8bf3001417..73b28c2df7 100644
--- a/grep.h
+++ b/grep.h
@@ -9,6 +9,7 @@ typedef int pcre_extra;
#endif
#include "kwset.h"
#include "thread-utils.h"
+#include "userdiff.h"
enum grep_pat_token {
GREP_PATTERN,
@@ -141,6 +142,8 @@ struct grep_source {
char *buf;
unsigned long size;
+
+ struct userdiff_driver *driver;
};
void grep_source_init(struct grep_source *gs, enum grep_source_type type,
@@ -148,6 +151,7 @@ void grep_source_init(struct grep_source *gs, enum grep_source_type type,
int grep_source_load(struct grep_source *gs);
void grep_source_clear_data(struct grep_source *gs);
void grep_source_clear(struct grep_source *gs);
+void grep_source_load_driver(struct grep_source *gs);
int grep_source(struct grep_opt *opt, struct grep_source *gs);