Re: [PATCH 2/8] sha1_file: introduce has_object_file helper.
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jun 10, 2015, 09:59 UTC
- Message-ID
- <CACsJy8DHJ415euwo3gMTtuQx+5RopzBg+mssZ8TVstGJcdWSqg@mail.gmail.com>
- In-Reply-To
- <1433867316-663554-3-git-send-email-sandals@crustytoothpaste.net>
On Tue, Jun 9, 2015 at 11:28 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:
Show 13 quoted lines
> diff --git a/sha1_file.c b/sha1_file.c
> index 7e38148..09f7f03 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -3173,6 +3173,11 @@ int has_sha1_file(const unsigned char *sha1)
> return find_pack_entry(sha1, &e);
> }
>
> +int has_object_file(const struct object_id *oid)
> +{
> + return has_sha1_file(oid->hash);
> +}
> +This version could be "static inline" and placed in cache.h. Though it may be premature optimization. On top of my head I can't recall any place where has_sha1_file() is used so many times for this extra call to become significant overhead.
-- Duy