Mercurial > ~dholland > hg > tradcpp > index.cgi
changeset 74:bbbf71859a21
fix stupid bugs
author | David A. Holland |
---|---|
date | Mon, 10 Jun 2013 18:49:36 -0400 |
parents | d122b4553150 |
children | 980ed7cb620a |
files | macro.c |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/macro.c Mon Jun 10 18:40:26 2013 -0400 +++ b/macro.c Mon Jun 10 18:49:36 2013 -0400 @@ -355,12 +355,16 @@ assert(hashmask == numbuckets - 1); newmask = (hashmask << 1) | 1U; - tossbit = newmask && ~hashmask; + tossbit = newmask & ~hashmask; hashmask = newmask; for (i=0; i<numbuckets; i++) { newbucket = NULL; oldbucket = macroarrayarray_get(¯os, i); + if (oldbucket == NULL) { + macroarrayarray_set(¯os, numbuckets + i, NULL); + continue; + } oldnum = macroarray_num(oldbucket); for (j=0; j<oldnum; j++) { m = macroarray_get(oldbucket, j); @@ -374,8 +378,11 @@ } for (j=k=0; j<oldnum; j++) { m = macroarray_get(oldbucket, j); - if (m != NULL && k < j) { - macroarray_set(oldbucket, k++, m); + if (m != NULL) { + if (k < j) { + macroarray_set(oldbucket, k, m); + } + k++; } } macroarray_setsize(oldbucket, k);