ref: d1e4deeddb58a5560716055aef03d75585574b2d
parent: 3345ce88f43cae566eabcc164d5587baf666ca8b
author: qwx <[email protected]>
date: Mon Nov 28 19:28:43 EST 2022
misc debug checks, slightly better error messages
--- a/cmd.c
+++ b/cmd.c
@@ -142,6 +142,8 @@
void
setrange(usize from, usize to)
{
+ assert((from & 3) == 0);
+ assert((to & 3) == 0);
dot.from.pos = from;
dot.to.pos = to;
if(dot.pos < from || dot.pos >= to)
@@ -151,6 +153,7 @@
int
setpos(usize off)
{
+ assert((off & 3) == 0);
setrange(0, totalsz);
assert(off >= dot.from.pos && off < dot.to.pos);
dot.pos = off;
@@ -556,7 +559,7 @@
fd = (intptr)efd;
if((c = readintochunks(fd)) == nil)
- threadexits("readintochunks: %r");
+ threadexits("failed reading from pipe: %r");
close(fd);
paste(nil, c);
assertsize();
@@ -574,7 +577,7 @@
sysfatal("procrfork: %r");
close(epfd[0]);
if(wr && procrfork(wproc, (int*)dup(epfd[1], -1), mainstacksize, RFFDG) < 0){
- fprint(2, "threadcreate: %r\n");
+ fprint(2, "procrfork: %r\n");
return -1;
}
if(rr && threadcreate(rthread, (int*)dup(epfd[1], -1), mainstacksize) < 0){
--- a/draw.c
+++ b/draw.c
@@ -260,7 +260,7 @@
update();
}
-void
+static void
setcur(usize off)
{
if(off < dot.from.pos || off > dot.to.pos - Outsz)