]> git.ipfire.org Git - thirdparty/git.git/blobdiff - convert-objects.c
GIT-VERSION-FILE: check ./version first.
[thirdparty/git.git] / convert-objects.c
index 168771ed857dd9e95b1e14da40f1e39d18f7b2cf..a63013298566fd3dc21275a90ca976227de8c7f0 100644 (file)
@@ -1,7 +1,3 @@
-#define _XOPEN_SOURCE 500 /* glibc2 and AIX 5.3L need this */
-#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
-#define _GNU_SOURCE
-#include <time.h>
 #include "cache.h"
 #include "blob.h"
 #include "commit.h"
@@ -23,7 +19,7 @@ static struct entry * convert_entry(unsigned char *sha1);
 static struct entry *insert_new(unsigned char *sha1, int pos)
 {
        struct entry *new = xcalloc(1, sizeof(struct entry));
-       memcpy(new->old_sha1, sha1, 20);
+       hashcpy(new->old_sha1, sha1);
        memmove(convert + pos + 1, convert + pos, (nr_convert - pos) * sizeof(struct entry *));
        convert[pos] = new;
        nr_convert++;
@@ -39,7 +35,7 @@ static struct entry *lookup_entry(unsigned char *sha1)
        while (low < high) {
                int next = (low + high) / 2;
                struct entry *n = convert[next];
-               int cmp = memcmp(sha1, n->old_sha1, 20);
+               int cmp = hashcmp(sha1, n->old_sha1);
                if (!cmp)
                        return n;
                if (cmp < 0) {
@@ -54,7 +50,7 @@ static struct entry *lookup_entry(unsigned char *sha1)
 static void convert_binary_sha1(void *buffer)
 {
        struct entry *entry = convert_entry(buffer);
-       memcpy(buffer, entry->new_sha1, 20);
+       hashcpy(buffer, entry->new_sha1);
 }
 
 static void convert_ascii_sha1(void *buffer)
@@ -104,7 +100,7 @@ static int write_subdirectory(void *buffer, unsigned long size, const char *base
                if (!slash) {
                        newlen += sprintf(new + newlen, "%o %s", mode, path);
                        new[newlen++] = '\0';
-                       memcpy(new + newlen, (char *) buffer + len - 20, 20);
+                       hashcpy((unsigned char*)new + newlen, (unsigned char *) buffer + len - 20);
                        newlen += 20;
 
                        used += len;