patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected file
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)
diff --git a/src/textprop.c b/src/textprop.c
index bee45b6..bead146 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -723,7 +723,8 @@
static textprop_T *text_prop_compare_props;
static buf_T *text_prop_compare_buf;
-/* Score for sorting on position of the text property: 0: above,
+/*
+ * Score for sorting on position of the text property: 0: above,
* 1: after (default), 2: right, 3: below (comes last)
*/
static int
@@ -933,7 +934,7 @@
if (*array == NULL)
return NULL;
todo = (long)ht->ht_used;
- for (hi = ht->ht_array; todo > 0; ++hi)
+ FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{
@@ -1958,7 +1959,7 @@
hash_remove(ht, hi, "prop type delete");
vim_free(prop);
- // currently visibile text properties will disappear
+ // currently visible text properties will disappear
redraw_all_later(UPD_CLEAR);
changed_window_setting_buf(buf == NULL ? curbuf : buf);
}
@@ -2021,7 +2022,7 @@
hashitem_T *hi;
todo = (long)ht->ht_used;
- for (hi = ht->ht_array; todo > 0; ++hi)
+ FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{
@@ -2074,7 +2075,7 @@
return;
todo = (long)ht->ht_used;
- for (hi = ht->ht_array; todo > 0; ++hi)
+ FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{