ref: 0987d105600fc76ee3e0ebe92f13aa0128c2006e
parent: bdd642b56f958a862fc12a784e6af0b3fdbb7790
author: qwx <qwx@sciops.net>
date: Tue Feb 22 19:06:21 EST 2022
util: fix vector pop
--- a/util.c
+++ b/util.c
@@ -71,8 +71,10 @@
void
popsparsevec(Vector *v, int n)
{
- assert(v != nil && v->elsz > 0 && n >= 0 && n <= v->n);
+ assert(v != nil && v->elsz > 0 && n >= 0 && n < v->n);
memset((uchar *)v->p + n * v->elsz, 0, v->elsz);
+ if(n < v->firstempty)
+ v->firstempty = n;
}
/* assumes that zeroed element means empty; could fill with