cache: mark cache_entry pointers const

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Jun 2, 2013 at 17:46 UTC 20d142b48c8f2f50662db095e193836d0a8f5ad1
1 file changed +4 -2
cache.h
+4 -2
@@ -190,7 +190,8 @@ struct cache_entry {
190 * another. But we never change the name, or the hash state!
191 */
192 #define CE_STATE_MASK (CE_HASHED | CE_UNHASHED)
193 -static inline void copy_cache_entry(struct cache_entry *dst, struct cache_entry *src)
193 +static inline void copy_cache_entry(struct cache_entry *dst,
194 + const struct cache_entry *src)
195 {
196 unsigned int state = dst->ce_flags & CE_STATE_MASK;
197
@@ -222,7 +223,8 @@ static inline unsigned int create_ce_mode(unsigned int mode)
223 return S_IFGITLINK;
224 return S_IFREG | ce_permissions(mode);
225 }
225 -static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode)
226 +static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce,
227 + unsigned int mode)
228 {
229 extern int trust_executable_bit, has_symlinks;
230 if (!has_symlinks && S_ISREG(mode) &&