From 5828e8352c07753a1f751322800524bf9dff8679 Mon Sep 17 00:00:00 2001 From: René Scharfe Date: Sun, 2 Jun 2013 17:46:56 +0200 Subject: diff-lib, read-tree, unpack-trees: mark cache_entry array paramters const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- diff-lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'diff-lib.c') diff --git a/diff-lib.c b/diff-lib.c index 83d0cb8f82..b6f4b21637 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -424,7 +424,8 @@ static void do_oneway_diff(struct unpack_trees_options *o, * the fairly complex unpack_trees() semantic requirements, including * the skipping, the path matching, the type conflict cases etc. */ -static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o) +static int oneway_diff(const struct cache_entry * const *src, + struct unpack_trees_options *o) { const struct cache_entry *idx = src[0]; const struct cache_entry *tree = src[1]; -- cgit v1.3