Code

builtin/grep: simplify lock_and_read_sha1_file()
authorJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2011 19:15:51 +0000 (12:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2011 20:09:23 +0000 (13:09 -0700)
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>
builtin/grep.c

index 3ddfae4e79b5092a211608f25b6ded9b522d9f99..3d7329d78c6e3ec31ed8ce03b8928c9ed24afb9e 100644 (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;
 }