summaryrefslogtreecommitdiff
path: root/name-hash.c
diff options
context:
space:
mode:
authorLibravatar Rasmus Villemoes <rv@rasmusvillemoes.dk>2018-02-23 15:47:56 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-02-23 12:23:26 -0800
commite2e05d619a71ae2c06ebd3c661260bf4b5039a93 (patch)
treee35c04b70ddfeddb057365ecd899cb16a2bd5cfb /name-hash.c
parentGit 2.16.2 (diff)
downloadtgif-e2e05d619a71ae2c06ebd3c661260bf4b5039a93.tar.xz
grep: move grep_source_init outside critical section
grep_source_init typically does three strdup()s, and in the threaded case, the call from add_work() happens while holding grep_mutex. We can thus reduce the time we hold grep_mutex by moving the grep_source_init() call out of add_work(), and simply have add_work() copy the initialized structure to the available slot in the todo array. This also simplifies the prototype of add_work(), since it no longer needs to duplicate all the parameters of grep_source_init(). In the callers of add_work(), we get to reduce the amount of code duplicated in the threaded and non-threaded cases slightly (avoiding repeating the long "GREP_SOURCE_OID, pathbuf.buf, path, oid" argument list); a subsequent cleanup patch will make that even more so. Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'name-hash.c')
0 files changed, 0 insertions, 0 deletions