X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=readline%2Fundo.c;h=f7f30d17d9d8dc48d99e7c4e50069d04e647933d;hb=92acdfaf32b4fa5d59dc65a53b8529a46e6e1daf;hp=25c287b5a2df3df04c7d9fd98f1978949c6d7016;hpb=84041b4c47edb0461f3b82afb77ca2d81819ebfa;p=deliverable%2Fbinutils-gdb.git diff --git a/readline/undo.c b/readline/undo.c index 25c287b5a2..f7f30d17d9 100644 --- a/readline/undo.c +++ b/readline/undo.c @@ -48,7 +48,8 @@ #include "history.h" #include "rlprivate.h" -#include "xmalloc.h" + +#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0) /* Non-zero tells rl_delete_text and rl_insert_text to not add to the undo list. */ @@ -85,7 +86,7 @@ rl_add_undo (what, start, end, text) /* Free the existing undo list. */ void -rl_free_undo_list () +free_undo_list () { while (rl_undo_list) { @@ -106,18 +107,17 @@ int rl_do_undo () { UNDO_LIST *release; - int waiting_for_begin, start, end; + int waiting_for_begin = 0; + int start, end; #define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i))) - start = end = waiting_for_begin = 0; do { if (!rl_undo_list) return (0); _rl_doing_an_undo = 1; - RL_SETSTATE(RL_STATE_UNDOING); /* To better support vi-mode, a start or end value of -1 means rl_point, and a value of -2 means rl_end. */ @@ -152,12 +152,11 @@ rl_do_undo () if (waiting_for_begin) waiting_for_begin--; else - rl_ding (); + ding (); break; } _rl_doing_an_undo = 0; - RL_UNSETSTATE(RL_STATE_UNDOING); release = rl_undo_list; rl_undo_list = rl_undo_list->next; @@ -232,7 +231,7 @@ rl_revert_line (count, key) int count, key; { if (!rl_undo_list) - rl_ding (); + ding (); else { while (rl_undo_list) @@ -255,7 +254,7 @@ rl_undo_command (count, key) count--; else { - rl_ding (); + ding (); break; } }