caseproto: Fix calculation in caseproto_reserve().
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 4 Mar 2023 00:32:24 +0000 (16:32 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 4 Mar 2023 00:32:39 +0000 (16:32 -0800)
This reserved way too much in a lot of cases.

src/data/caseproto.c

index 4182004e4ac4a0f5ecd20653a8a7c8d6b10efb6d..f390c3f87cfd113ad1262504da30867181c60c8b 100644 (file)
@@ -86,7 +86,7 @@ caseproto_reserve (struct caseproto *proto, size_t n_widths)
   proto = caseproto_unshare (proto);
   if (n_widths > proto->allocated_widths)
     {
-      proto->allocated_widths *= MAX (proto->allocated_widths * 2, n_widths);
+      proto->allocated_widths = MAX (proto->allocated_widths * 2, n_widths);
       proto = xrealloc (proto, caseproto_size (proto->allocated_widths));
     }
   return proto;