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 @@ -614,14 +614,24 @@ extern char *sha1_pack_name(const unsigned char *sha1);
614
614
extern char * sha1_pack_index_name (const unsigned char * sha1 );
615
615
extern const char * find_unique_abbrev (const unsigned char * sha1 , int );
616
616
extern const unsigned char null_sha1 [20 ];
617
- static inline int is_null_sha1 (const unsigned char * sha1 )
617
+
618
+ static inline int hashcmp (const unsigned char * sha1 , const unsigned char * sha2 )
618
619
{
619
- return !memcmp (sha1 , null_sha1 , 20 );
620
+ int i ;
621
+
622
+ for (i = 0 ; i < 20 ; i ++ , sha1 ++ , sha2 ++ ) {
623
+ if (* sha1 != * sha2 )
624
+ return * sha1 - * sha2 ;
625
+ }
626
+
627
+ return 0 ;
620
628
}
621
- static inline int hashcmp (const unsigned char * sha1 , const unsigned char * sha2 )
629
+
630
+ static inline int is_null_sha1 (const unsigned char * sha1 )
622
631
{
623
- return memcmp (sha1 , sha2 , 20 );
632
+ return ! hashcmp (sha1 , null_sha1 );
624
633
}
634
+
625
635
static inline void hashcpy (unsigned char * sha_dst , const unsigned char * sha_src )
626
636
{
627
637
memcpy (sha_dst , sha_src , 20 );
You can’t perform that action at this time.
0 commit comments