[PATCH 1/7] cache: mark cache_entry pointers const
- From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
- Date
- May 30, 2013, 11:34 UTC
- Message-ID
- <1369913664-49734-2-git-send-email-rene.scharfe@lsrfire.ath.cx>
- In-Reply-To
- <1369913664-49734-1-git-send-email-rene.scharfe@lsrfire.ath.cx>
Add const for pointers that are only dereferenced for reading by the inline functions copy_cache_entry and ce_mode_from_stat. This allows callers to pass in const pointers.
Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> --- cache.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cache.h b/cache.h index 94ca1ac..43a27e7 100644 --- a/cache.h +++ b/cache.h @@ -190,7 +190,8 @@ struct cache_entry { * another. But we never change the name, or the hash state! */ #define CE_STATE_MASK (CE_HASHED | CE_UNHASHED) -static inline void copy_cache_entry(struct cache_entry *dst, struct cache_entry *src) +static inline void copy_cache_entry(struct cache_entry *dst, + const struct cache_entry *src) { unsigned int state = dst->ce_flags & CE_STATE_MASK; @@ -222,7 +223,8 @@ static inline unsigned int create_ce_mode(unsigned int mode) return S_IFGITLINK; return S_IFREG | ce_permissions(mode); } -static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode) +static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce, + unsigned int mode) { extern int trust_executable_bit, has_symlinks; if (!has_symlinks && S_ISREG(mode) &&
-- 1.8.3