From 55fc452ebce1902eb2e405488fda20da6eb034ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Tue, 16 Nov 2004 10:16:27 +0000 Subject: [PATCH] added makro to shrink an array by resetting the length [r4403] --- ir/adt/array.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ir/adt/array.h b/ir/adt/array.h index d42322ec3..7db99bd7d 100644 --- a/ir/adt/array.h +++ b/ir/adt/array.h @@ -230,6 +230,12 @@ #define ARR_SETLEN(type, arr, n) \ (XMALLOC_TRACE (arr) = _arr_setlen ((arr), (n), sizeof(type) * (n))) +/** Set a length smaller than the current length of the array. Do not + * resize. len must be <= ARR_LEN(arr). */ +#define ARR_SHRINKLEN(arr,len) \ + (ARR_VRFY ((arr)), assert(_ARR_DESCR((arr))->nelts >= len), \ + _ARR_DESCR((arr))->nelts = len) + /** * Resize a flexible array by growing it by delta elements. * -- 2.20.1