File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -676,14 +676,24 @@ extern char *sha1_pack_name(const unsigned char *sha1);
676
676
extern char * sha1_pack_index_name (const unsigned char * sha1 );
677
677
extern const char * find_unique_abbrev (const unsigned char * sha1 , int );
678
678
extern const unsigned char null_sha1 [20 ];
679
- static inline int is_null_sha1 (const unsigned char * sha1 )
679
+
680
+ static inline int hashcmp (const unsigned char * sha1 , const unsigned char * sha2 )
680
681
{
681
- return !memcmp (sha1 , null_sha1 , 20 );
682
+ int i ;
683
+
684
+ for (i = 0 ; i < 20 ; i ++ , sha1 ++ , sha2 ++ ) {
685
+ if (* sha1 != * sha2 )
686
+ return * sha1 - * sha2 ;
687
+ }
688
+
689
+ return 0 ;
682
690
}
683
- static inline int hashcmp (const unsigned char * sha1 , const unsigned char * sha2 )
691
+
692
+ static inline int is_null_sha1 (const unsigned char * sha1 )
684
693
{
685
- return memcmp (sha1 , sha2 , 20 );
694
+ return ! hashcmp (sha1 , null_sha1 );
686
695
}
696
+
687
697
static inline void hashcpy (unsigned char * sha_dst , const unsigned char * sha_src )
688
698
{
689
699
memcpy (sha_dst , sha_src , 20 );
You can’t perform that action at this time.
0 commit comments