mirror of
https://github.com/neovim/neovim.git
synced 2025-10-14 05:46:12 +00:00
refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)
vim-patch:8.2.0559: clearing a struct is verbose
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
a80faa8930
This commit is contained in:
@@ -821,7 +821,7 @@ static bool mf_do_open(memfile_T *mfp, char_u *fname, int flags)
|
||||
/// Initialize an empty hash table.
|
||||
static void mf_hash_init(mf_hashtab_T *mht)
|
||||
{
|
||||
memset(mht, 0, sizeof(mf_hashtab_T));
|
||||
CLEAR_POINTER(mht);
|
||||
mht->mht_buckets = mht->mht_small_buckets;
|
||||
mht->mht_mask = MHT_INIT_SIZE - 1;
|
||||
}
|
||||
@@ -924,7 +924,7 @@ static void mf_hash_grow(mf_hashtab_T *mht)
|
||||
/// a power of two.
|
||||
|
||||
mf_hashitem_T *tails[MHT_GROWTH_FACTOR];
|
||||
memset(tails, 0, sizeof(tails));
|
||||
CLEAR_FIELD(tails);
|
||||
|
||||
for (mf_hashitem_T *mhi = mht->mht_buckets[i];
|
||||
mhi != NULL; mhi = mhi->mhi_next) {
|
||||
|
Reference in New Issue
Block a user