summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-05-19 14:22:35 +0200
committerPatrick Steinhardt <ps@pks.im>2017-06-06 09:38:44 +0200
commit350d2c47bcbf9d9c09f2b65c9659f0c5c2d683b5 (patch)
tree28c8a1148cf593adc7362fa4ead1986b076e19f3
parent46b67034a12555a6ef60d28c02d0d9d15fdc117b (diff)
downloadlibgit2-350d2c47bcbf9d9c09f2b65c9659f0c5c2d683b5.tar.gz
index: remove file-scope entry size macros
All index entry size computations are now performed in `index_entry_size`. As such, we do not need the file-scope macros for computing these sizes anymore. Remove them and move the `entry_size` macro into the `index_entry_size` function.
-rw-r--r--src/index.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/index.c b/src/index.c
index 820c9716d..ed9f47839 100644
--- a/src/index.c
+++ b/src/index.c
@@ -54,10 +54,6 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
unsigned int flags,
git_index_matched_path_cb cb, void *payload);
-#define entry_size(type,len) ((offsetof(type, path) + (len) + 8) & ~7)
-#define short_entry_size(len) entry_size(struct entry_short, len)
-#define long_entry_size(len) entry_size(struct entry_long, len)
-
#define minimal_entry_size (offsetof(struct entry_short, path))
static const size_t INDEX_FOOTER_SIZE = GIT_OID_RAWSZ;
@@ -2290,10 +2286,12 @@ static size_t index_entry_size(size_t path_len, size_t varint_len, uint32_t flag
else
return offsetof(struct entry_short, path) + path_len + 1 + varint_len;
} else {
+#define entry_size(type,len) ((offsetof(type, path) + (len) + 8) & ~7)
if (flags & GIT_IDXENTRY_EXTENDED)
- return long_entry_size(path_len);
+ return entry_size(struct entry_long, path_len);
else
- return short_entry_size(path_len);
+ return entry_size(struct entry_short, path_len);
+#undef entry_size
}
}