summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c56
1 files changed, 16 insertions, 40 deletions
diff --git a/src/fileio.c b/src/fileio.c
index d4735f344..8798cff1b 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;
}