Re: [PATCH v2 2/4] Add structure representing hash algorithm
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Oct 29, 2017, 17:00 UTC
- Message-ID
- <20171029170025.3z2mohqgcwhycq43@genre.crustytoothpaste.net>
- In-Reply-To
- <CAPig+cSX_+mN8Pz=0k3xnHRa-Teoq2JrSHe0zQhzJ1NZafXPoQ@mail.gmail.com>
On Sat, Oct 28, 2017 at 09:36:05PM -0400, Eric Sunshine wrote:
Show 20 quoted lines
> On Sat, Oct 28, 2017 at 2:12 PM, brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > diff --git a/sha1_file.c b/sha1_file.c
> > @@ -39,6 +39,49 @@ const struct object_id empty_blob_oid = {
> > +static inline void git_hash_sha1_init(void *ctx)
> > +{
> > + git_SHA1_Init((git_SHA_CTX *)ctx);
> > +}
> > +
> > +static inline void git_hash_sha1_update(void *ctx, const void *data, size_t len)
> > +{
> > + git_SHA1_Update((git_SHA_CTX *)ctx, data, len);
> > +}
> > +
> > +static inline void git_hash_sha1_final(unsigned char *hash, void *ctx)
> > +{
> > + git_SHA1_Final(hash, (git_SHA_CTX *)ctx);
> > +}
>
> Why 'inline' if you only ever take the addresses of these functions?Good point. I wanted to avoid the overhead of a needless intermediate function call when using this code path and have the compiler essentially emit a call to the underlying functions directly, but inline probably won't affect whether that happens.
I'll remove them.
-- brian m. carlson / brian with sandals: Houston, Texas, US https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204