aboutsummaryrefslogtreecommitdiffstats
path: root/src/build.c
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2016-10-31 22:31:04 +0100
committerTharre <tharre3@gmail.com>2016-10-31 22:31:04 +0100
commit6b86ecb97dc5c49993a34092a8edc199201a2056 (patch)
tree34f4f046aa817152b49fb0fbff42a1375b4b1e41 /src/build.c
parent75bf720347983547c21228df71b80a0409a32e28 (diff)
downloadredo-6b86ecb97dc5c49993a34092a8edc199201a2056.tar.gz
redo-6b86ecb97dc5c49993a34092a8edc199201a2056.tar.xz
redo-6b86ecb97dc5c49993a34092a8edc199201a2056.zip
Move utility functions to util.c
Diffstat (limited to 'src/build.c')
-rw-r--r--src/build.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/build.c b/src/build.c
index c79cf73..8253319 100644
--- a/src/build.c
+++ b/src/build.c
@@ -384,25 +384,6 @@ void add_prereq_path(const char *target, const char *parent, int ident) {
free(reltarget);
}
-/* Hash the target file, returning a pointer to the heap allocated hash. */
-static unsigned char *hash_file(FILE *fp) {
- unsigned char *hash = xmalloc(20);
-
- SHA_CTX context;
- unsigned char data[8192];
- size_t read;
-
- SHA1_Init(&context);
- while ((read = fread(data, 1, sizeof data, fp)))
- SHA1_Update(&context, data, read);
-
- if (ferror(fp))
- fatal("redo: failed to read data");
- SHA1_Final(hash, &context);
-
- return hash;
-}
-
/* Update hash & ctime information stored in the given dep_info struct */
static void update_dep_info(dep_info *dep, const char *target) {
FILE *fp = fopen(target, "rb");
@@ -418,26 +399,6 @@ static void update_dep_info(dep_info *dep, const char *target) {
fclose(fp);
}
-/* Requires a buffer of at least 20*2+1 = 41 bytes */
-static void sha1_to_hex(const unsigned char *sha1, char *buf) {
- static const char hex[] = "0123456789abcdef";
-
- for (int i = 0; i < 20; ++i) {
- char *pos = buf + i*2;
- *pos++ = hex[sha1[i] >> 4];
- *pos = hex[sha1[i] & 0xf];
- }
-
- buf[40] = '\0';
-}
-
-static void hex_to_sha1(const char *s, unsigned char *sha1) {
- static const char hex[] = "0123456789abcdef";
-
- for (; *s; s += 2, ++sha1)
- *sha1 = ((strchr(hex, *s) - hex) << 4) + strchr(hex, *(s+1)) - hex;
-}
-
/* Write the dependency information into the specified path. */
static void write_dep_information(dep_info *dep) {
FILE *fd = fopen(dep->path, "w+");