diff options
author | René Scharfe <l.s.r@web.de> | 2017-10-31 14:46:49 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-01 10:35:35 +0900 |
commit | 0ec218656a02ea48e173262f7b80513feeb7f263 (patch) | |
tree | 7cd0bbbbd2a1bccd5873c0c962d40040c2a7e504 /cache.h | |
parent | Git 2.15 (diff) | |
download | tgif-0ec218656a02ea48e173262f7b80513feeb7f263.tar.xz |
notes: move hex_to_bytes() to hex.c and export it
Make the function for converting pairs of hexadecimal digits to binary
available to other call sites.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1318,6 +1318,13 @@ extern int get_sha1_hex(const char *hex, unsigned char *sha1); extern int get_oid_hex(const char *hex, struct object_id *sha1); /* + * Read `len` pairs of hexadecimal digits from `hex` and write the + * values to `binary` as `len` bytes. Return 0 on success, or -1 if + * the input does not consist of hex digits). + */ +extern int hex_to_bytes(unsigned char *binary, const char *hex, size_t len); + +/* * Convert a binary sha1 to its hex equivalent. The `_r` variant is reentrant, * and writes the NUL-terminated output to the buffer `out`, which must be at * least `GIT_SHA1_HEXSZ + 1` bytes, and returns a pointer to out for |