* src/pch.c (p_sha1): Rename to p_sha.
(get_sha1): Rename to get_sha.
(sha1_says_nonexistent): Rename to sha_says_nonexistent; rename sha1
parameter to sha.
(intuit_diff_type): Update callers.
---
 src/pch.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/pch.c b/src/pch.c
index d9f5c61..6146ec4 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -45,7 +45,7 @@ static bool p_copy[2];                        /* Does this 
patch create a copy? */
 static bool p_rename[2];               /* Does this patch rename a file? */
 struct timespec p_timestamp[2];                /* timestamps in patch headers 
*/
 static char *p_timestr[2];             /* timestamps as strings */
-static char *p_sha1[2];                        /* SHA1 checksums */
+static char *p_sha[2];                 /* SHA1/SHA256 checksums */
 static mode_t p_mode[2];               /* file modes */
 static off_t p_filesize;               /* size of the patch file */
 static idx_t p_first;                  /* 1st line number */
@@ -372,26 +372,26 @@ fetchmode (char const *str)
 }
 
 static char *
-get_sha1 (char const *start, char const *end)
+get_sha (char const *start, char const *end)
 {
   return ximemdup0 (start, end - start);
 }
 
 static char ATTRIBUTE_PURE
-sha1_says_nonexistent (char const *sha1)
+sha_says_nonexistent (char const *sha)
 {
   char const *empty_sha1 = "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";
   char const *s;
 
   /* Nonexistent files have an all-zero checksum.  */
-  for (s = sha1; *s; s++)
+  for (s = sha; *s; s++)
     if (*s != '0')
       break;
   if (! *s)
     return 2;
 
   /* Empty files have empty_sha1 as their checksum.  */
-  for (s = sha1; *s; s++, empty_sha1++)
+  for (s = sha; *s; s++, empty_sha1++)
     if (*s != *empty_sha1)
       break;
   return ! *s;
@@ -478,10 +478,10 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
          p_timestr[i] = 0;
        }
     for (i = OLD; i <= NEW; i++)
-      if (p_sha1[i])
+      if (p_sha[i])
        {
-         free (p_sha1[i]);
-         p_sha1[i] = 0;
+         free (p_sha[i]);
+         p_sha[i] = 0;
        }
     p_git_diff = false;
     for (i = OLD; i <= NEW; i++)
@@ -653,10 +653,10 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
                && (v = skip_hex_digits (u + 2))
                && (! *v || c_isspace (*v)))
              {
-               p_sha1[OLD] = get_sha1 (s + 6, u);
-               p_sha1[NEW] = get_sha1 (u + 2, v);
-               p_says_nonexistent[OLD] = sha1_says_nonexistent (p_sha1[OLD]);
-               p_says_nonexistent[NEW] = sha1_says_nonexistent (p_sha1[NEW]);
+               p_sha[OLD] = get_sha (s + 6, u);
+               p_sha[NEW] = get_sha (u + 2, v);
+               p_says_nonexistent[OLD] = sha_says_nonexistent (p_sha[OLD]);
+               p_says_nonexistent[NEW] = sha_says_nonexistent (p_sha[NEW]);
                if (*(v = skip_spaces (v)))
                  p_mode[OLD] = p_mode[NEW] = fetchmode (v);
                extended_headers = true;
-- 
gabi


Reply via email to