diff options
| author | nulltoken <emeric.fermas@gmail.com> | 2011-12-28 20:24:58 +0100 |
|---|---|---|
| committer | nulltoken <emeric.fermas@gmail.com> | 2011-12-28 20:25:29 +0100 |
| commit | eb8de7476b4d3caeac518ff9af459c49cfd78e35 (patch) | |
| tree | f77a41b173b4b504591f230f287a0066a1c28ac2 /tests-clay/object | |
| parent | 06fcf057b6da37ffd388e4a31c2671b20d0dd21e (diff) | |
| download | libgit2-eb8de7476b4d3caeac518ff9af459c49cfd78e35.tar.gz | |
util: add git__fromhex()
Diffstat (limited to 'tests-clay/object')
| -rw-r--r-- | tests-clay/object/raw/chars.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/tests-clay/object/raw/chars.c b/tests-clay/object/raw/chars.c index eba352b40..83bcbeb79 100644 --- a/tests-clay/object/raw/chars.c +++ b/tests-clay/object/raw/chars.c @@ -3,17 +3,6 @@ #include "odb.h" -static int from_hex(unsigned int i) -{ - if (i >= '0' && i <= '9') - return i - '0'; - if (i >= 'a' && i <= 'f') - return 10 + (i - 'a'); - if (i >= 'A' && i <= 'F') - return 10 + (i - 'A'); - return -1; -} - void test_object_raw_chars__find_invalid_chars_in_oid(void) { git_oid out; @@ -28,8 +17,8 @@ void test_object_raw_chars__find_invalid_chars_in_oid(void) for (i = 0; i < 256; i++) { in[38] = (char)i; - if (from_hex(i) >= 0) { - exp[19] = (unsigned char)(from_hex(i) << 4); + if (git__fromhex(i) >= 0) { + exp[19] = (unsigned char)(git__fromhex(i) << 4); cl_git_pass(git_oid_fromstr(&out, in)); cl_assert(memcmp(out.id, exp, sizeof(out.id)) == 0); } else { |
