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>
Thomas Gummerer committed
Jul 6, 2012 at 18:07 UTC
68c4f6a57759233ef4586f27d424721c6c1c0ea7
2 files changed
+3
-3
read-cache.c
+2
-2
@@ -1119,7 +1119,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
1119
continue;
1120
1121
if (pathspec &&
1122
- !match_pathspec(pathspec, ce->name, strlen(ce->name), 0, seen))
1122
+ !match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen))
1123
filtered = 1;
1124
1125
if (ce_stage(ce)) {
@@ -1841,7 +1841,7 @@ int read_index_unmerged(struct index_state *istate)
1841
if (!ce_stage(ce))
1842
continue;
1843
unmerged = 1;
1844
- len = strlen(ce->name);
1844
+ len = ce_namelen(ce);
1845
size = cache_entry_size(len);
1846
new_ce = xcalloc(1, size);
1847
memcpy(new_ce->name, ce->name, len);
unpack-trees.c
+1
-1
@@ -1296,7 +1296,7 @@ static int verify_clean_subdirectory(struct cache_entry *ce,
1296
* First let's make sure we do not have a local modification
1297
* in that directory.
1298
*/
1299
- namelen = strlen(ce->name);
1299
+ namelen = ce_namelen(ce);
1300
for (i = locate_in_src_index(ce, o);
1301
i < o->src_index->cache_nr;
1302
i++) {