clang/"result is garbage/undefined": win_close

win_free_mem: set `dirp` to a dummy value.
This commit is contained in:
Justin M. Keyes 2019-04-01 02:57:43 +02:00
parent d13803f64f
commit e32c9f888b

View File

@ -2575,15 +2575,12 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
free_tabpage(tp); free_tabpage(tp);
} }
/* // Free the memory used for a window.
* Free the memory used for a window. // Returns a pointer to the window that got the freed up space.
* Returns a pointer to the window that got the freed up space. static win_T *win_free_mem(
*/
static win_T *
win_free_mem (
win_T *win, win_T *win,
int *dirp, /* set to 'v' or 'h' for direction if 'ea' */ int *dirp, // set to 'v' or 'h' for direction if 'ea'
tabpage_T *tp /* tab page "win" is in, NULL for current */ tabpage_T *tp // tab page "win" is in, NULL for current
) )
{ {
frame_T *frp; frame_T *frp;
@ -2595,6 +2592,7 @@ win_free_mem (
wp = winframe_remove(win, dirp, tp); wp = winframe_remove(win, dirp, tp);
xfree(frp); xfree(frp);
} else { } else {
*dirp = 'h'; // Dummy value.
if (win_valid(prevwin) && prevwin != win) { if (win_valid(prevwin) && prevwin != win) {
wp = prevwin; wp = prevwin;
} else { } else {
@ -2603,10 +2601,11 @@ win_free_mem (
} }
win_free(win, tp); win_free(win, tp);
/* When deleting the current window of another tab page select a new // When deleting the current window of another tab page select a new
* current window. */ // current window.
if (tp != NULL && win == tp->tp_curwin) if (tp != NULL && win == tp->tp_curwin) {
tp->tp_curwin = wp; tp->tp_curwin = wp;
}
return wp; return wp;
} }