diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-04-01 02:57:43 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-04-01 02:57:43 +0200 |
commit | e32c9f888bf63427c923e2f6621d582e95680c70 (patch) | |
tree | 9c7e07fab969e1cb818224610e3a072d80b262c0 | |
parent | d13803f64fc5607c6319087240e35a8b86082f64 (diff) | |
download | rneovim-e32c9f888bf63427c923e2f6621d582e95680c70.tar.gz rneovim-e32c9f888bf63427c923e2f6621d582e95680c70.tar.bz2 rneovim-e32c9f888bf63427c923e2f6621d582e95680c70.zip |
clang/"result is garbage/undefined": win_close
win_free_mem: set `dirp` to a dummy value.
-rw-r--r-- | src/nvim/window.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index ad38a34dac..e135d7436d 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2575,15 +2575,12 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) free_tabpage(tp); } -/* - * Free the memory used for a window. - * Returns a pointer to the window that got the freed up space. - */ -static win_T * -win_free_mem ( +// Free the memory used for a window. +// Returns a pointer to the window that got the freed up space. +static win_T *win_free_mem( win_T *win, - int *dirp, /* set to 'v' or 'h' for direction if 'ea' */ - tabpage_T *tp /* tab page "win" is in, NULL for current */ + int *dirp, // set to 'v' or 'h' for direction if 'ea' + tabpage_T *tp // tab page "win" is in, NULL for current ) { frame_T *frp; @@ -2595,6 +2592,7 @@ win_free_mem ( wp = winframe_remove(win, dirp, tp); xfree(frp); } else { + *dirp = 'h'; // Dummy value. if (win_valid(prevwin) && prevwin != win) { wp = prevwin; } else { @@ -2603,10 +2601,11 @@ win_free_mem ( } win_free(win, tp); - /* When deleting the current window of another tab page select a new - * current window. */ - if (tp != NULL && win == tp->tp_curwin) + // When deleting the current window of another tab page select a new + // current window. + if (tp != NULL && win == tp->tp_curwin) { tp->tp_curwin = wp; + } return wp; } |