Re: [PATCH] introduce inline is_same_sha1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Rientjes <rientjes@xxxxxxxxxx> writes:

> On Thu, 17 Aug 2006, Alex Riesen wrote:
>
>> Why not just sha1cmp? And if you're aiming at hash-type independence,
>> why not hashcmp?
>
> hashcmp is a very good suggestion.
>
> 		David
> ---
> Introduces global inline:
> 	hashcmp(const unsigned char *sha1, const unsigned char *sha2)
>
> Uses memcmp for comparison and returns the result based on the length of 
> the hash name (a future runtime decision).
>
> Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>

Looks very very good.  Much cleaner.

Also, I retract my previous comment that the parameters should
be (void*).  Looking at the call sites that need casts, they
would need either (unsigned char*) or (char*) cast regardless of
the type of the argument hashcmp() function takes anyway.

Thanks.  Will apply.

Oh, by the way, two minor procedural requests.

Pick a good one-line description of the patch; as it was sent,
the commit would have shown (in "git shortlog" output):

	Introduces global inline:

which does not make much sense to the first time readers.

Please use something other than '---' as the delimiter after the
cover letter, if you write one _before_ the commit log message.
E-mailed patch acceptance tools consider anything after '---' is
patch and does not contribute to the commit log, so it is lost
from the resulting commit.

A short cover letter like this is better placed _after_ the real
separator '---' that comes after your commit log message, like
this:

From: David Rientjes <rientjes@xxxxxxxxxx>
Subject: Do not use memcmp(sha1_1, sha1_2, 20) with hardcoded length.

Introduces global inline:

	hashcmp(const unsigned char *sha1, const unsigned char *sha2)

Uses memcmp for comparison and returns the result based on the length of 
the hash name (a future runtime decision).

Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
---

 On Thu, 17 Aug 2006, Alex Riesen wrote:

 > Why not just sha1cmp? And if you're aiming at hash-type independence,
 > why not hashcmp?

 hashcmp is a very good suggestion.  Please ack the following.

 builtin-commit-tree.c    |    2 +-
 builtin-diff-stages.c    |    2 +-
 ...


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]