From 18449102e8098e6269ac7277aaffa40e35c0317c Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Sun, 8 Oct 2017 09:45:06 -0700 Subject: [PATCH] Parenthesize macro arguments in ALLOCATE_FLEX and ALLOCATE_ARRAY. Fix #457. --- src/vm/wren_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vm/wren_common.h b/src/vm/wren_common.h index c1b94f75..c3b5682c 100644 --- a/src/vm/wren_common.h +++ b/src/vm/wren_common.h @@ -121,11 +121,11 @@ // flexible array of [count] objects of [arrayType]. #define ALLOCATE_FLEX(vm, mainType, arrayType, count) \ ((mainType*)wrenReallocate(vm, NULL, 0, \ - sizeof(mainType) + sizeof(arrayType) * count)) + sizeof(mainType) + sizeof(arrayType) * (count))) // Use the VM's allocator to allocate an array of [count] elements of [type]. #define ALLOCATE_ARRAY(vm, type, count) \ - ((type*)wrenReallocate(vm, NULL, 0, sizeof(type) * count)) + ((type*)wrenReallocate(vm, NULL, 0, sizeof(type) * (count))) // Use the VM's allocator to free the previously allocated memory at [pointer]. #define DEALLOCATE(vm, pointer) wrenReallocate(vm, pointer, 0, 0)