git-2.22.0/refs/packed-backend.c
/*
 * Compare a snapshot record at `rec` to the specified NUL-terminated
 * refname.
 */
Compare a snapshot record at `rec` to the specified NUL-terminated
refname.
Compare a snapshot record at ` rec ` to the specified NUL - terminated refname .
static int cmp_record_to_refname(const char *rec, const char *refname)
{
	const char *r1 = rec + the_hash_algo->hexsz + 1;
	const char *r2 = refname;
	while (1) {
		if (*r1 == '\n')
			return *r2 ? -1 : 0;
		if (!*r2)
			return 1;
		if (*r1 != *r2)
			return (unsigned char)*r1 < (unsigned char)*r2 ? -1 : +1;
		r1++;
		r2++;
	}
}
static int cmp_record_to_refname ( const char * rec , const char * refname ) { const char * r1 = rec + the_hash_algo -> hexsz + 1 ; const char * r2 = refname ; while ( 1 ) { if ( * r1 == ' \n ' ) return * r2 ? -1 : 0 ; if ( ! * r2 ) return 1 ; if ( * r1 != * r2 ) return ( unsigned char ) * r1 < ( unsigned char ) * r2 ? -1 : +1 ; r1 ++ ; r2 ++ ; } }
Compare a snapshot record at `rec` to the specified NUL-terminated
 refname.
Compare a snapshot record at ` rec ` to the specified NUL - terminated refname .