Small code cleanup in ncurses_ui.cc

This commit is contained in:
Maxime Coste 2015-09-11 13:02:14 +01:00
parent 55e7f857a4
commit 6292d451cf

View File

@ -454,17 +454,9 @@ void NCursesUI::check_resize(bool force)
winsize ws; winsize ws;
if (ioctl(fd, TIOCGWINSZ, (void*)&ws) == 0) if (ioctl(fd, TIOCGWINSZ, (void*)&ws) == 0)
{ {
auto delete_win = [](NCursesWin*& win) { if (m_window) delwin(m_window);
if (win) if (m_info) m_info.destroy();
{ if (m_menu) m_menu.destroy();
delwin(win);
win = nullptr;
}
};
delete_win(m_window);
delete_win(m_info.win);
delete_win(m_menu.win);
resize_term(ws.ws_row, ws.ws_col); resize_term(ws.ws_row, ws.ws_col);