diff-lib, read-tree, unpack-trees: mark cache_entry pointers const
Add const to struct cache_entry pointers throughout the tree which are only used for reading. This allows callers to pass in const pointers. 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
f2fa354205
commit
eb9ae4b505
23
diff-lib.c
23
diff-lib.c
@ -64,8 +64,9 @@ static int check_removed(const struct cache_entry *ce, struct stat *st)
|
||||
* commits, untracked content and/or modified content).
|
||||
*/
|
||||
static int match_stat_with_submodule(struct diff_options *diffopt,
|
||||
struct cache_entry *ce, struct stat *st,
|
||||
unsigned ce_option, unsigned *dirty_submodule)
|
||||
const struct cache_entry *ce,
|
||||
struct stat *st, unsigned ce_option,
|
||||
unsigned *dirty_submodule)
|
||||
{
|
||||
int changed = ce_match_stat(ce, st, ce_option);
|
||||
if (S_ISGITLINK(ce->ce_mode)) {
|
||||
@ -237,7 +238,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
/* A file entry went away or appeared */
|
||||
static void diff_index_show_file(struct rev_info *revs,
|
||||
const char *prefix,
|
||||
struct cache_entry *ce,
|
||||
const struct cache_entry *ce,
|
||||
const unsigned char *sha1, int sha1_valid,
|
||||
unsigned int mode,
|
||||
unsigned dirty_submodule)
|
||||
@ -246,7 +247,7 @@ static void diff_index_show_file(struct rev_info *revs,
|
||||
sha1, sha1_valid, ce->name, dirty_submodule);
|
||||
}
|
||||
|
||||
static int get_stat_data(struct cache_entry *ce,
|
||||
static int get_stat_data(const struct cache_entry *ce,
|
||||
const unsigned char **sha1p,
|
||||
unsigned int *modep,
|
||||
int cached, int match_missing,
|
||||
@ -283,7 +284,7 @@ static int get_stat_data(struct cache_entry *ce,
|
||||
}
|
||||
|
||||
static void show_new_file(struct rev_info *revs,
|
||||
struct cache_entry *new,
|
||||
const struct cache_entry *new,
|
||||
int cached, int match_missing)
|
||||
{
|
||||
const unsigned char *sha1;
|
||||
@ -302,8 +303,8 @@ static void show_new_file(struct rev_info *revs,
|
||||
}
|
||||
|
||||
static int show_modified(struct rev_info *revs,
|
||||
struct cache_entry *old,
|
||||
struct cache_entry *new,
|
||||
const struct cache_entry *old,
|
||||
const struct cache_entry *new,
|
||||
int report_missing,
|
||||
int cached, int match_missing)
|
||||
{
|
||||
@ -362,8 +363,8 @@ static int show_modified(struct rev_info *revs,
|
||||
* give you the position and number of entries in the index).
|
||||
*/
|
||||
static void do_oneway_diff(struct unpack_trees_options *o,
|
||||
struct cache_entry *idx,
|
||||
struct cache_entry *tree)
|
||||
const struct cache_entry *idx,
|
||||
const struct cache_entry *tree)
|
||||
{
|
||||
struct rev_info *revs = o->unpack_data;
|
||||
int match_missing, cached;
|
||||
@ -425,8 +426,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
|
||||
*/
|
||||
static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o)
|
||||
{
|
||||
struct cache_entry *idx = src[0];
|
||||
struct cache_entry *tree = src[1];
|
||||
const struct cache_entry *idx = src[0];
|
||||
const struct cache_entry *tree = src[1];
|
||||
struct rev_info *revs = o->unpack_data;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user