ed: Move modflag=0 to clearundo()

When we discard the content of an undo buffer
is because we don't need it anymore, and it means
that we don't care about the modify state of the buffer
so we can reset the modflag in clearundo(), and
remove this assignation each time clearundo() is called.
This commit is contained in:
Roberto E. Vargas Caballero 2016-01-01 11:17:00 +01:00 committed by sin
parent 69855fe1bb
commit 58c9739532

3
ed.c
View File

@ -247,6 +247,7 @@ clearundo(void)
free(udata.vec); free(udata.vec);
udata.vec = NULL; udata.vec = NULL;
newcmd = udata.nr = udata.cap = 0; newcmd = udata.nr = udata.cap = 0;
modflag = 0;
} }
static void static void
@ -342,7 +343,6 @@ setscratch()
error("input/output error in scratch file"); error("input/output error in scratch file");
relink(k, k, k, k); relink(k, k, k, k);
clearundo(); clearundo();
modflag = 0;
} }
static void static void
@ -1211,7 +1211,6 @@ repeat:
deflines(curln, curln); deflines(curln, curln);
doread(savfname); doread(savfname);
clearundo(); clearundo();
modflag = 0;
break; break;
default: default:
error("unknown command"); error("unknown command");