diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-03-07 17:13:51 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-03-07 17:13:51 +0000 |
commit | 14113fdf9cb3d588c0d1c3a210246b981cf5aad3 (patch) | |
tree | a0f17ad3f6c5b31a0463e452122ba9e5aaa9705a /src/dict.c | |
parent | 663ee88a8260d69d9310e22f2bfdec49af6a102e (diff) |
patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected filev9.0.1390
Problem: FOR_ALL_ macros are defined in an unexpected file.
Solution: Move FOR_ALL_ macros to macros.h. Add FOR_ALL_HASHTAB_ITEMS.
(Yegappan Lakshmanan, closes #12109)
Diffstat (limited to 'src/dict.c')
-rw-r--r-- | src/dict.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/dict.c b/src/dict.c index 6941845cda..74501ffe31 100644 --- a/src/dict.c +++ b/src/dict.c @@ -128,7 +128,7 @@ hashtab_free_contents(hashtab_T *ht) // Lock the hashtab, we don't want it to resize while freeing items. hash_lock(ht); todo = (int)ht->ht_used; - for (hi = ht->ht_array; todo > 0; ++hi) + FOR_ALL_HASHTAB_ITEMS(ht, hi, todo) { if (!HASHITEM_EMPTY(hi)) { @@ -781,7 +781,7 @@ dict2string(typval_T *tv, int copyID, int restore_copyID) ga_append(&ga, '{'); todo = (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) + FOR_ALL_HASHTAB_ITEMS(&d->dv_hashtab, hi, todo) { if (!HASHITEM_EMPTY(hi)) { @@ -1114,7 +1114,8 @@ dict_extend(dict_T *d1, dict_T *d2, char_u *action, char *func_name) type = NULL; todo = (int)d2->dv_hashtab.ht_used; - for (hashitem_T *hi2 = d2->dv_hashtab.ht_array; todo > 0; ++hi2) + hashitem_T *hi2; + FOR_ALL_HASHTAB_ITEMS(&d2->dv_hashtab, hi2, todo) { if (!HASHITEM_EMPTY(hi2)) { @@ -1203,7 +1204,7 @@ dict_equal( return FALSE; todo = (int)d1->dv_hashtab.ht_used; - for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi) + FOR_ALL_HASHTAB_ITEMS(&d1->dv_hashtab, hi, todo) { if (!HASHITEM_EMPTY(hi)) { @@ -1233,7 +1234,7 @@ dict_count(dict_T *d, typval_T *needle, int ic) return 0; todo = (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) + FOR_ALL_HASHTAB_ITEMS(&d->dv_hashtab, hi, todo) { if (!HASHITEM_EMPTY(hi)) { @@ -1369,7 +1370,7 @@ dict_filter_map( ht = &d->dv_hashtab; hash_lock(ht); todo = (int)ht->ht_used; - for (hi = ht->ht_array; todo > 0; ++hi) + FOR_ALL_HASHTAB_ITEMS(ht, hi, todo) { if (!HASHITEM_EMPTY(hi)) { @@ -1502,7 +1503,7 @@ dict2list(typval_T *argvars, typval_T *rettv, dict2list_T what) return; todo = (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) + FOR_ALL_HASHTAB_ITEMS(&d->dv_hashtab, hi, todo) { if (!HASHITEM_EMPTY(hi)) { @@ -1587,7 +1588,7 @@ dict_set_items_ro(dict_T *di) hashitem_T *hi; // Set readonly - for (hi = di->dv_hashtab.ht_array; todo > 0 ; ++hi) + FOR_ALL_HASHTAB_ITEMS(&di->dv_hashtab, hi, todo) { if (HASHITEM_EMPTY(hi)) continue; |