mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 04:21:24 +08:00
Initialize global variables and reset to NULL on free()
Signed-off-by: Claus Fischer <claus.fischer@clausfischer.com> Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
b30c3479f5
commit
ed87f37409
@ -100,7 +100,7 @@ static int el_infd = EL_STDIN;
|
|||||||
static int el_outfd = EL_STDOUT;
|
static int el_outfd = EL_STDOUT;
|
||||||
static el_keymap_t Map[];
|
static el_keymap_t Map[];
|
||||||
static el_keymap_t MetaMap[];
|
static el_keymap_t MetaMap[];
|
||||||
static size_t Length;
|
static size_t Length = 0;
|
||||||
static size_t ScreenCount;
|
static size_t ScreenCount;
|
||||||
static size_t ScreenSize;
|
static size_t ScreenSize;
|
||||||
static char *backspace = "\b";
|
static char *backspace = "\b";
|
||||||
@ -114,9 +114,9 @@ int rl_mark;
|
|||||||
int rl_end;
|
int rl_end;
|
||||||
int rl_meta_chars = 0; /* Display 8-bit chars as the actual char(0) or as `M-x'(1)? */
|
int rl_meta_chars = 0; /* Display 8-bit chars as the actual char(0) or as `M-x'(1)? */
|
||||||
int rl_inhibit_complete = 0;
|
int rl_inhibit_complete = 0;
|
||||||
char *rl_line_buffer;
|
char *rl_line_buffer = NULL;
|
||||||
const char *rl_prompt;
|
const char *rl_prompt = NULL;
|
||||||
const char *rl_readline_name; /* Set by calling program, for conditional parsing of ~/.inputrc - Not supported yet! */
|
const char *rl_readline_name = NULL; /* Set by calling program, for conditional parsing of ~/.inputrc - Not supported yet! */
|
||||||
FILE *rl_instream = NULL; /* The stdio stream from which input is read. Defaults to stdin if NULL */
|
FILE *rl_instream = NULL; /* The stdio stream from which input is read. Defaults to stdin if NULL */
|
||||||
FILE *rl_outstream = NULL; /* The stdio stream to which output is flushed. Defaults to stdout if NULL */
|
FILE *rl_outstream = NULL; /* The stdio stream to which output is flushed. Defaults to stdout if NULL */
|
||||||
|
|
||||||
@ -1221,6 +1221,7 @@ char *readline(const char *prompt)
|
|||||||
rl_deprep_term_function();
|
rl_deprep_term_function();
|
||||||
free(Screen);
|
free(Screen);
|
||||||
free(H.Lines[--H.Size]);
|
free(H.Lines[--H.Size]);
|
||||||
|
H.Lines[H.Size] = NULL;
|
||||||
|
|
||||||
/* Add to history, unless no-echo or no-history mode ... */
|
/* Add to history, unless no-echo or no-history mode ... */
|
||||||
if (!el_no_echo && !el_no_hist) {
|
if (!el_no_echo && !el_no_hist) {
|
||||||
|
Loading…
Reference in New Issue
Block a user