Skip to content

Commit a5e89e6

Browse files
authored
move ioctrl and cmax to minimize resources
1 parent 505e622 commit a5e89e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kirc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,13 @@ main(int argc, char **argv) {
328328

329329
for (;;) {
330330
int poll_res = poll(fds, 2, -1);
331-
ioctl(0, TIOCGWINSZ, &window_dims);
332-
cmax = window_dims.ws_col;
333331
if (poll_res != -1) {
334332
if (fds[0].revents & POLLIN) {
335333
handle_user_input();
336334
}
337335
if (fds[1].revents & POLLIN && (keyboard_hit() < 1)) {
336+
ioctl(0, TIOCGWINSZ, &window_dims);
337+
cmax = window_dims.ws_col;
338338
int rc = handle_server_message();
339339
if (rc != 0) {
340340
if (rc == -2) return EXIT_FAILURE;

0 commit comments

Comments
 (0)