Replace strlen() with ce_namelen()

Replace strlen(ce->name) with ce_namelen() in a couple
of places which gives us some additional bits of
performance.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Thomas Gummerer
2012-07-06 18:07:30 +02:00
committed by Junio C Hamano
parent 8228a23b35
commit 68c4f6a577
2 changed files with 3 additions and 3 deletions

View File

@ -1119,7 +1119,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
continue; continue;
if (pathspec && if (pathspec &&
!match_pathspec(pathspec, ce->name, strlen(ce->name), 0, seen)) !match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen))
filtered = 1; filtered = 1;
if (ce_stage(ce)) { if (ce_stage(ce)) {
@ -1841,7 +1841,7 @@ int read_index_unmerged(struct index_state *istate)
if (!ce_stage(ce)) if (!ce_stage(ce))
continue; continue;
unmerged = 1; unmerged = 1;
len = strlen(ce->name); len = ce_namelen(ce);
size = cache_entry_size(len); size = cache_entry_size(len);
new_ce = xcalloc(1, size); new_ce = xcalloc(1, size);
memcpy(new_ce->name, ce->name, len); memcpy(new_ce->name, ce->name, len);

View File

@ -1296,7 +1296,7 @@ static int verify_clean_subdirectory(struct cache_entry *ce,
* First let's make sure we do not have a local modification * First let's make sure we do not have a local modification
* in that directory. * in that directory.
*/ */
namelen = strlen(ce->name); namelen = ce_namelen(ce);
for (i = locate_in_src_index(ce, o); for (i = locate_in_src_index(ce, o);
i < o->src_index->cache_nr; i < o->src_index->cache_nr;
i++) { i++) {