projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
713f73e
)
added makro to shrink an array by resetting the length
author
Götz Lindenmaier
<goetz@ipd.info.uni-karlsruhe.de>
Tue, 16 Nov 2004 10:16:27 +0000
(10:16 +0000)
committer
Götz Lindenmaier
<goetz@ipd.info.uni-karlsruhe.de>
Tue, 16 Nov 2004 10:16:27 +0000
(10:16 +0000)
[r4403]
ir/adt/array.h
patch
|
blob
|
history
diff --git
a/ir/adt/array.h
b/ir/adt/array.h
index
d42322e
..
7db99bd
100644
(file)
--- 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.
*