mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
b19f3fe9dd
There's only a single caller left of sha1_to_hex(), since everybody that has an object name in "unsigned char[]" now uses hash_to_hex() instead. This case is in the sha1dc wrapper, where we print a hex sha1 when we find a collision. This one will always be sha1, regardless of the current hash algorithm, so we can't use hash_to_hex() here. In practice we'd probably not be running sha1 at all if it isn't the current algorithm, but it's possible we might still occasionally need to compute a sha1 in a post-sha256 world. Since sha1_to_hex() is just a wrapper for hash_to_hex_algop(), let's call that ourselves. There's value in getting rid of the sha1-specific wrapper to de-clutter the global namespace, and to make sure nobody uses it (and as with sha1_to_hex_r() in the previous patch, we'll drop the coccinelle transformations, too). The sha1_to_hex() function is mentioned in a comment; we can easily swap that out for oid_to_hex() to give a better example. Also update the comment that was left stale when we added "struct object_id *" as a way to name an object and added functions to convert it to hex. The function is also mentioned in some test vectors in t4100, but that's not runnable code, so there's no point in trying to clean it up. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
87 lines
1.3 KiB
Text
87 lines
1.3 KiB
Text
@@
|
|
struct object_id OID;
|
|
@@
|
|
- is_null_sha1(OID.hash)
|
|
+ is_null_oid(&OID)
|
|
|
|
@@
|
|
struct object_id *OIDPTR;
|
|
@@
|
|
- is_null_sha1(OIDPTR->hash)
|
|
+ is_null_oid(OIDPTR)
|
|
|
|
@@
|
|
struct object_id OID;
|
|
@@
|
|
- hashclr(OID.hash)
|
|
+ oidclr(&OID)
|
|
|
|
@@
|
|
identifier f != oidclr;
|
|
struct object_id *OIDPTR;
|
|
@@
|
|
f(...) {<...
|
|
- hashclr(OIDPTR->hash)
|
|
+ oidclr(OIDPTR)
|
|
...>}
|
|
|
|
@@
|
|
struct object_id OID1, OID2;
|
|
@@
|
|
- hashcmp(OID1.hash, OID2.hash)
|
|
+ oidcmp(&OID1, &OID2)
|
|
|
|
@@
|
|
identifier f != oidcmp;
|
|
struct object_id *OIDPTR1, OIDPTR2;
|
|
@@
|
|
f(...) {<...
|
|
- hashcmp(OIDPTR1->hash, OIDPTR2->hash)
|
|
+ oidcmp(OIDPTR1, OIDPTR2)
|
|
...>}
|
|
|
|
@@
|
|
struct object_id *OIDPTR;
|
|
struct object_id OID;
|
|
@@
|
|
- hashcmp(OIDPTR->hash, OID.hash)
|
|
+ oidcmp(OIDPTR, &OID)
|
|
|
|
@@
|
|
struct object_id *OIDPTR;
|
|
struct object_id OID;
|
|
@@
|
|
- hashcmp(OID.hash, OIDPTR->hash)
|
|
+ oidcmp(&OID, OIDPTR)
|
|
|
|
@@
|
|
struct object_id *OIDPTR1;
|
|
struct object_id *OIDPTR2;
|
|
@@
|
|
- oidcmp(OIDPTR1, OIDPTR2) == 0
|
|
+ oideq(OIDPTR1, OIDPTR2)
|
|
|
|
@@
|
|
identifier f != hasheq;
|
|
expression E1, E2;
|
|
@@
|
|
f(...) {<...
|
|
- hashcmp(E1, E2) == 0
|
|
+ hasheq(E1, E2)
|
|
...>}
|
|
|
|
@@
|
|
struct object_id *OIDPTR1;
|
|
struct object_id *OIDPTR2;
|
|
@@
|
|
- oidcmp(OIDPTR1, OIDPTR2) != 0
|
|
+ !oideq(OIDPTR1, OIDPTR2)
|
|
|
|
@@
|
|
identifier f != hasheq;
|
|
expression E1, E2;
|
|
@@
|
|
f(...) {<...
|
|
- hashcmp(E1, E2) != 0
|
|
+ !hasheq(E1, E2)
|
|
...>}
|