* Copy the sha1 and stat state of a cache entry from one to * another. But we never change the name, or the hash state! */
| 93 | * another. But we never change the name, or the hash state! |
| 94 | */ |
| 95 | static inline void copy_cache_entry(struct cache_entry *dst, |
| 96 | const struct cache_entry *src) |
| 97 | { |
| 98 | unsigned int state = dst->ce_flags & CE_HASHED; |
| 99 | int mem_pool_allocated = dst->mem_pool_allocated; |
| 100 | |
| 101 | /* Don't copy hash chain and name */ |
| 102 | memcpy(&dst->ce_stat_data, &src->ce_stat_data, |
| 103 | offsetof(struct cache_entry, name) - |
| 104 | offsetof(struct cache_entry, ce_stat_data)); |
| 105 | |
| 106 | /* Restore the hash state */ |
| 107 | dst->ce_flags = (dst->ce_flags & ~CE_HASHED) | state; |
| 108 | |
| 109 | /* Restore the mem_pool_allocated flag */ |
| 110 | dst->mem_pool_allocated = mem_pool_allocated; |
| 111 | } |
| 112 | |
| 113 | static inline unsigned create_ce_flags(unsigned stage) |
| 114 | { |
no outgoing calls
no test coverage detected