diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2020-12-23 23:43:57 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2020-12-29 03:38:23 +0100 |
commit | ccdd1e3fd92591755e2b94bf63416c7b30cd217a (patch) | |
tree | 5dd2bab62c6ca7299777e6916ade3f56653e3db8 /lib | |
parent | 831fc568fc87a75bb6e05575b93a7541b49e7aba (diff) | |
download | pacman-ccdd1e3fd92591755e2b94bf63416c7b30cd217a.tar.gz pacman-ccdd1e3fd92591755e2b94bf63416c7b30cd217a.tar.xz |
Move hex_representation() to src/common
We'll reuse the function in pacman with a later commit.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/util.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index b70a8192..9ae08745 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -1014,30 +1014,6 @@ static int sha256_file(const char *path, unsigned char output[32]) } #endif /* HAVE_LIBSSL || HAVE_LIBNETTLE */ -/** Create a string representing bytes in hexadecimal. - * @param bytes the bytes to represent in hexadecimal - * @param size number of bytes to consider - * @return a NULL terminated string with the hexadecimal representation of - * bytes or NULL on error. This string must be freed. - */ -static char *hex_representation(const unsigned char *bytes, size_t size) -{ - static const char *hex_digits = "0123456789abcdef"; - char *str; - size_t i; - - MALLOC(str, 2 * size + 1, return NULL); - - for(i = 0; i < size; i++) { - str[2 * i] = hex_digits[bytes[i] >> 4]; - str[2 * i + 1] = hex_digits[bytes[i] & 0x0f]; - } - - str[2 * size] = '\0'; - - return str; -} - char SYMEXPORT *alpm_compute_md5sum(const char *filename) { unsigned char output[16]; |