summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-11-09 05:31:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-09 05:31:27 (GMT)
commitbde13700105a1c945819578ce8d5c0627d52c741 (patch)
treef099ae14f511cb3461a0f7e8361bb85b4679506e /cache.h
parentb169d187682ed3f928df7806b00f3a62b83edfef (diff)
parent62a24c8923274b0ef941b2e7bc6efdb2fd52e6bf (diff)
downloadgit-bde13700105a1c945819578ce8d5c0627d52c741.zip
git-bde13700105a1c945819578ce8d5c0627d52c741.tar.gz
git-bde13700105a1c945819578ce8d5c0627d52c741.tar.bz2
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.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index d74f00d..cb7fb7c 100644
--- a/cache.h
+++ b/cache.h
@@ -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