From: Junio C Hamano Date: Fri, 30 Sep 2005 21:02:47 +0000 (-0700) Subject: Consolidate null_sha1[]. X-Git-Tag: v0.99.8~25 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=88cd621deedd2aab8f0a4c6ea3afed7269e66d0c;p=git.git Consolidate null_sha1[]. Signed-off-by: Junio C Hamano --- diff --git a/cache.h b/cache.h index 52a45f9c..b8e3d9bf 100644 --- 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); diff --git a/diff-files.c b/diff-files.c index e8db3d2d..5e598322 100644 --- a/diff-files.c +++ b/diff-files.c @@ -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 9bded287..7d06b035 100644 --- 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; diff --git a/sha1_file.c b/sha1_file.c index 1e847a89..895c1fab 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -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)