summaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-08-16 14:09:53 -0700
committerJunio C Hamano <gitster@pobox.com>2021-09-08 11:47:55 -0700
commit50d92b5f03f3c84d581b27cb8fa3a4b8cfbf2567 (patch)
treeee65bc9d265a9bf36649dda4af01b7cc292acba5 /grep.h
parent8d33c3af0b2113091ea2c2c94990d0332c9551e7 (diff)
downloadgit-50d92b5f03f3c84d581b27cb8fa3a4b8cfbf2567.tar.gz
grep: typesafe versions of grep_source_init
grep_source_init() can create "struct grep_source" objects and, depending on the value of the type passed, some void-pointer parameters have different meanings. Because one of these types (GREP_SOURCE_OID) will require an additional parameter in a subsequent patch, take the opportunity to increase clarity and type safety by replacing this function with individual functions for each type. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Reviewed-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.h')
-rw-r--r--grep.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/grep.h b/grep.h
index 72f82b1e30..480b3f5bba 100644
--- a/grep.h
+++ b/grep.h
@@ -195,9 +195,10 @@ struct grep_source {
struct userdiff_driver *driver;
};
-void grep_source_init(struct grep_source *gs, enum grep_source_type type,
- const char *name, const char *path,
- const void *identifier);
+void grep_source_init_file(struct grep_source *gs, const char *name,
+ const char *path);
+void grep_source_init_oid(struct grep_source *gs, const char *name,
+ const char *path, const struct object_id *oid);
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,