comparison src/memfile.c @ 20007:aadd1cae2ff5 v8.2.0559

patch 8.2.0559: clearing a struct is verbose Commit: https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 12 19:37:17 2020 +0200 patch 8.2.0559: clearing a struct is verbose Problem: Clearing a struct is verbose. Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
author Bram Moolenaar <Bram@vim.org>
date Sun, 12 Apr 2020 19:45:05 +0200
parents f41b55f9357c
children bb3f60b0aca0
comparison
equal deleted inserted replaced
20006:aee3c9266968 20007:aadd1cae2ff5
1335 * Initialize an empty hash table. 1335 * Initialize an empty hash table.
1336 */ 1336 */
1337 static void 1337 static void
1338 mf_hash_init(mf_hashtab_T *mht) 1338 mf_hash_init(mf_hashtab_T *mht)
1339 { 1339 {
1340 vim_memset(mht, 0, sizeof(mf_hashtab_T)); 1340 CLEAR_POINTER(mht);
1341 mht->mht_buckets = mht->mht_small_buckets; 1341 mht->mht_buckets = mht->mht_small_buckets;
1342 mht->mht_mask = MHT_INIT_SIZE - 1; 1342 mht->mht_mask = MHT_INIT_SIZE - 1;
1343 } 1343 }
1344 1344
1345 /* 1345 /*
1478 * 1478 *
1479 * Here we strongly rely on the fact the hashes are computed modulo 1479 * Here we strongly rely on the fact the hashes are computed modulo
1480 * a power of two. 1480 * a power of two.
1481 */ 1481 */
1482 1482
1483 vim_memset(tails, 0, sizeof(tails)); 1483 CLEAR_FIELD(tails);
1484 1484
1485 for (mhi = mht->mht_buckets[i]; mhi != NULL; mhi = mhi->mhi_next) 1485 for (mhi = mht->mht_buckets[i]; mhi != NULL; mhi = mhi->mhi_next)
1486 { 1486 {
1487 j = (mhi->mhi_key >> shift) & (MHT_GROWTH_FACTOR - 1); 1487 j = (mhi->mhi_key >> shift) & (MHT_GROWTH_FACTOR - 1);
1488 if (tails[j] == NULL) 1488 if (tails[j] == NULL)