Code

read_sha1_file(): get rid of read_sha1_file_repl() madness
[git.git] / cache.h
diff --git a/cache.h b/cache.h
index 28899b7b7881474eed4a6f3b6fda8db79d5cbc9c..a9ae100542e9c9de67605ed3b75cad1350da298f 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -511,7 +511,7 @@ struct pathspec {
        struct pathspec_item {
                const char *match;
                int len;
-               unsigned int has_wildcard:1;
+               unsigned int use_wildcard:1;
        } *items;
 };
 
@@ -676,14 +676,24 @@ extern char *sha1_pack_name(const unsigned char *sha1);
 extern char *sha1_pack_index_name(const unsigned char *sha1);
 extern const char *find_unique_abbrev(const unsigned char *sha1, int);
 extern const unsigned char null_sha1[20];
-static inline int is_null_sha1(const unsigned char *sha1)
+
+static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
 {
-       return !memcmp(sha1, null_sha1, 20);
+       int i;
+
+       for (i = 0; i < 20; i++, sha1++, sha2++) {
+               if (*sha1 != *sha2)
+                       return *sha1 - *sha2;
+       }
+
+       return 0;
 }
-static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
+
+static inline int is_null_sha1(const unsigned char *sha1)
 {
-       return memcmp(sha1, sha2, 20);
+       return !hashcmp(sha1, null_sha1);
 }
+
 static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
 {
        memcpy(sha_dst, sha_src, 20);
@@ -748,11 +758,8 @@ int offset_1st_component(const char *path);
 
 /* Read and unpack a sha1 file into memory, write memory to a sha1 file */
 extern int sha1_object_info(const unsigned char *, unsigned long *);
-extern void *read_sha1_file_repl(const unsigned char *sha1, enum object_type *type, unsigned long *size, const unsigned char **replacement);
-static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size)
-{
-       return read_sha1_file_repl(sha1, type, size, NULL);
-}
+extern void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size);
+extern const unsigned char *lookup_replace_object(const unsigned char *sha1);
 extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1);
 extern int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
 extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);