src: Make code more readable, assert function calls that shouldn't fail

Should help clarify what the issue is in #1972.
This commit is contained in:
Frank LENORMAND 2018-03-31 15:00:19 +03:00
parent fab3dc642a
commit e06d048d2f

View File

@ -475,10 +475,13 @@ void NCursesUI::check_resize(bool force)
resize_pending = 0;
const int fd = open("/dev/tty", O_RDWR);
auto close_fd = on_scope_end([fd]{ close(fd); });
auto close_fd = on_scope_end([fd]{ ::close(fd); });
winsize ws;
if (ioctl(fd, TIOCGWINSZ, (void*)&ws) == 0)
{
kak_assert(fd > -1);
if (::ioctl(fd, TIOCGWINSZ, &ws) != 0)
kak_assert(false);
const bool info = (bool)m_info;
const bool menu = (bool)m_menu;
if (m_window) delwin(m_window);
@ -504,9 +507,6 @@ void NCursesUI::check_resize(bool force)
}
if (info)
info_show(m_info.title, m_info.content, m_info.anchor, m_info.face, m_info.style);
}
else
kak_assert(false);
ungetch(KEY_RESIZE);
clearok(curscr, true);