From 941a1267bcbb341f7c8d2612bb54384f5f81dee3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 9 Mar 2021 11:35:18 +0900 Subject: [PATCH] [util] Fix a count error when resizing darrays Turns out I had never fully tested inserts. --- include/QF/darray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/QF/darray.h b/include/QF/darray.h index 0ea0a26d6..61500256a 100644 --- a/include/QF/darray.h +++ b/include/QF/darray.h @@ -253,7 +253,7 @@ } \ DARRAY_RESIZE (ar, ar->size + sp); \ memmove (&ar->a[po + sp], &ar->a[po], \ - (ar->size - po) * sizeof (*ar->a)); \ + (ar->size - po - sp) * sizeof (*ar->a)); \ &ar->a[po]; \ })