Replace strlen() with ce_namelen()
authorThomas Gummerer <t.gummerer@gmail.com>
Fri, 6 Jul 2012 16:07:30 +0000 (18:07 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jul 2012 02:49:34 +0000 (19:49 -0700)
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>
read-cache.c
unpack-trees.c

index ef355cc9a89b948688756b8c3681ac607518492b..1df6adf0bf786d7428d42973b3e7bc41870ff702 100644 (file)
@@ -1119,7 +1119,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
                        continue;
 
                if (pathspec &&
-                   !match_pathspec(pathspec, ce->name, strlen(ce->name), 0, seen))
+                   !match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen))
                        filtered = 1;
 
                if (ce_stage(ce)) {
@@ -1841,7 +1841,7 @@ int read_index_unmerged(struct index_state *istate)
                if (!ce_stage(ce))
                        continue;
                unmerged = 1;
-               len = strlen(ce->name);
+               len = ce_namelen(ce);
                size = cache_entry_size(len);
                new_ce = xcalloc(1, size);
                memcpy(new_ce->name, ce->name, len);
index 33a581924e11167dc546bdf97c8d49460b43674e..29893bf65978d4ea14f669851ca37d2df445b503 100644 (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
         * in that directory.
         */
-       namelen = strlen(ce->name);
+       namelen = ce_namelen(ce);
        for (i = locate_in_src_index(ce, o);
             i < o->src_index->cache_nr;
             i++) {