- nano.c:
do_delete()
- Tweak for efficiency. (David Benbennick)
+ do_verbatim_kbinput()
+ - Use size_t's instead of ints for the get_verbatim_kbinput()
+ call and the loop that ungetch()es its returned int*,
+ respectively. (DLR)
- proto.h:
- Remove unused add_marked_sameline() prototype. (DLR)
- rcfile.c:
- Refactor the output in the DEBUG #ifdef. It didn't work
properly ever since this function was changed to use an int*
instead of a char*. (DLR)
+ - Change kbinput_len from an int* to a size_t*, since it should
+ never be negative. (DLR)
+ - When reading characters from input, properly reallocate
+ verbatim_kbinput via (int*)nrealloc() instead of an uncast
+ realloc(). (DLR)
+ get_escape_seq_kbinput()
+ - Change escape_seq_len from an int to a size_t, since it should
+ never be negative. (DLR)
edit_refresh()
- Remove apparently unneeded leaveok() calls. (David Benbennick)
- nano.texi:
int do_verbatim_input(void)
{
int *verbatim_kbinput; /* Used to hold verbatim input. */
- int verbatim_len; /* Length of verbatim input. */
- int i;
+ size_t verbatim_len; /* Length of verbatim input. */
+ size_t i;
statusbar(_("Verbatim input"));
verbatim_kbinput = get_verbatim_kbinput(edit, &verbatim_len, 1);
/* Public functions in winio.c */
int get_kbinput(WINDOW *win, int *meta_key);
-int *get_verbatim_kbinput(WINDOW *win, int *kbinput_len, int
+int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len, int
allow_ascii);
int get_ignored_kbinput(WINDOW *win);
int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key);
int get_ascii_kbinput(WINDOW *win, int kbinput);
-int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, int
+int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
escape_seq_len);
int get_escape_seq_abcd(int kbinput);
int get_mouseinput(int *mouse_x, int *mouse_y, int shortcut);
/* Read in a string of input characters (e.g. an escape sequence)
* verbatim, and return the length of the string in kbinput_len. Assume
* nodelay(win) is FALSE. */
-int *get_verbatim_kbinput(WINDOW *win, int *kbinput_len, int
+int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len, int
allow_ascii)
{
int kbinput, *verbatim_kbinput;
#endif
while ((kbinput = wgetch(win)) != ERR) {
(*kbinput_len)++;
- verbatim_kbinput = realloc(verbatim_kbinput, *kbinput_len * sizeof(int));
+ verbatim_kbinput = (int *)nrealloc(verbatim_kbinput, *kbinput_len * sizeof(int));
verbatim_kbinput[*kbinput_len - 1] = kbinput;
#ifdef DEBUG
fprintf(stderr, "get_verbatim_kbinput(): kbinput = %d\n", kbinput);
* Hemel. */
case '[':
{
- int old_kbinput = kbinput, *escape_seq, escape_seq_len;
+ int old_kbinput = kbinput, *escape_seq;
+ size_t escape_seq_len;
nodelay(win, TRUE);
kbinput = wgetch(win);
switch (kbinput) {
* omitted. (Same as above.)
* - The Hurd console has no escape sequences for F11, F12, F13, or
* F14. */
-int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, int
+int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
escape_seq_len)
{
int kbinput = ERR;