summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-10 18:45:26 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-10 18:45:26 +0100
commitd23a823669d93fb2a570a039173eefe4856ac806 (patch)
tree617130258eae70e3bd7ef7b6da9c494ffee7b572
parent42443c7d7fecc3a2a72154bb6139b028438617c2 (diff)
patch 8.0.1496: clearing a pointer takes two linesv8.0.1496
Problem: Clearing a pointer takes two lines. Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi, closes #2629)
-rw-r--r--src/buffer.c18
-rw-r--r--src/channel.c7
-rw-r--r--src/crypt.c8
-rw-r--r--src/edit.c22
-rw-r--r--src/eval.c30
-rw-r--r--src/evalfunc.c5
-rw-r--r--src/ex_cmds.c22
-rw-r--r--src/ex_cmds2.c4
-rw-r--r--src/ex_docmd.c25
-rw-r--r--src/ex_getln.c25
-rw-r--r--src/fileio.c56
-rw-r--r--src/gui_gtk_x11.c6
-rw-r--r--src/gui_photon.c3
-rw-r--r--src/gui_w32.c3
-rw-r--r--src/gui_x11.c16
-rw-r--r--src/hardcopy.c8
-rw-r--r--src/if_cscope.c17
-rw-r--r--src/macros.h11
-rw-r--r--src/main.c3
-rw-r--r--src/mark.c15
-rw-r--r--src/mbyte.c3
-rw-r--r--src/memfile.c12
-rw-r--r--src/memline.c12
-rw-r--r--src/menu.c3
-rw-r--r--src/message.c16
-rw-r--r--src/misc1.c22
-rw-r--r--src/misc2.c15
-rw-r--r--src/netbeans.c12
-rw-r--r--src/normal.c3
-rw-r--r--src/ops.c12
-rw-r--r--src/option.c3
-rw-r--r--src/os_amiga.c3
-rw-r--r--src/os_mac_conv.c10
-rw-r--r--src/os_mswin.c4
-rw-r--r--src/os_unix.c11
-rw-r--r--src/os_win32.c9
-rw-r--r--src/popupmnu.c3
-rw-r--r--src/proto/misc2.pro1
-rw-r--r--src/quickfix.c12
-rw-r--r--src/regexp.c20
-rw-r--r--src/regexp_nfa.c7
-rw-r--r--src/screen.c31
-rw-r--r--src/search.c3
-rw-r--r--src/spell.c65
-rw-r--r--src/spellfile.c3
-rw-r--r--src/syntax.c35
-rw-r--r--src/tag.c8
-rw-r--r--src/term.c8
-rw-r--r--src/terminal.c18
-rw-r--r--src/ui.c8
-rw-r--r--src/undo.c6
-rw-r--r--src/userfunc.c8
-rw-r--r--src/version.c2
-rw-r--r--src/window.c8
54 files changed, 234 insertions, 466 deletions
diff --git a/src/buffer.c b/src/buffer.c
index c0d3d3d9fc..c3e0c50801 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -944,8 +944,7 @@ free_buffer_stuff(
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
#endif
#ifdef FEAT_MBYTE
- vim_free(buf->b_start_fenc);
- buf->b_start_fenc = NULL;
+ VIM_CLEAR(buf->b_start_fenc);
#endif
}
@@ -2037,10 +2036,8 @@ buflist_new(
if ((ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL))
|| buf->b_wininfo == NULL)
{
- vim_free(buf->b_ffname);
- buf->b_ffname = NULL;
- vim_free(buf->b_sfname);
- buf->b_sfname = NULL;
+ VIM_CLEAR(buf->b_ffname);
+ VIM_CLEAR(buf->b_sfname);
if (buf != curbuf)
free_buffer(buf);
return NULL;
@@ -3136,10 +3133,8 @@ setfname(
if (ffname == NULL || *ffname == NUL)
{
/* Removing the name. */
- vim_free(buf->b_ffname);
- vim_free(buf->b_sfname);
- buf->b_ffname = NULL;
- buf->b_sfname = NULL;
+ VIM_CLEAR(buf->b_ffname);
+ VIM_CLEAR(buf->b_sfname);
#ifdef UNIX
st.st_dev = (dev_T)-1;
#endif
@@ -4261,8 +4256,7 @@ build_stl_str_hl(
if (*skipdigits(str) == NUL)
{
num = atoi((char *)str);
- vim_free(str);
- str = NULL;
+ VIM_CLEAR(str);
itemisflag = FALSE;
}
}
diff --git a/src/channel.c b/src/channel.c
index 138b12eceb..77df42dd92 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -317,8 +317,8 @@ channel_still_useful(channel_T *channel)
/* If there is no callback then nobody can get readahead. If the fd is
* closed and there is no readahead then the callback won't be called. */
has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD
- || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL
- || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL;
+ || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL
+ || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL;
has_out_msg = channel->ch_part[PART_OUT].ch_fd != INVALID_FD
|| channel->ch_part[PART_OUT].ch_head.rq_next != NULL
|| channel->ch_part[PART_OUT].ch_json_head.jq_next != NULL;
@@ -2978,8 +2978,7 @@ channel_clear_one(channel_T *channel, ch_part_T part)
channel_clear(channel_T *channel)
{
ch_log(channel, "Clearing channel");
- vim_free(channel->ch_hostname);
- channel->ch_hostname = NULL;
+ VIM_CLEAR(channel->ch_hostname);
channel_clear_one(channel, PART_SOCK);
channel_clear_one(channel, PART_OUT);
channel_clear_one(channel, PART_ERR);
diff --git a/src/crypt.c b/src/crypt.c
index 81759069f7..dfbf02ca5f 100644
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -118,6 +118,9 @@ static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = {
NULL, NULL,
crypt_blowfish_encode, crypt_blowfish_decode,
},
+
+ /* NOTE: when adding a new method, use some random bytes for the magic key,
+ * to avoid that a text file is recognized as encrypted. */
};
#define CRYPT_MAGIC_LEN 12 /* cannot change */
@@ -349,10 +352,7 @@ crypt_create_for_writing(
state = crypt_create(method_nr, key, salt, salt_len, seed, seed_len);
if (state == NULL)
- {
- vim_free(*header);
- *header = NULL;
- }
+ VIM_CLEAR(*header);
return state;
}
diff --git a/src/edit.c b/src/edit.c
index 7074f26486..f0e5c5185c 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2939,7 +2939,7 @@ ins_compl_del_pum(void)
if (compl_match_array != NULL)
{
pum_undisplay();
- vim_clear((void **)&compl_match_array);
+ VIM_CLEAR(compl_match_array);
}
}
@@ -3441,8 +3441,8 @@ ins_compl_free(void)
compl_T *match;
int i;
- vim_clear((void **)&compl_pattern);
- vim_clear((void **)&compl_leader);
+ VIM_CLEAR(compl_pattern);
+ VIM_CLEAR(compl_leader);
if (compl_first_match == NULL)
return;
@@ -3474,10 +3474,10 @@ ins_compl_clear(void)
compl_cont_status = 0;
compl_started = FALSE;
compl_matches = 0;
- vim_clear((void **)&compl_pattern);
- vim_clear((void **)&compl_leader);
+ VIM_CLEAR(compl_pattern);
+ VIM_CLEAR(compl_leader);
edit_submode_extra = NULL;
- vim_clear((void **)&compl_orig_text);
+ VIM_CLEAR(compl_orig_text);
compl_enter_selects = FALSE;
/* clear v:completed_item */
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED));
@@ -5584,8 +5584,8 @@ ins_complete(int c, int enable_pum)
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
-1, p_ic, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK)
{
- vim_clear((void **)&compl_pattern);
- vim_clear((void **)&compl_orig_text);
+ VIM_CLEAR(compl_pattern);
+ VIM_CLEAR(compl_orig_text);
return FAIL;
}
@@ -7214,9 +7214,9 @@ set_last_insert(int c)
void
free_last_insert(void)
{
- vim_clear((void **)&last_insert);
+ VIM_CLEAR(last_insert);
# ifdef FEAT_INS_EXPAND
- vim_clear((void **)&compl_orig_text);
+ VIM_CLEAR(compl_orig_text);
# endif
}
#endif
@@ -7844,7 +7844,7 @@ mb_replace_pop_ins(int cc)
static void
replace_flush(void)
{
- vim_clear((void **)&replace_stack);
+ VIM_CLEAR(replace_stack);
replace_stack_len = 0;
replace_stack_nr = 0;
}
diff --git a/src/eval.c b/src/eval.c
index 85f607cb77..f20fdda135 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -361,10 +361,7 @@ eval_clear(void)
{
p = &vimvars[i];
if (p->vv_di.di_tv.v_type == VAR_STRING)
- {
- vim_free(p->vv_str);
- p->vv_str = NULL;
- }
+ VIM_CLEAR(p->vv_str);
else if (p->vv_di.di_tv.v_type == VAR_LIST)
{
list_unref(p->vv_list);
@@ -569,14 +566,11 @@ var_redir_stop(void)
}
/* free the collected output */
- vim_free(redir_ga.ga_data);
- redir_ga.ga_data = NULL;
+ VIM_CLEAR(redir_ga.ga_data);
- vim_free(redir_lval);
- redir_lval = NULL;
+ VIM_CLEAR(redir_lval);
}
- vim_free(redir_varname);
- redir_varname = NULL;
+ VIM_CLEAR(redir_varname);
}
# if defined(FEAT_MBYTE) || defined(PROTO)
@@ -1009,10 +1003,7 @@ eval_expr(char_u *arg, char_u **nextcmd)
tv = (typval_T *)alloc(sizeof(typval_T));
if (tv != NULL && eval0(arg, tv, nextcmd, TRUE) == FAIL)
- {
- vim_free(tv);
- tv = NULL;
- }
+ VIM_CLEAR(tv);
return tv;
}
@@ -3213,8 +3204,7 @@ get_user_var_name(expand_T *xp, int idx)
if (vidx < VV_LEN)
return cat_prefix_varname('v', (char_u *)vimvars[vidx++].vv_name);
- vim_free(varnamebuf);
- varnamebuf = NULL;
+ VIM_CLEAR(varnamebuf);
varnamebuflen = 0;
return NULL;
}
@@ -6096,10 +6086,7 @@ get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
/* next try expanding things like $VIM and ${HOME} */
string = expand_env_save(name - 1);
if (string != NULL && *string == '$')
- {
- vim_free(string);
- string = NULL;
- }
+ VIM_CLEAR(string);
}
name[len] = cc;
@@ -7116,8 +7103,7 @@ clear_tv(typval_T *varp)
func_unref(varp->vval.v_string);
/* FALLTHROUGH */
case VAR_STRING:
- vim_free(varp->vval.v_string);
- varp->vval.v_string = NULL;
+ VIM_CLEAR(varp->vval.v_string);
break;
case VAR_PARTIAL:
partial_unref(varp->vval.v_partial);
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 4b34538b7b..f09be92af4 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -9222,10 +9222,7 @@ f_resolve(typval_T *argvars, typval_T *rettv)
if (*q != NUL)
STRMOVE(remain, q - 1);
else
- {
- vim_free(remain);
- remain = NULL;
- }
+ VIM_CLEAR(remain);
}
/* If the result is a relative path name, make it explicitly relative to
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index f4129019ab..11dac06202 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1957,8 +1957,7 @@ write_viminfo(char_u *file, int forceit)
if (!shortname && st_new.st_dev == st_old.st_dev
&& st_new.st_ino == st_old.st_ino)
{
- vim_free(tempname);
- tempname = NULL;
+ VIM_CLEAR(tempname);
shortname = TRUE;
break;
}
@@ -5225,8 +5224,7 @@ do_sub(exarg_T *eap)
lnum += regmatch.startpos[0].lnum;
sub_firstlnum += regmatch.startpos[0].lnum;
nmatch -= regmatch.startpos[0].lnum;
- vim_free(sub_firstline);
- sub_firstline = NULL;
+ VIM_CLEAR(sub_firstline);
}
if (sub_firstline == NULL)
@@ -5388,10 +5386,7 @@ do_sub(exarg_T *eap)
sub_firstline + copycol);
if (new_line == NULL)
- {
- vim_free(orig_line);
- orig_line = NULL;
- }
+ VIM_CLEAR(orig_line);
else
{
/* Position the cursor relative to the
@@ -5820,8 +5815,7 @@ skip:
if (did_sub)
++sub_nlines;
vim_free(new_start); /* for when substitute was cancelled */
- vim_free(sub_firstline); /* free the copy of the original line */
- sub_firstline = NULL;
+ VIM_CLEAR(sub_firstline); /* free the copy of the original line */
}
line_breakcheck();
@@ -6975,8 +6969,7 @@ fix_help_buffer(void)
&& fnamecmp(e1, fname + 4) != 0)
{
/* Not .txt and not .abx, remove it. */
- vim_free(fnames[i1]);
- fnames[i1] = NULL;
+ VIM_CLEAR(fnames[i1]);
continue;
}
if (e1 - f1 != e2 - f2
@@ -6984,11 +6977,8 @@ fix_help_buffer(void)
continue;
if (fnamecmp(e1, ".txt") == 0
&& fnamecmp(e2, fname + 4) == 0)
- {
/* use .abx instead of .txt */
- vim_free(fnames[i1]);
- fnames[i1] = NULL;
- }
+ VIM_CLEAR(fnames[i1]);
}
}
#endif
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 73fe0194be..6caed87bb2 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1298,7 +1298,6 @@ check_due_timer(void)
if (this_due <= 1)
{
bevalexpr_due_set = FALSE;
-
if (balloonEval == NULL)
{
balloonEval = (BalloonEval *)alloc(sizeof(BalloonEval));
@@ -5489,8 +5488,7 @@ free_locales(void)
{
for (i = 0; locales[i] != NULL; i++)
vim_free(locales[i]);
- vim_free(locales);
- locales = NULL;
+ VIM_CLEAR(locales);
}
}
# endif
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 591775f4c4..4082636767 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -868,8 +868,7 @@ do_cmdline(
{
/* Each '|' separated command is stored separately in lines_ga, to
* be able to jump to it. Don't use next_cmdline now. */
- vim_free(cmdline_copy);
- cmdline_copy = NULL;
+ VIM_CLEAR(cmdline_copy);
/* Check if a function has returned or, unless it has an unclosed
* try conditional, aborted. */
@@ -1084,8 +1083,7 @@ do_cmdline(
if (next_cmdline == NULL)
{
- vim_free(cmdline_copy);
- cmdline_copy = NULL;
+ VIM_CLEAR(cmdline_copy);
#ifdef FEAT_CMDHIST
/*
* If the command was typed, remember it for the ':' register.
@@ -5802,11 +5800,9 @@ uc_add_command(
goto fail;
}
- vim_free(cmd->uc_rep);
- cmd->uc_rep = NULL;
+ VIM_CLEAR(cmd->uc_rep);
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
- vim_free(cmd->uc_compl_arg);
- cmd->uc_compl_arg = NULL;
+ VIM_CLEAR(cmd->uc_compl_arg);
#endif
break;
}
@@ -8952,11 +8948,8 @@ static char_u *prev_dir = NULL;
void
free_cd_dir(void)
{
- vim_free(prev_dir);
- prev_dir = NULL;
-
- vim_free(globaldir);
- globaldir = NULL;
+ VIM_CLEAR(prev_dir);
+ VIM_CLEAR(globaldir);
}
#endif
@@ -8967,8 +8960,7 @@ free_cd_dir(void)
void
post_chdir(int local)
{
- vim_free(curwin->w_localdir);
- curwin->w_localdir = NULL;
+ VIM_CLEAR(curwin->w_localdir);
if (local)
{
/* If still in global directory, need to remember current
@@ -8983,8 +8975,7 @@ post_chdir(int local)
{
/* We are now in the global directory, no need to remember its
* name. */
- vim_free(globaldir);
- globaldir = NULL;
+ VIM_CLEAR(globaldir);
}
shorten_fnames(TRUE);
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 837d29998f..a9d6bd4833 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -164,8 +164,7 @@ trigger_cmd_autocmd(int typechar, int evt)
static void
abandon_cmdline(void)
{
- vim_free(ccline.cmdbuff);
- ccline.cmdbuff = NULL;
+ VIM_CLEAR(ccline.cmdbuff);
if (msg_scrolled == 0)
compute_cmdrow();
MSG("");
@@ -500,10 +499,7 @@ getcmdline(
&& c != K_KPAGEDOWN && c != K_KPAGEUP
&& c != K_LEFT && c != K_RIGHT
&& (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N)))
- {
- vim_free(lookfor);
- lookfor = NULL;
- }
+ VIM_CLEAR(lookfor);
#endif
/*
@@ -1096,8 +1092,7 @@ getcmdline(
)
goto cmdline_not_changed;
- vim_free(ccline.cmdbuff); /* no commandline to return */
- ccline.cmdbuff = NULL;
+ VIM_CLEAR(ccline.cmdbuff); /* no commandline to return */
if (!cmd_silent)
{
#ifdef FEAT_RIGHTLEFT
@@ -3683,10 +3678,7 @@ nextwild(
|| ccline.cmdbuff[i + j] == '?')
break;
if ((int)STRLEN(p2) < j)
- {
- vim_free(p2);
- p2 = NULL;
- }
+ VIM_CLEAR(p2);
}
}
}
@@ -3832,8 +3824,7 @@ ExpandOne(
{
FreeWild(xp->xp_numfiles, xp->xp_files);
xp->xp_numfiles = -1;
- vim_free(orig_save);
- orig_save = NULL;
+ VIM_CLEAR(orig_save);
}
findex = 0;
@@ -6737,8 +6728,7 @@ finish_viminfo_history(vir_T *virp)
else
concat_history(type);
- vim_free(viminfo_history[type]);
- viminfo_history[type] = NULL;
+ VIM_CLEAR(viminfo_history[type]);
viminfo_hisidx[type] = 0;
}
}
@@ -6862,8 +6852,7 @@ write_viminfo_history(FILE *fp, int merge)
for (i = 0; i < viminfo_hisidx[type]; ++i)
if (viminfo_history[type] != NULL)
vim_free(viminfo_history[type][i].hisstr);
- vim_free(viminfo_history[type]);
- viminfo_history[type] = NULL;
+ VIM_CLEAR(viminfo_history[type]);
viminfo_hisidx[type] = 0;
}
}
diff --git a/src/fileio.c b/src/fileio.c
index d4735f344e..8798cff1b6 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1073,8 +1073,7 @@ retry:
if (tmpname != NULL)
{
mch_remove(tmpname); /* delete converted file */
- vim_free(tmpname);
- tmpname = NULL;
+ VIM_CLEAR(tmpname);
}
}
@@ -2602,8 +2601,7 @@ failed:
#endif
msg_add_lines(c, (long)linecnt, filesize);
- vim_free(keep_msg);
- keep_msg = NULL;
+ VIM_CLEAR(keep_msg);
msg_scrolled_ign = TRUE;
#ifdef ALWAYS_USE_GUI
/* Don't show the message when reading stdin, it would end up in a
@@ -2955,8 +2953,7 @@ readfile_charconvert(
if (tmpname != NULL)
{
mch_remove(tmpname); /* delete converted file */
- vim_free(tmpname);
- tmpname = NULL;
+ VIM_CLEAR(tmpname);
}
}
@@ -3945,8 +3942,7 @@ buf_write(
if (st_new.st_dev == st_old.st_dev
&& st_new.st_ino == st_old.st_ino)
{
- vim_free(backup);
- backup = NULL; /* no backup file to delete */
+ VIM_CLEAR(backup); /* no backup file to delete */
/*
* may try again with 'shortname' set
*/
@@ -3980,10 +3976,7 @@ buf_write(
--*wp;
/* They all exist??? Must be something wrong. */
if (*wp == 'a')
- {
- vim_free(backup);
- backup = NULL;
- }
+ VIM_CLEAR(backup);
}
}
break;
@@ -4010,10 +4003,7 @@ buf_write(
(void)umask(umask_save);
#endif
if (bfd < 0)
- {
- vim_free(backup);
- backup = NULL;
- }
+ VIM_CLEAR(backup);
else
{
/* Set file protection same as original file, but
@@ -4156,10 +4146,7 @@ buf_write(
--*p;
/* They all exist??? Must be something wrong! */
if (*p == 'a')
- {
- vim_free(backup);
- backup = NULL;
- }
+ VIM_CLEAR(backup);
}
}
if (backup != NULL)
@@ -4177,8 +4164,7 @@ buf_write(
if (vim_rename(fname, backup) == 0)
break;
- vim_free(backup); /* don't do the rename below */
- backup = NULL;
+ VIM_CLEAR(backup); /* don't do the rename below */
}
}
if (backup == NULL && !forceit)
@@ -5079,8 +5065,7 @@ restore_backup:
else if (mch_stat(org, &st) < 0)
{
vim_rename(backup, (char_u *)org);
- vim_free(backup); /* don't delete the file */
- backup = NULL;
+ VIM_CLEAR(backup); /* don't delete the file */
#ifdef UNIX
set_file_time((char_u *)org, st_old.st_atime, st_old.st_mtime);
#endif
@@ -6227,8 +6212,7 @@ shorten_fnames(int force)
|| buf->b_sfname == NULL
|| mch_isFullName(buf->b_sfname)))
{
- vim_free(buf->b_sfname);
- buf->b_sfname = NULL;
+ VIM_CLEAR(buf->b_sfname);
p = shorten_fname(buf->b_ffname, dirname);
if (p != NULL)
{
@@ -7427,8 +7411,7 @@ vim_deltempdir(void)
/* remove the trailing path separator */
gettail(vim_tempdir)[-1] = NUL;
delete_recursive(vim_tempdir);
- vim_free(vim_tempdir);
- vim_tempdir = NULL;
+ VIM_CLEAR(vim_tempdir);
}
}
@@ -8018,8 +8001,7 @@ show_autocmd(AutoPat *ap, event_T event)
static void
au_remove_pat(AutoPat *ap)
{
- vim_free(ap->pat);
- ap->pat = NULL;
+ VIM_CLEAR(ap->pat);
ap->buflocal_nr = -1;
au_need_clean = TRUE;
}
@@ -8033,10 +8015,7 @@ au_remove_cmds(AutoPat *ap)
AutoCmd *ac;
for (ac = ap->cmds; ac != NULL; ac = ac->next)
- {
- vim_free(ac->cmd);
- ac->cmd = NULL;
- }
+ VIM_CLEAR(ac->cmd);
au_need_clean = TRUE;
}
@@ -9094,8 +9073,7 @@ aucmd_prepbuf(
/* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
* win_enter_ext(). */
- vim_free(aucmd_win->w_localdir);
- aucmd_win->w_localdir = NULL;
+ VIM_CLEAR(aucmd_win->w_localdir);
aco->globaldir = globaldir;
globaldir = NULL;
@@ -9877,8 +9855,7 @@ auto_next_pat(
char_u *name;
char *s;
- vim_free(sourcing_name);
- sourcing_name = NULL;
+ VIM_CLEAR(sourcing_name);
for (ap = apc->curpat; ap != NULL && !got_int; ap = ap->next)
{
@@ -10561,8 +10538,7 @@ file_pat_to_reg_pat(
EMSG(_("E219: Missing {."));
else
EMSG(_("E220: Missing }."));
- vim_free(reg_pat);
- reg_pat = NULL;
+ VIM_CLEAR(reg_pat);
}
return reg_pat;
}
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index ad51be62c7..2f88c2eeba 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -3838,8 +3838,7 @@ gui_mch_init(void)
# endif
}
#endif
- vim_free(gui_argv);
- gui_argv = NULL;
+ VIM_CLEAR(gui_argv);
#if GLIB_CHECK_VERSION(2,1,3)
/* Set the human-readable application name */
@@ -4668,8 +4667,7 @@ gui_mch_open(void)
y += hh - pixel_height;
gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
}
- vim_free(gui.geom);
- gui.geom = NULL;
+ VIM_CLEAR(gui.geom);
/* From now until everyone's stopped trying to set the window hints
* to their correct minimum values, stop them being set as we need
diff --git a/src/gui_photon.c b/src/gui_photon.c
index fcfb4f6d9c..327b356514 100644
--- a/src/gui_photon.c
+++ b/src/gui_photon.c
@@ -1040,8 +1040,7 @@ gui_ph_pg_remove_buffer(char *name)
PtSetResource(gui.vimPanelGroup, Pt_ARG_PG_PANEL_TITLES, &empty_title,
1);
- vim_free(panel_titles);
- panel_titles = NULL;
+ VIM_CLEAR(panel_titles);
}
}
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 67aa1fc114..6596cf81e9 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -4941,8 +4941,7 @@ _WndProc(
char_u *str = NULL;
static void *tt_text = NULL;
- vim_free(tt_text);
- tt_text = NULL;
+ VIM_CLEAR(tt_text);
# ifdef FEAT_GUI_TABLINE
if (gui_mch_showing_tabline()
diff --git a/src/gui_x11.c b/src/gui_x11.c
index 34d584e78e..097de5f90e 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -826,7 +826,7 @@ gui_x11_key_hit_cb(