builtin/grep: simplify lock_and_read_sha1_file()

As read_sha1_lock/unlock have been made aware of use_threads,
this caller can be made a lot simpler.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2011-10-26 12:15:51 -07:00
parent 1487a12ba2
commit 764161391f

View file

@ -373,13 +373,9 @@ static void *lock_and_read_sha1_file(const unsigned char *sha1, enum object_type
{
void *data;
if (use_threads) {
read_sha1_lock();
data = read_sha1_file(sha1, type, size);
read_sha1_unlock();
} else {
data = read_sha1_file(sha1, type, size);
}
read_sha1_lock();
data = read_sha1_file(sha1, type, size);
read_sha1_unlock();
return data;
}