Mercurial > vim
comparison src/memfile.c @ 13244:ac42c4b11dbc v8.0.1496
patch 8.0.1496: clearing a pointer takes two lines
commit https://github.com/vim/vim/commit/d23a823669d93fb2a570a039173eefe4856ac806
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 10 18:45:26 2018 +0100
patch 8.0.1496: clearing a pointer takes two lines
Problem: Clearing a pointer takes two lines.
Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi,
closes #2629)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 10 Feb 2018 19:00:07 +0100 |
parents | 66f1b5bf3fa6 |
children | aa9c7588d30a |
comparison
equal
deleted
inserted
replaced
13243:899b19739188 | 13244:ac42c4b11dbc |
---|---|
295 mfp->mf_fd = -1; | 295 mfp->mf_fd = -1; |
296 | 296 |
297 if (mfp->mf_fname != NULL) | 297 if (mfp->mf_fname != NULL) |
298 { | 298 { |
299 mch_remove(mfp->mf_fname); /* delete the swap file */ | 299 mch_remove(mfp->mf_fname); /* delete the swap file */ |
300 vim_free(mfp->mf_fname); | 300 VIM_CLEAR(mfp->mf_fname); |
301 vim_free(mfp->mf_ffname); | 301 VIM_CLEAR(mfp->mf_ffname); |
302 mfp->mf_fname = NULL; | |
303 mfp->mf_ffname = NULL; | |
304 } | 302 } |
305 } | 303 } |
306 | 304 |
307 /* | 305 /* |
308 * Set new size for a memfile. Used when block 0 of a swapfile has been read | 306 * Set new size for a memfile. Used when block 0 of a swapfile has been read |
1286 /* | 1284 /* |
1287 * If the file cannot be opened, use memory only | 1285 * If the file cannot be opened, use memory only |
1288 */ | 1286 */ |
1289 if (mfp->mf_fd < 0) | 1287 if (mfp->mf_fd < 0) |
1290 { | 1288 { |
1291 vim_free(mfp->mf_fname); | 1289 VIM_CLEAR(mfp->mf_fname); |
1292 vim_free(mfp->mf_ffname); | 1290 VIM_CLEAR(mfp->mf_ffname); |
1293 mfp->mf_fname = NULL; | |
1294 mfp->mf_ffname = NULL; | |
1295 } | 1291 } |
1296 else | 1292 else |
1297 { | 1293 { |
1298 #ifdef HAVE_FD_CLOEXEC | 1294 #ifdef HAVE_FD_CLOEXEC |
1299 int fdflags = fcntl(mfp->mf_fd, F_GETFD); | 1295 int fdflags = fcntl(mfp->mf_fd, F_GETFD); |