hex: drop sha1_to_hex_r()
There are no callers left; everybody uses oid_to_hex_r() or hash_to_hex_algop_r(). This used to actually be the underlying implementation for oid_to_hex_r(), but that's no longer the case since 47edb64997 (hex: introduce functions to print arbitrary hashes, 2018-11-14). Let's get rid of it to de-clutter and to make sure nobody uses it. Likewise we can drop the coccinelle rules that mention it, since the compiler will make it quite clear that the code does not work. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Nov 11, 2019 at 04:04 UTC
aa6d7f93edc39361c926e1748fbee3b4243808f8
3 files changed
-23
cache.h
-1
@@ -1462,7 +1462,6 @@ int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
1462
* printf("%s -> %s", sha1_to_hex(one), sha1_to_hex(two));
1463
*/
1464
char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash, const struct git_hash_algo *);
1465
-char *sha1_to_hex_r(char *out, const unsigned char *sha1);
1465
char *oid_to_hex_r(char *out, const struct object_id *oid);
1466
char *hash_to_hex_algop(const unsigned char *hash, const struct git_hash_algo *); /* static buffer result! */
1467
char *sha1_to_hex(const unsigned char *sha1); /* same static buffer */
contrib/coccinelle/object_id.cocci
-17
@@ -25,23 +25,6 @@ struct object_id *OIDPTR;
25
+ oid_to_hex(OIDPTR)
26
...>}
27
28
-@@
29
-expression E;
30
-struct object_id OID;
31
-@@
32
-- sha1_to_hex_r(E, OID.hash)
33
-+ oid_to_hex_r(E, &OID)
34
-
35
-@@
36
-identifier f != oid_to_hex_r;
37
-expression E;
38
-struct object_id *OIDPTR;
39
-@@
40
- f(...) {<...
41
-- sha1_to_hex_r(E, OIDPTR->hash)
42
-+ oid_to_hex_r(E, OIDPTR)
43
- ...>}
44
-
28
@@
29
struct object_id OID;
30
@@
hex.c
-5
@@ -90,11 +90,6 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash,
90
return buffer;
91
}
92
93
-char *sha1_to_hex_r(char *buffer, const unsigned char *sha1)
94
-{
95
- return hash_to_hex_algop_r(buffer, sha1, &hash_algos[GIT_HASH_SHA1]);
96
-}
97
-
93
char *oid_to_hex_r(char *buffer, const struct object_id *oid)
94
{
95
return hash_to_hex_algop_r(buffer, oid->hash, the_hash_algo);