shithub: Nail

Download patch

ref: 62741ed595f4ad79b7d7d18fdc4049a6b46baa8d
parent: 7a543d7e7812826555a20c1e17a9ccc4f6cb2191
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 12 11:27:30 EST 2020

Fix hash table lookups: increment i when dead.

--- a/mbox.c
+++ b/mbox.c
@@ -154,7 +154,7 @@
 		m = mbox.mesg[i];
 		if(m == p)
 			break;
-		if(m->parent == nil){
+		if(m->flags & Ftoplev){
 			n += mbox.mesg[i]->nsub;
 			if(!(m->flags & Fdummy))
 				n++;
@@ -239,9 +239,7 @@
 		e = mbox.hash[i];
 		if(e == nil)
 			return nil;
-		if(e == &dead)
-			continue;
-		if(e->hash == h && strcmp(e->messageid, msgid) == 0)
+		if(e != &dead && e->hash == h && strcmp(e->messageid, msgid) == 0)
 			return e;
 		i = (i + 1) % mbox.hashsz;
 	}