Code

Consolidate null_sha1[].
authorJunio C Hamano <junio@twinsun.com>
Fri, 30 Sep 2005 21:02:47 +0000 (14:02 -0700)
committerJunio C Hamano <junkio@cox.net>
Sat, 1 Oct 2005 05:12:01 +0000 (22:12 -0700)
Signed-off-by: Junio C Hamano <junio@twinsun.com>
cache.h
diff-files.c
diff.c
sha1_file.c

diff --git a/cache.h b/cache.h
index 52a45f9c9a3f487ca7ba773d72109c3daca0685d..b8e3d9bfacfb0fa924accd705bac18238c138eb8 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -189,6 +189,7 @@ extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)
 extern char *sha1_file_name(const unsigned char *sha1);
 extern char *sha1_pack_name(const unsigned char *sha1);
 extern char *sha1_pack_index_name(const unsigned char *sha1);
+extern const unsigned char null_sha1[20];
 
 int git_mkstemp(char *path, size_t n, const char *template);
 
index e8db3d2d69af2e6974db7050b48828a1980f0397..5e598322ff038159630930b6926a173424b66418 100644 (file)
@@ -34,7 +34,6 @@ static void show_modified(int oldmode, int mode,
 
 int main(int argc, const char **argv)
 {
-       static const unsigned char null_sha1[20] = { 0, };
        const char **pathspec;
        const char *prefix = setup_git_directory();
        int entries, i;
diff --git a/diff.c b/diff.c
index 9bded28729d6608f0449c483707f35279c24b1d5..7d06b035ae8b6a53f10a7f94251a24d911baa509 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -10,7 +10,6 @@
 #include "diffcore.h"
 
 static const char *diff_opts = "-pu";
-static unsigned char null_sha1[20] = { 0, };
 
 static int use_size_cache;
 
@@ -414,7 +413,7 @@ void diff_free_filespec_data(struct diff_filespec *s)
 static void prep_temp_blob(struct diff_tempfile *temp,
                           void *blob,
                           unsigned long size,
-                          unsigned char *sha1,
+                          const unsigned char *sha1,
                           int mode)
 {
        int fd;
index 1e847a891a9ea7470fb2554f4b08dc0fe10a3186..895c1fab6fc00b8131e44851f33b79b1d2310b12 100644 (file)
@@ -20,6 +20,8 @@
 #endif
 #endif
 
+const unsigned char null_sha1[20] = { 0, };
+
 static unsigned int sha1_file_open_flag = O_NOATIME;
 
 static unsigned hexval(char c)