cache-tree: use ce_namelen() instead of strlen()
Use the name length field of cache entries instead of calculating its value anew. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
4bdde337f4
commit
0b72536a0b
10
cache-tree.c
10
cache-tree.c
|
@ -185,10 +185,12 @@ static int verify_cache(struct cache_entry **cache,
|
||||||
* the cache is sorted. Also path can appear only once,
|
* the cache is sorted. Also path can appear only once,
|
||||||
* which means conflicting one would immediately follow.
|
* which means conflicting one would immediately follow.
|
||||||
*/
|
*/
|
||||||
const char *this_name = cache[i]->name;
|
const struct cache_entry *this_ce = cache[i];
|
||||||
const char *next_name = cache[i+1]->name;
|
const struct cache_entry *next_ce = cache[i + 1];
|
||||||
int this_len = strlen(this_name);
|
const char *this_name = this_ce->name;
|
||||||
if (this_len < strlen(next_name) &&
|
const char *next_name = next_ce->name;
|
||||||
|
int this_len = ce_namelen(this_ce);
|
||||||
|
if (this_len < ce_namelen(next_ce) &&
|
||||||
strncmp(this_name, next_name, this_len) == 0 &&
|
strncmp(this_name, next_name, this_len) == 0 &&
|
||||||
next_name[this_len] == '/') {
|
next_name[this_len] == '/') {
|
||||||
if (10 < ++funny) {
|
if (10 < ++funny) {
|
||||||
|
|
Loading…
Reference in New Issue