[sheepdog] [PATCH 2/2] farm: remove unused code in sha1.c

Liu Yuan namei.unix at gmail.com
Wed Jul 24 07:36:42 CEST 2013


Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 collie/farm/farm.h      |    1 -
 collie/farm/sha1_file.c |   24 ------------------------
 2 files changed, 25 deletions(-)

diff --git a/collie/farm/farm.h b/collie/farm/farm.h
index 246f493..4c03a83 100644
--- a/collie/farm/farm.h
+++ b/collie/farm/farm.h
@@ -68,7 +68,6 @@ int snap_log_write(uint32_t idx, const char *tag, unsigned char *sha1);
 /* sha1_file.c */
 int sha1_file_write(void *buf, size_t len, unsigned char *sha1);
 void *sha1_file_read(const unsigned char *sha1, size_t *size);
-int get_sha1_hex(const char *hex, unsigned char *sha1);
 
 /* object_tree.c */
 int object_tree_size(void);
diff --git a/collie/farm/sha1_file.c b/collie/farm/sha1_file.c
index 2ec1c37..7bc00ee 100644
--- a/collie/farm/sha1_file.c
+++ b/collie/farm/sha1_file.c
@@ -148,27 +148,3 @@ out:
 	close(fd);
 	return buf;
 }
-
-static unsigned hexval(char c)
-{
-	if (c >= '0' && c <= '9')
-		return c - '0';
-	if (c >= 'a' && c <= 'f')
-		return c - 'a' + 10;
-	if (c >= 'A' && c <= 'F')
-		return c - 'A' + 10;
-	return ~0;
-}
-
-int get_sha1_hex(const char *hex, unsigned char *sha1)
-{
-	int i;
-	for (i = 0; i < SHA1_DIGEST_SIZE; i++) {
-		unsigned int val = (hexval(hex[0]) << 4) | hexval(hex[1]);
-		if (val & ~0xff)
-			return -1;
-		*sha1++ = val;
-		hex += 2;
-	}
-	return 0;
-}
-- 
1.7.9.5




More information about the sheepdog mailing list