From ee42bb0e3d6534b8ac4d48df90b1bb85323972ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 28 Nov 2015 19:18:29 +0100 Subject: [PATCH] tree: make path len uint16_t and avoid holes This reduces the size of the struct from 32 to 26 bytes, and leaves a single padding byte at the end of the struct (which comes from the zero-length array). --- src/tree.c | 2 +- src/tree.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tree.c b/src/tree.c index ff0464f1b..d269a5333 100644 --- a/src/tree.c +++ b/src/tree.c @@ -125,7 +125,7 @@ static git_tree_entry *alloc_entry(const char *filename) struct tree_key_search { const char *filename; - size_t filename_len; + uint16_t filename_len; }; static int homing_search_cmp(const void *key, const void *array_member) diff --git a/src/tree.h b/src/tree.h index 51f42ca32..914d788c8 100644 --- a/src/tree.h +++ b/src/tree.h @@ -16,9 +16,9 @@ struct git_tree_entry { uint16_t attr; + uint16_t filename_len; git_oid oid; bool pooled; - size_t filename_len; char filename[GIT_FLEX_ARRAY]; };