diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-11-09 06:31:27 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-09 06:31:27 +0100 |
commit | bde13700105a1c945819578ce8d5c0627d52c741 (patch) | |
tree | f099ae14f511cb3461a0f7e8361bb85b4679506e /cache.h | |
parent | Merge branch 'ad/5580-unc-tests-on-cygwin' (diff) | |
parent | sha1_file: use hex_to_bytes() (diff) | |
download | git-bde13700105a1c945819578ce8d5c0627d52c741.tar.xz git-bde13700105a1c945819578ce8d5c0627d52c741.zip |
Merge branch 'rs/hex-to-bytes-cleanup'
Code cleanup.
* rs/hex-to-bytes-cleanup:
sha1_file: use hex_to_bytes()
http-push: use hex_to_bytes()
notes: move hex_to_bytes() to hex.c and export it
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1341,6 +1341,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 |