mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
eb9ae4b505
commit
5828e8352c
@@ -8,7 +8,7 @@
|
||||
struct unpack_trees_options;
|
||||
struct exclude_list;
|
||||
|
||||
typedef int (*merge_fn_t)(struct cache_entry **src,
|
||||
typedef int (*merge_fn_t)(const struct cache_entry * const *src,
|
||||
struct unpack_trees_options *options);
|
||||
|
||||
enum unpack_trees_error_types {
|
||||
@@ -77,9 +77,13 @@ struct unpack_trees_options {
|
||||
extern int unpack_trees(unsigned n, struct tree_desc *t,
|
||||
struct unpack_trees_options *options);
|
||||
|
||||
int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o);
|
||||
int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o);
|
||||
int bind_merge(struct cache_entry **src, struct unpack_trees_options *o);
|
||||
int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o);
|
||||
int threeway_merge(const struct cache_entry * const *stages,
|
||||
struct unpack_trees_options *o);
|
||||
int twoway_merge(const struct cache_entry * const *src,
|
||||
struct unpack_trees_options *o);
|
||||
int bind_merge(const struct cache_entry * const *src,
|
||||
struct unpack_trees_options *o);
|
||||
int oneway_merge(const struct cache_entry * const *src,
|
||||
struct unpack_trees_options *o);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user