diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-01-17 14:31:26 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-01-17 14:31:26 -0800 |
| commit | 73f69f22e590c2ddc2c6fb678a5b11d9d0ba39fa (patch) | |
| tree | 3009eb67c05e69ccb782d7234cda170e24a9c459 /cache.h | |
| parent | a7caae2729742fc80147bca1c02ae848cb55921a (diff) | |
| parent | 2f6b1eb794ee1f152c1a4b519e3b6dcecd0b487f (diff) | |
| download | git-73f69f22e590c2ddc2c6fb678a5b11d9d0ba39fa.tar.xz | |
Merge branch 'ab/cache-api-cleanup' into ab/cache-api-cleanup-users
* ab/cache-api-cleanup:
cache API: add a "INDEX_STATE_INIT" macro/function, add release_index()
read-cache.c: refactor set_new_index_sparsity() for subsequent commit
sparse-index API: BUG() out on NULL ensure_full_index()
sparse-index.c: expand_to_path() can assume non-NULL "istate"
builtin/difftool.c: { 0 }-initialize rather than using memset()
Diffstat (limited to 'cache.h')
| -rw-r--r-- | cache.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -360,6 +360,19 @@ struct index_state { struct pattern_list *sparse_checkout_patterns; }; +/** + * A "struct index_state istate" must be initialized with + * INDEX_STATE_INIT or the corresponding index_state_init(). + * + * If the variable won't be used again, use release_index() to free() + * its resources. If it needs to be used again use discard_index(), + * which does the same thing, but will use use index_state_init() at + * the end. + */ +#define INDEX_STATE_INIT { 0 } +void index_state_init(struct index_state *istate); +void release_index(struct index_state *istate); + /* Name hashing */ int test_lazy_init_name_hash(struct index_state *istate, int try_threaded); void add_name_hash(struct index_state *istate, struct cache_entry *ce); |
