line editing: make read_line_input() not take timeout param
It's almost always -1. function old new delta read_line_input 3902 3912 +10 new_line_input_t 24 31 +7 pgetc 583 585 +2 save_command_ps_at_cur_history 80 78 -2 read_line 76 74 -2 fgetc_interactive 246 244 -2 addLines 84 82 -2 doCommands 2226 2222 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/5 up/down: 19/-12) Total: 7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
+3
-2
@@ -10185,8 +10185,8 @@ preadfd(void)
|
||||
if (!iflag || g_parsefile->pf_fd != STDIN_FILENO)
|
||||
nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1);
|
||||
else {
|
||||
int timeout = -1;
|
||||
# if ENABLE_ASH_IDLE_TIMEOUT
|
||||
int timeout = -1;
|
||||
if (iflag) {
|
||||
const char *tmout_var = lookupvar("TMOUT");
|
||||
if (tmout_var) {
|
||||
@@ -10195,12 +10195,13 @@ preadfd(void)
|
||||
timeout = -1;
|
||||
}
|
||||
}
|
||||
line_input_state->timeout = timeout;
|
||||
# endif
|
||||
# if ENABLE_FEATURE_TAB_COMPLETION
|
||||
line_input_state->path_lookup = pathval();
|
||||
# endif
|
||||
reinit_unicode_for_ash();
|
||||
nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout);
|
||||
nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ);
|
||||
if (nr == 0) {
|
||||
/* ^C pressed, "convert" to SIGINT */
|
||||
write(STDOUT_FILENO, "^C", 2);
|
||||
|
||||
+1
-2
@@ -2411,8 +2411,7 @@ static int get_user_input(struct in_str *i)
|
||||
/* buglet: SIGINT will not make new prompt to appear _at once_,
|
||||
* only after <Enter>. (^C works immediately) */
|
||||
r = read_line_input(G.line_input_state, prompt_str,
|
||||
G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1,
|
||||
/*timeout*/ -1
|
||||
G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1
|
||||
);
|
||||
/* read_line_input intercepts ^C, "convert" it to SIGINT */
|
||||
if (r == 0)
|
||||
|
||||
Reference in New Issue
Block a user