Skip to content

Commit 55c529a

Browse files
bk2204gitster
authored andcommitted
hex: add oid_to_hex_r()
This function works just like sha1_to_hex_r, except that it takes a pointer to struct object_id instead of a pointer to unsigned char. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 05219a1 commit 55c529a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,7 @@ extern int get_oid_hex(const char *hex, struct object_id *sha1);
11931193
* printf("%s -> %s", sha1_to_hex(one), sha1_to_hex(two));
11941194
*/
11951195
extern char *sha1_to_hex_r(char *out, const unsigned char *sha1);
1196+
extern char *oid_to_hex_r(char *out, const struct object_id *oid);
11961197
extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
11971198
extern char *oid_to_hex(const struct object_id *oid); /* same static buffer as sha1_to_hex */
11981199

hex.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ char *sha1_to_hex_r(char *buffer, const unsigned char *sha1)
7777
return buffer;
7878
}
7979

80+
char *oid_to_hex_r(char *buffer, const struct object_id *oid)
81+
{
82+
return sha1_to_hex_r(buffer, oid->hash);
83+
}
84+
8085
char *sha1_to_hex(const unsigned char *sha1)
8186
{
8287
static int bufno;

0 commit comments

Comments
 (0)