From d1f128b0509dce8b492c233b36131f096fd71274 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 6 Mar 2008 12:46:09 -0800 Subject: Add 'const' where appropriate to index handling functions This is in an effort to make the source index of 'unpack_trees()' as being const, and thus making the compiler help us verify that we only access it for reading. The constification also extended to some of the hashing helpers that get called indirectly. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- read-cache.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'read-cache.c') diff --git a/read-cache.c b/read-cache.c index bf649a31a..a92b25b59 100644 --- a/read-cache.c +++ b/read-cache.c @@ -255,13 +255,13 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) return changed; } -static int is_racy_timestamp(struct index_state *istate, struct cache_entry *ce) +static int is_racy_timestamp(const struct index_state *istate, struct cache_entry *ce) { return (istate->timestamp && ((unsigned int)istate->timestamp) <= ce->ce_mtime); } -int ie_match_stat(struct index_state *istate, +int ie_match_stat(const struct index_state *istate, struct cache_entry *ce, struct stat *st, unsigned int options) { @@ -304,7 +304,7 @@ int ie_match_stat(struct index_state *istate, return changed; } -int ie_modified(struct index_state *istate, +int ie_modified(const struct index_state *istate, struct cache_entry *ce, struct stat *st, unsigned int options) { int changed, changed_fs; @@ -412,7 +412,7 @@ int cache_name_compare(const char *name1, int flags1, const char *name2, int fla return 0; } -int index_name_pos(struct index_state *istate, const char *name, int namelen) +int index_name_pos(const struct index_state *istate, const char *name, int namelen) { int first, last; @@ -1201,7 +1201,7 @@ int discard_index(struct index_state *istate) return 0; } -int unmerged_index(struct index_state *istate) +int unmerged_index(const struct index_state *istate) { int i; for (i = 0; i < istate->cache_nr; i++) { @@ -1346,7 +1346,7 @@ static int ce_write_entry(SHA_CTX *c, int fd, struct cache_entry *ce) return ce_write(c, fd, ondisk, size); } -int write_index(struct index_state *istate, int newfd) +int write_index(const struct index_state *istate, int newfd) { SHA_CTX c; struct cache_header hdr; -- cgit v1.2.1