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)
This commit is contained in:
Yegappan Lakshmanan
2023-03-07 17:13:51 +00:00
committed by Bram Moolenaar
parent 663ee88a82
commit 14113fdf9c
31 changed files with 126 additions and 109 deletions

View File

@ -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;

View File

@ -2650,7 +2650,7 @@ valid_diff(diff_T *diff)
{
diff_T *dp;
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
FOR_ALL_DIFFBLOCKS_IN_TAB(curtab, dp)
if (dp == diff)
return TRUE;
return FALSE;

View File

@ -5415,7 +5415,7 @@ set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack)
// it is added to ht_stack, if it contains a list it is added to
// list_stack.
todo = (int)cur_ht->ht_used;
for (hi = cur_ht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(cur_ht, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
--todo;

View File

@ -7825,7 +7825,7 @@ max_min(typval_T *argvars, typval_T *rettv, int domax)
if (d != NULL)
{
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))
{

View File

@ -2317,7 +2317,7 @@ item_lock(typval_T *tv, int deep, int lock, int check_refcount)
{
// recursive: lock/unlock the items the List contains
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))
{
@ -3571,7 +3571,7 @@ vars_clear_ext(hashtab_T *ht, int free_val)
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))
{

View File

@ -873,10 +873,6 @@ EXTERN vimmenu_T *root_menu INIT(= NULL);
* overruling of menus that the user already defined.
*/
EXTERN int sys_menu INIT(= FALSE);
#define FOR_ALL_MENUS(m) for ((m) = root_menu; (m) != NULL; (m) = (m)->next)
#define FOR_ALL_CHILD_MENUS(p, c) \
for ((c) = (p)->children; (c) != NULL; (c) = (c)->next)
#endif
#ifdef FEAT_GUI
@ -968,27 +964,6 @@ EXTERN win_T *lastwin; // last window
EXTERN win_T *prevwin INIT(= NULL); // previous window
#define ONE_WINDOW (firstwin == lastwin)
#define W_NEXT(wp) ((wp)->w_next)
#define FOR_ALL_WINDOWS(wp) for ((wp) = firstwin; (wp) != NULL; (wp) = (wp)->w_next)
#define FOR_ALL_FRAMES(frp, first_frame) \
for ((frp) = first_frame; (frp) != NULL; (frp) = (frp)->fr_next)
#define FOR_ALL_TABPAGES(tp) for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next)
#define FOR_ALL_WINDOWS_IN_TAB(tp, wp) \
for ((wp) = ((tp) == NULL || (tp) == curtab) \
? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
/*
* When using this macro "break" only breaks out of the inner loop. Use "goto"
* to break out of the tabpage loop.
*/
#define FOR_ALL_TAB_WINDOWS(tp, wp) \
for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \
for ((wp) = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
#define FOR_ALL_POPUPWINS(wp) \
for ((wp) = first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
#define FOR_ALL_POPUPWINS_IN_TAB(tp, wp) \
for ((wp) = (tp)->tp_first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
EXTERN win_T *curwin; // currently active window
@ -1050,16 +1025,6 @@ EXTERN buf_T *firstbuf INIT(= NULL); // first buffer
EXTERN buf_T *lastbuf INIT(= NULL); // last buffer
EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer
#define FOR_ALL_BUFFERS(buf) \
for ((buf) = firstbuf; (buf) != NULL; (buf) = (buf)->b_next)
#define FOR_ALL_BUF_WININFO(buf, wip) \
for ((wip) = (buf)->b_wininfo; (wip) != NULL; (wip) = (wip)->wi_next)
// Iterate through all the signs placed in a buffer
#define FOR_ALL_SIGNS_IN_BUF(buf, sign) \
for ((sign) = (buf)->b_signlist; (sign) != NULL; (sign) = (sign)->se_next)
// Flag that is set when switching off 'swapfile'. It means that all blocks
// are to be loaded into memory. Shouldn't be global...
EXTERN int mf_dont_release INIT(= FALSE); // don't release blocks
@ -1874,9 +1839,6 @@ EXTERN disptick_T display_tick INIT(= 0);
// Line in which spell checking wasn't highlighted because it touched the
// cursor position in Insert mode.
EXTERN linenr_T spell_redraw_lnum INIT(= 0);
#define FOR_ALL_SPELL_LANGS(slang) \
for ((slang) = first_lang; (slang) != NULL; (slang) = (slang)->sl_next)
#endif
#ifdef FEAT_CONCEAL
@ -2015,11 +1977,6 @@ EXTERN char *ch_part_names[]
// Whether a redraw is needed for appending a line to a buffer.
EXTERN int channel_need_redraw INIT(= FALSE);
# define FOR_ALL_CHANNELS(ch) \
for ((ch) = first_channel; (ch) != NULL; (ch) = (ch)->ch_next)
# define FOR_ALL_JOBS(job) \
for ((job) = first_job; (job) != NULL; (job) = (job)->jv_next)
#endif
#ifdef FEAT_EVAL
@ -2032,14 +1989,6 @@ EXTERN int did_repeated_msg INIT(= 0);
# define REPEATED_MSG_SAFESTATE 2
#endif
#if defined(FEAT_DIFF)
#define FOR_ALL_DIFFBLOCKS_IN_TAB(tp, dp) \
for ((dp) = (tp)->tp_first_diff; (dp) != NULL; (dp) = (dp)->df_next)
#endif
#define FOR_ALL_LIST_ITEMS(l, li) \
for ((li) = (l) == NULL ? NULL : (l)->lv_first; (li) != NULL; (li) = (li)->li_next)
// While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this
// overrules p_magic. Otherwise set to OPTION_MAGIC_NOT_SET.
EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET);

View File

@ -108,7 +108,7 @@ hash_clear_all(hashtab_T *ht, int off)
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))
{

View File

@ -3067,7 +3067,7 @@ vim_to_mzscheme_impl(typval_T *vim_value, int depth, Scheme_Hash_Table *visited)
hashitem_T *hi;
dictitem_T *di;
for (hi = ht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -1147,7 +1147,7 @@ vim_to_ruby(typval_T *tv)
hashitem_T *hi;
dictitem_T *di;
for (hi = ht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -140,7 +140,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
return OK;
todo = (int)dict->dv_hashtab.ht_used;
for (hi = dict->dv_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&dict->dv_hashtab, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
item = &dict_lookup(hi)->di_tv;

View File

@ -396,3 +396,56 @@
// Length of the array.
#define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0]))
#ifdef FEAT_MENU
#define FOR_ALL_MENUS(m) \
for ((m) = root_menu; (m) != NULL; (m) = (m)->next)
#define FOR_ALL_CHILD_MENUS(p, c) \
for ((c) = (p)->children; (c) != NULL; (c) = (c)->next)
#endif
#define FOR_ALL_WINDOWS(wp) \
for ((wp) = firstwin; (wp) != NULL; (wp) = (wp)->w_next)
#define FOR_ALL_FRAMES(frp, first_frame) \
for ((frp) = first_frame; (frp) != NULL; (frp) = (frp)->fr_next)
#define FOR_ALL_TABPAGES(tp) \
for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next)
#define FOR_ALL_WINDOWS_IN_TAB(tp, wp) \
for ((wp) = ((tp) == NULL || (tp) == curtab) \
? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
/*
* When using this macro "break" only breaks out of the inner loop. Use "goto"
* to break out of the tabpage loop.
*/
#define FOR_ALL_TAB_WINDOWS(tp, wp) \
for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \
for ((wp) = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
#define FOR_ALL_POPUPWINS(wp) \
for ((wp) = first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
#define FOR_ALL_POPUPWINS_IN_TAB(tp, wp) \
for ((wp) = (tp)->tp_first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
#define FOR_ALL_BUFFERS(buf) \
for ((buf) = firstbuf; (buf) != NULL; (buf) = (buf)->b_next)
#define FOR_ALL_BUF_WININFO(buf, wip) \
for ((wip) = (buf)->b_wininfo; (wip) != NULL; (wip) = (wip)->wi_next)
// Iterate through all the signs placed in a buffer
#define FOR_ALL_SIGNS_IN_BUF(buf, sign) \
for ((sign) = (buf)->b_signlist; (sign) != NULL; (sign) = (sign)->se_next)
#ifdef FEAT_SPELL
#define FOR_ALL_SPELL_LANGS(slang) \
for ((slang) = first_lang; (slang) != NULL; (slang) = (slang)->sl_next)
#endif
// Iterate over all the items in a List
#define FOR_ALL_LIST_ITEMS(l, li) \
for ((li) = (l) == NULL ? NULL : (l)->lv_first; (li) != NULL; (li) = (li)->li_next)
// Iterate over all the items in a hash table
#define FOR_ALL_HASHTAB_ITEMS(ht, hi, todo) \
for ((hi) = (ht)->ht_array; (todo) > 0; ++(hi))

View File

@ -1579,7 +1579,7 @@ utf_char2cells(int c)
// values of them.
//
// Note that these symbols are of varying widths, as they are symbols
// representing differents things ranging from a simple gear icon to an
// representing different things ranging from a simple gear icon to an
// airplane. Some of them are in fact wider than double-width, but Vim
// doesn't support non-fixed-width font, and tagging them as
// double-width is the best way to handle them.
@ -5647,7 +5647,7 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
// Check that all entries are a list with three numbers, the range is
// valid and the cell width is valid.
item = 0;
for (li = l->lv_first; li != NULL; li = li->li_next)
FOR_ALL_LIST_ITEMS(l, li)
{
listitem_T *lili;
varnumber_T n1;

View File

@ -2335,10 +2335,20 @@ mch_restore_title(int which)
{
int do_push_pop = unix_did_set_title || did_set_icon;
// only restore the title or icon when it has been set
mch_settitle(((which & SAVE_RESTORE_TITLE) && unix_did_set_title) ?
(oldtitle ? oldtitle : p_titleold) : NULL,
// Only restore the title or icon when it has been set.
// When using "oldtitle" make a copy, it might be freed halfway.
char_u *title = ((which & SAVE_RESTORE_TITLE) && unix_did_set_title)
? (oldtitle ? oldtitle : p_titleold) : NULL;
char_u *tofree = NULL;
if (title == oldtitle && oldtitle != NULL)
{
tofree = vim_strsave(title);
if (tofree != NULL)
title = tofree;
}
mch_settitle(title,
((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL);
vim_free(tofree);
if (do_push_pop)
{
@ -5654,7 +5664,7 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal)
hashitem_T *hi;
int todo = (int)dict->dv_hashtab.ht_used;
for (hi = dict->dv_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&dict->dv_hashtab, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
typval_T *item = &dict_lookup(hi)->di_tv;

View File

@ -1308,9 +1308,9 @@ encode_key_event(dict_T *args, INPUT_RECORD *ir)
if (mods)
{
// If "modifiers" is explicitly set in the args, then we reset any
// remembered modifer key state that may have been set from earlier
// mod-key-down events, even if they are not yet unset by earlier
// mod-key-up events.
// remembered modifier key state that may have been set from
// earlier mod-key-down events, even if they are not yet unset by
// earlier mod-key-up events.
s_dwMods = 0;
if (mods & MOD_MASK_SHIFT)
ker.dwControlKeyState |= SHIFT_PRESSED;
@ -2017,7 +2017,7 @@ test_mswin_event(char_u *event, dict_T *args)
}
// Ideally, WriteConsoleInput would be used to inject these low-level
// events. But, this doesnt work well in the CI test environment. So
// events. But, this doesn't work well in the CI test environment. So
// implementing an input_record_buffer instead.
if (input_encoded)
lpEventsWritten = write_input_record_buffer(&ir, 1);
@ -5737,7 +5737,7 @@ win32_build_env(dict_T *env, garray_T *gap, int is_terminal)
if (env != NULL)
{
for (hi = env->dv_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&env->dv_hashtab, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -2413,8 +2413,7 @@ popup_close_and_callback(win_T *wp, typval_T *arg)
win_enter(owp, FALSE);
else
{
for (owp = curtab->tp_first_popupwin; owp != NULL;
owp = owp->w_next)
FOR_ALL_POPUPWINS_IN_TAB(curtab, owp)
if (owp != curwin && owp->w_buffer->b_term != NULL)
break;
if (owp != NULL)

View File

@ -335,7 +335,7 @@ profile_reset(void)
functbl = func_tbl_get();
todo = (int)functbl->ht_used;
for (hi = functbl->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(functbl, hi, todo)
{
ufunc_T *fp;
int i;
@ -825,7 +825,7 @@ func_dump_profile(FILE *fd)
sorttab = ALLOC_MULT(ufunc_T *, todo);
for (hi = functbl->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(functbl, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -1672,7 +1672,7 @@ do_source_ext(
// is encountered without the "noclear" argument.
ht = &SCRIPT_VARS(sid);
todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
--todo;
@ -2063,7 +2063,7 @@ get_script_local_funcs(scid_T sid)
// looking for functions with script ID 'sid'.
functbl = func_tbl_get();
todo = functbl->ht_used;
for (hi = functbl->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(functbl, hi, todo)
{
ufunc_T *fp;

View File

@ -543,7 +543,7 @@ store_session_globals(FILE *fd)
char_u *p, *t;
todo = (int)gvht->ht_used;
for (hi = gvht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(gvht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -2058,7 +2058,7 @@ get_nth_sign_group_name(int idx)
// Complete with name of sign groups already defined
current_idx = 0;
todo = (int)sg_table.ht_used;
for (hi = sg_table.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&sg_table, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -3466,7 +3466,7 @@ spell_free_aff(afffile_T *aff)
for (ht = &aff->af_pref; ; ht = &aff->af_suff)
{
todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{
@ -5117,7 +5117,7 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
hashitem_T *hi;
todo = (int)spin->si_commonwords.ht_used;
for (hi = spin->si_commonwords.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&spin->si_commonwords, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
l = (int)STRLEN(hi->hi_key) + 1;

View File

@ -3176,7 +3176,7 @@ suggest_try_soundalike_finish(void)
{
// Free the info about handled words.
todo = (int)slang->sl_sounddone.ht_used;
for (hi = slang->sl_sounddone.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&slang->sl_sounddone, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
vim_free(HI2SFT(hi));

View File

@ -4323,7 +4323,7 @@ syn_clear_keyword(int id, hashtab_T *ht)
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))
{
@ -4371,7 +4371,7 @@ clear_keywtab(hashtab_T *ht)
keyentry_T *kp_next;
todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(ht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -181,7 +181,7 @@ fill_assert_error(
return;
todo = (int)exp_d->dv_hashtab.ht_used;
for (hi = exp_d->dv_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&exp_d->dv_hashtab, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{
@ -204,7 +204,7 @@ fill_assert_error(
// Add items only present in got_d.
todo = (int)got_d->dv_hashtab.ht_used;
for (hi = got_d->dv_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&got_d->dv_hashtab, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -723,7 +723,8 @@ count_props(linenr_T lnum, int only_starting, int last_line)
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 @@ find_type_by_id(hashtab_T *ht, proptype_T ***array, int id)
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 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
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 @@ list_types(hashtab_T *ht, list_T *l)
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 @@ clear_ht_prop_types(hashtab_T *ht)
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))
{

View File

@ -2313,7 +2313,7 @@ cleanup_function_call(funccall_T *fc)
// Make a copy of the a: variables, since we didn't do that above.
todo = (int)fc->fc_l_avars.dv_hashtab.ht_used;
for (hi = fc->fc_l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&fc->fc_l_avars.dv_hashtab, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{
@ -3296,7 +3296,7 @@ delete_script_functions(int sid)
while (todo > 0)
{
todo = func_hashtab.ht_used;
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&func_hashtab, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
fp = HI2UF(hi);
@ -3353,7 +3353,7 @@ free_all_functions(void)
while (todo > 0)
{
todo = func_hashtab.ht_used;
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&func_hashtab, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
// clear the def function index now
@ -3385,7 +3385,7 @@ free_all_functions(void)
while (func_hashtab.ht_used > skipped)
{
todo = func_hashtab.ht_used;
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&func_hashtab, hi, todo)
if (!HASHITEM_EMPTY(hi))
{
--todo;

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1390,
/**/
1389,
/**/

View File

@ -1052,7 +1052,7 @@ invoke_defer_funcs(ectx_T *ectx)
if (defer_tv->v_type != VAR_LIST)
return; // no function added
for (li = defer_tv->vval.v_list->lv_first; li != NULL; li = li->li_next)
FOR_ALL_LIST_ITEMS(defer_tv->vval.v_list, li)
{
list_T *l = li->li_tv.vval.v_list;
typval_T rettv;

View File

@ -281,7 +281,7 @@ free_all_script_vars(scriptitem_T *si)
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))
{

View File

@ -213,7 +213,7 @@ set_tv_type(typval_T *tv, type_T *type)
hashitem_T *hi;
dictitem_T *di;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(&d->dv_hashtab, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -1319,7 +1319,7 @@ write_viminfo_varlist(FILE *fp)
fputs(_("\n# global variables:\n"), fp);
todo = (int)gvht->ht_used;
for (hi = gvht->ht_array; todo > 0; ++hi)
FOR_ALL_HASHTAB_ITEMS(gvht, hi, todo)
{
if (!HASHITEM_EMPTY(hi))
{

View File

@ -5622,7 +5622,7 @@ win_free(
// If there already is an entry with "wi_win" set to NULL it
// must be removed, it would never be used.
// Skip "wip" itself, otherwise Coverity complains.
for (wip2 = buf->b_wininfo; wip2 != NULL; wip2 = wip2->wi_next)
FOR_ALL_BUF_WININFO(buf, wip2)
if (wip2 != wip && wip2->wi_win == NULL)
{
if (wip2->wi_next != NULL)
@ -7378,7 +7378,7 @@ reset_lnums(void)
/*
* A snapshot of the window sizes, to restore them after closing the help
* window.
* or other window.
* Only these fields are used:
* fr_layout
* fr_width
@ -7390,6 +7390,7 @@ reset_lnums(void)
/*
* Create a snapshot of the current frame sizes.
* "idx" is SNAP_HELP_IDX or SNAP_AUCMD_IDX.
*/
void
make_snapshot(int idx)
@ -7473,6 +7474,7 @@ get_snapshot_curwin(int idx)
* Restore a previously created snapshot, if there is any.
* This is only done if the screen size didn't change and the window layout is
* still the same.
* "idx" is SNAP_HELP_IDX or SNAP_AUCMD_IDX.
*/
void
restore_snapshot(