Thread (17 messages) 17 messages, 4 authors, 2017-11-01

Re: [PATCH v2 2/4] Add structure representing hash algorithm

From: brian m. carlson <hidden>
Date: 2017-10-29 17:00:36

On Sat, Oct 28, 2017 at 09:36:05PM -0400, Eric Sunshine wrote:
On Sat, Oct 28, 2017 at 2:12 PM, brian m. carlson
[off-list ref] wrote:
quoted
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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help