From: Götz Lindenmaier Date: Tue, 16 Nov 2004 10:16:27 +0000 (+0000) Subject: added makro to shrink an array by resetting the length X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=55fc452ebce1902eb2e405488fda20da6eb034ce;p=libfirm added makro to shrink an array by resetting the length [r4403] --- 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. *