path: root/builtin/read-tree.c
diff options
authorRené Scharfe <>2013-06-02 15:46:56 (GMT)
committerJunio C Hamano <>2013-06-02 22:31:14 (GMT)
commit5828e8352c07753a1f751322800524bf9dff8679 (patch)
tree267b32e002843b0f77172d62c9057c92ba1b5b47 /builtin/read-tree.c
parenteb9ae4b505bfacc4974a9ef4f4e6996c78d04a4c (diff)
diff-lib, read-tree, unpack-trees: mark cache_entry array paramters const
Change the type merge_fn_t to accept the array of cache_entry pointers as const pointers to const pointers. This documents the fact that the merge functions don't modify the cache_entry contents or replace any of the pointers in the array. Only a single cast is necessary in unpack_nondirectories because adding two const modifiers at once is not allowed in C. The cast is safe in that it doesn't mask any modfication; call_unpack_fn only needs the array for reading. Signed-off-by: René Scharfe <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/read-tree.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index b847486..0f5d7fe 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -80,7 +80,8 @@ static void debug_stage(const char *label, const struct cache_entry *ce,
-static int debug_merge(struct cache_entry **stages, struct unpack_trees_options *o)
+static int debug_merge(const struct cache_entry * const *stages,
+ struct unpack_trees_options *o)
int i;