From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Couder Subject: [PATCH v2 03/10] Introduce lookup_replace_object_extended() to pass flags Date: Sat, 07 Dec 2013 17:20:58 +0100 Message-ID: <20131207162106.21478.83418.chriscool@tuxfamily.org> References: <20131207160514.21478.72966.chriscool@tuxfamily.org> Cc: git@vger.kernel.org, Jeff King , Joey Hess To: Junio C Hamano X-From: git-owner@vger.kernel.org Sat Dec 07 17:22:24 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VpKe4-0004xp-QA for gcvg-git-2@plane.gmane.org; Sat, 07 Dec 2013 17:22:21 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758889Ab3LGQWL (ORCPT ); Sat, 7 Dec 2013 11:22:11 -0500 Received: from mail-1y.bbox.fr ([194.158.98.14]:44301 "EHLO mail-1y.bbox.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755326Ab3LGQVt (ORCPT ); Sat, 7 Dec 2013 11:21:49 -0500 Received: from [127.0.1.1] (cha92-h01-128-78-31-246.dsl.sta.abo.bbox.fr [128.78.31.246]) by mail-1y.bbox.fr (Postfix) with ESMTP id 13A954A; Sat, 7 Dec 2013 17:21:48 +0100 (CET) X-git-sha1: 723d0efc21fc38c6279d4e9cb26f5192ed30f71e X-Mailer: git-mail-commits v0.5.2 In-Reply-To: <20131207160514.21478.72966.chriscool@tuxfamily.org> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Currently, there is only one caller to lookup_replace_object() that can benefit from passing it some flags, but we expect that there could be more. Signed-off-by: Christian Couder --- cache.h | 6 ++++++ sha1_file.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index 873a6b5..563f85f 100644 --- a/cache.h +++ b/cache.h @@ -773,6 +773,12 @@ static inline const unsigned char *lookup_replace_object(const unsigned char *sh return sha1; return do_lookup_replace_object(sha1); } +static inline const unsigned char *lookup_replace_object_extended(const unsigned char *sha1, unsigned flag) +{ + if (! (flag & LOOKUP_REPLACE_OBJECT)) + return sha1; + return lookup_replace_object(sha1); +} /* Read and unpack a sha1 file into memory, write memory to a sha1 file */ extern int sha1_object_info(const unsigned char *, unsigned long *); diff --git a/sha1_file.c b/sha1_file.c index 76e9f32..4fb2f17 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2591,8 +2591,7 @@ void *read_sha1_file_extended(const unsigned char *sha1, void *data; char *path; const struct packed_git *p; - const unsigned char *repl = (flag & LOOKUP_REPLACE_OBJECT) - ? lookup_replace_object(sha1) : sha1; + const unsigned char *repl = lookup_replace_object_extended(sha1, flag); errno = 0; data = read_object(repl, type, size); -- 1.8.5.1.102.g090758b