path: root/builtin/apply.c
diff options
authorThomas Gummerer <>2012-07-11 09:22:37 (GMT)
committerJunio C Hamano <>2012-07-11 16:42:45 (GMT)
commitb60e188c51242b72061b5f2f0d4df80397f6125a (patch)
treea98bd286f05bca385fba527f3c7971a86cc78c14 /builtin/apply.c
parent01388518c30c20ccbbb9f99e00314ef291ecda37 (diff)
Strip namelen out of ce_flags into a ce_namelen field
Strip the name length from the ce_flags field and move it into its own ce_namelen field in struct cache_entry. This will both give us a tiny bit of a performance enhancement when working with long pathnames and is a refactoring for more readability of the code. It enhances readability, by making it more clear what is a flag, and where the length is stored and make it clear which functions use stages in comparisions and which only use the length. It also makes CE_NAMEMASK private, so that users don't mistakenly write the name length in the flags. Signed-off-by: Thomas Gummerer <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/apply.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index b4428ea..19e8242 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3510,7 +3510,8 @@ static void add_index_file(const char *path, unsigned mode, void *buf, unsigned
ce = xcalloc(1, ce_size);
memcpy(ce->name, path, namelen);
ce->ce_mode = create_ce_mode(mode);
- ce->ce_flags = namelen;
+ ce->ce_flags = create_ce_flags(0);
+ ce->ce_namelen = namelen;
if (S_ISGITLINK(mode)) {
const char *s = buf;