MCPcopy Create free account
hub / github.com/git/git / strcmp_offset

Function strcmp_offset

read-cache.c:1089–1102  ·  view source on GitHub ↗

* Like strcmp(), but also return the offset of the first change. * If strings are equal, return the length. */

Source from the content-addressed store, hash-verified

1087 * If strings are equal, return the length.
1088 */
1089int strcmp_offset(const char *s1, const char *s2, size_t *first_change)
1090{
1091 size_t k;
1092
1093 if (!first_change)
1094 return strcmp(s1, s2);
1095
1096 for (k = 0; s1[k] == s2[k]; k++)
1097 if (s1[k] == '\0')
1098 break;
1099
1100 *first_change = k;
1101 return (unsigned char)s1[k] - (unsigned char)s2[k];
1102}
1103
1104/*
1105 * Do we have another file with a pathname that is a proper

Callers 2

has_dir_nameFunction · 0.85
check_strcmp_offsetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected