libbb: revent previous version of "concurrent history updating"

and replace it with one which does not "snoop" history written
by others. (1) it is what bug 185 needs, and (2) it is less bloaty:

function                                             old     new   delta
load_history                                           -     252    +252
read_line_input                                     3155    3287    +132
next_token                                           914     918      +4
qrealloc                                              36      33      -3
getoptscmd                                           713     708      -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 388/-8)            Total: 380 bytes
This commit is contained in:
Denis Vlasenko
2009-03-23 06:33:37 +00:00
parent ddbee974b4
commit c0ea82a457
2 changed files with 56 additions and 60 deletions

View File

@ -1199,7 +1199,6 @@ typedef struct line_input_t {
int cur_history;
#if ENABLE_FEATURE_EDITING_SAVEHISTORY
unsigned cnt_history_in_file;
off_t last_history_end;
const char *hist_file;
#endif
char *history[MAX_HISTORY + 1];
@ -1215,6 +1214,7 @@ enum {
FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
};
line_input_t *new_line_input_t(int flags) FAST_FUNC;
/* so far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */
/* Returns:
* -1 on read errors or EOF, or on bare Ctrl-D,
* 0 on ctrl-C (the line entered is still returned in 'command'),