in get_verbatim_kbinput(), don't pass v_kbinput in as a parameter, since

we're dynamically allocating it and then returning it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2141 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-11-27 15:00:18 +00:00
parent 08eab72517
commit c82997d460
4 changed files with 17 additions and 15 deletions

View File

@ -61,6 +61,9 @@ CVS code -
get_untranslated_kbinput() get_untranslated_kbinput()
- Make the ascii_digits variables ints instead of size_t's, - Make the ascii_digits variables ints instead of size_t's,
since they will only hold very small values. (DLR) since they will only hold very small values. (DLR)
get_verbatim_kbinput()
- Don't pass v_kbinput in as a parameter, since we're
dynamically allocating it and then returning it. (DLR)
get_shortcut(), get_toggle() get_shortcut(), get_toggle()
- Add debug messages. (DLR) - Add debug messages. (DLR)

View File

@ -1225,8 +1225,7 @@ void do_verbatim_input(void)
statusbar(_("Verbatim input")); statusbar(_("Verbatim input"));
v_kbinput = get_verbatim_kbinput(edit, ERR, v_kbinput, &v_len, v_kbinput = get_verbatim_kbinput(edit, ERR, &v_len, TRUE);
TRUE);
/* Turn on DISABLE_CURPOS while inserting character(s) and turn it /* Turn on DISABLE_CURPOS while inserting character(s) and turn it
* off afterwards, so that if constant cursor position display is * off afterwards, so that if constant cursor position display is

View File

@ -540,8 +540,8 @@ int get_control_kbinput(int kbinput);
int get_escape_seq_kbinput(const int *escape_seq, size_t es_len, bool int get_escape_seq_kbinput(const int *escape_seq, size_t es_len, bool
*ignore_seq); *ignore_seq);
int get_escape_seq_abcd(int kbinput); int get_escape_seq_abcd(int kbinput);
int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t int *get_verbatim_kbinput(WINDOW *win, int v_first, size_t *v_len, bool
*v_len, bool allow_ascii); allow_ascii);
int get_untranslated_kbinput(int kbinput, size_t position, bool int get_untranslated_kbinput(int kbinput, size_t position, bool
allow_ascii allow_ascii
#ifndef NANO_SMALL #ifndef NANO_SMALL

View File

@ -190,8 +190,8 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
int *sequence = NULL; int *sequence = NULL;
size_t seq_len; size_t seq_len;
sequence = get_verbatim_kbinput(win, kbinput, sequence, sequence = get_verbatim_kbinput(win, kbinput, &seq_len,
&seq_len, FALSE); FALSE);
/* Handle escape sequences. */ /* Handle escape sequences. */
if (seq == ESCAPE_SEQ) { if (seq == ESCAPE_SEQ) {
@ -1168,13 +1168,13 @@ int get_escape_seq_abcd(int kbinput)
} }
/* Read in a string of input characters (e.g. an escape sequence) /* Read in a string of input characters (e.g. an escape sequence)
* verbatim. If first isn't ERR, make it the first character of the * verbatim. If v_first isn't ERR, make it the first character of the
* string. Store the string in v_kbinput and return the length of the * string. Return the length of the string in v_len. Assume
* string in v_len. Assume nodelay(win) is FALSE. */ * nodelay(win) is FALSE. */
int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t int *get_verbatim_kbinput(WINDOW *win, int v_first, size_t *v_len, bool
*v_len, bool allow_ascii) allow_ascii)
{ {
int kbinput; int kbinput, *v_kbinput;
size_t i = 0, v_newlen = 0; size_t i = 0, v_newlen = 0;
#ifndef NANO_SMALL #ifndef NANO_SMALL
@ -1193,12 +1193,12 @@ int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t
/* If first is ERR, read the first character using blocking input, /* If first is ERR, read the first character using blocking input,
* since using non-blocking input will eat up all unused CPU. * since using non-blocking input will eat up all unused CPU.
* Otherwise, treat first as the first character. Then increment * Otherwise, treat v_first as the first character. Then increment
* v_len and save the character in v_kbinput. */ * v_len and save the character in v_kbinput. */
if (first == ERR) if (v_first == ERR)
kbinput = wgetch(win); kbinput = wgetch(win);
else else
kbinput = first; kbinput = v_first;
(*v_len)++; (*v_len)++;
v_kbinput[0] = kbinput; v_kbinput[0] = kbinput;
#ifdef DEBUG #ifdef DEBUG