ref: 045dbeed220f68a88253989b5c9583b5ee9e56fb
parent: 371384bf01cded8f8db4c8056557c0efdafd3c33
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Feb 15 17:35:23 EST 2020
plan9: use MIN in memmove on resize
--- a/plan9.c
+++ b/plan9.c
@@ -967,12 +967,11 @@
mbuf_reusable_ensure_size(&mscr, h, w);
memset(mscr.buffer, 0, w*h);
for (n = 0; n < oldh; n++)
- memmove(&mscr.buffer[n*w], &mbuf.buffer[n*oldw], oldw);
+ memmove(&mscr.buffer[n*w], &mbuf.buffer[n*oldw], MIN(w, oldw));
mbuf_reusable_ensure_size(&mbuf, h, w);
memmove(mbuf.buffer, mscr.buffer, w*h);
linebuf = realloc(linebuf, sizeof(Rune)*MAX(w+1, 64));
- field_resize_raw(©field, h, w);
field_copy(&field, ©field);
field_resize_raw(&field, h, w);
memset(field.buffer, '.', w*h);