ref: a898d31f76b7424aeb65b07350cec3539620d50e
parent: 561346d07f176356e9841891e5213672c0a33878
author: cinap_lenrek <[email protected]>
date: Sun Jan 19 13:43:51 EST 2020
acme: fix off by one in colclose(), make dellist() code consistent
--- a/sys/src/cmd/acme/cols.c
+++ b/sys/src/cmd/acme/cols.c
@@ -131,8 +131,8 @@
windelete(w);
winclose(w);
}
- memmove(c->w+i, c->w+i+1, (c->nw-i)*sizeof(Window*));
c->nw--;
+ memmove(c->w+i, c->w+i+1, (c->nw-i)*sizeof(Window*));
c->w = realloc(c->w, c->nw*sizeof(Window*));
if(c->nw == 0){
draw(screen, r, display->white, nil, ZP);
--- a/sys/src/cmd/acme/edit.c
+++ b/sys/src/cmd/acme/edit.c
@@ -267,8 +267,8 @@
void
dellist(List *l, int i)
{
- memmove(&l->ptr[i], &l->ptr[i+1], (l->nused-(i+1))*sizeof(void*));
l->nused--;
+ memmove(&l->ptr[i], &l->ptr[i+1], (l->nused-i)*sizeof(void*));
}
/*