struct exec_closure: make rows and cols int, not short

There's no real space saved by using short and using int avoids a
few casts.
This commit is contained in:
Todd C. Miller
2023-07-07 15:42:53 -06:00
parent 548e3e3125
commit 92860c717d
3 changed files with 11 additions and 11 deletions

View File

@@ -64,8 +64,8 @@ handle_sigwinch(struct exec_closure *ec, int fd)
log_winchange(ec, wsize.ws_row, wsize.ws_col); log_winchange(ec, wsize.ws_row, wsize.ws_col);
/* Update rows/cols. */ /* Update rows/cols. */
ec->rows = (short)wsize.ws_row; ec->rows = wsize.ws_row;
ec->cols = (short)wsize.ws_col; ec->cols = wsize.ws_col;
} }
} }
} }
@@ -218,8 +218,8 @@ fill_exec_closure(struct exec_closure *ec, struct command_status *cstat,
ec->ppgrp = getpgrp(); ec->ppgrp = getpgrp();
ec->cstat = cstat; ec->cstat = cstat;
ec->details = details; ec->details = details;
ec->rows = (short)user_details->ts_rows; ec->rows = user_details->ts_rows;
ec->cols = (short)user_details->ts_cols; ec->cols = user_details->ts_cols;
/* Setup event base and events. */ /* Setup event base and events. */
ec->evbase = evbase; ec->evbase = evbase;

View File

@@ -946,8 +946,8 @@ fill_exec_closure(struct exec_closure *ec, struct command_status *cstat,
ec->cmnd_pid = -1; ec->cmnd_pid = -1;
ec->cstat = cstat; ec->cstat = cstat;
ec->details = details; ec->details = details;
ec->rows = (short)user_details->ts_rows; ec->rows = user_details->ts_rows;
ec->cols = (short)user_details->ts_cols; ec->cols = user_details->ts_cols;
/* Reset cstat for running the command. */ /* Reset cstat for running the command. */
cstat->type = CMD_INVALID; cstat->type = CMD_INVALID;
@@ -1453,7 +1453,7 @@ sync_ttysize(struct exec_closure *ec)
if (ioctl(io_fds[SFD_USERTTY], TIOCGWINSZ, &wsize) == 0) { if (ioctl(io_fds[SFD_USERTTY], TIOCGWINSZ, &wsize) == 0) {
if (wsize.ws_row != ec->rows || wsize.ws_col != ec->cols) { if (wsize.ws_row != ec->rows || wsize.ws_col != ec->cols) {
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: %hd x %hd -> %hd x %hd", sudo_debug_printf(SUDO_DEBUG_INFO, "%s: %d x %d -> %hd x %hd",
__func__, ec->rows, ec->cols, wsize.ws_row, wsize.ws_col); __func__, ec->rows, ec->cols, wsize.ws_row, wsize.ws_col);
/* Log window change event. */ /* Log window change event. */
@@ -1464,8 +1464,8 @@ sync_ttysize(struct exec_closure *ec)
killpg(ec->cmnd_pid, SIGWINCH); killpg(ec->cmnd_pid, SIGWINCH);
/* Update rows/cols. */ /* Update rows/cols. */
ec->rows = (short)wsize.ws_row; ec->rows = wsize.ws_row;
ec->cols = (short)wsize.ws_col; ec->cols = wsize.ws_col;
} }
} }

View File

@@ -76,8 +76,8 @@ struct exec_closure {
pid_t monitor_pid; pid_t monitor_pid;
pid_t cmnd_pid; pid_t cmnd_pid;
pid_t ppgrp; pid_t ppgrp;
short rows; int rows;
short cols; int cols;
bool foreground; bool foreground;
bool term_raw; bool term_raw;
}; };