array: Remove the attribute eltsize from struct ir_arr_descr.
[libfirm] / ir / adt / array_t.h
index 778aeed..ba50874 100644 (file)
 /**
  * @file
  * @brief       Array --- dynamic & flexible arrays.
- * @version     $Id: array.c 17964 2008-03-05 09:48:51Z matze $
  */
 #ifndef FIRM_ADT_ARRAY_T_H
 #define FIRM_ADT_ARRAY_T_H
 
 #include "array.h"
+#include "fourcc.h"
 
-#define ARR_D_MAGIC    FOURCC('A','R','R','D')
-#define ARR_A_MAGIC    FOURCC('A','R','R','A')
-#define ARR_F_MAGIC    FOURCC('A','R','R','F')
+#define ARR_D_MAGIC FOURCC('A','R','R','D')
+#define ARR_A_MAGIC FOURCC('A','R','R','A')
+#define ARR_F_MAGIC FOURCC('A','R','R','F')
 
 #ifdef NDEBUG
-# define ARR_SET_DBGINF(descr, co, es)
+# define ARR_SET_DBGINF(descr, co)
 #else
-# define ARR_SET_DBGINF(descr, co, es)                                 \
-    ( (descr)->magic = (co), (descr)->eltsize = (es) )
+# define ARR_SET_DBGINF(descr, co) \
+    ((descr)->magic = (co))
 #endif
 
 /**
  * This macro creates a dynamic array on the functions stack of a given type at runtime.
  * The size of the array cannot be changed later.
  */
-#define NEW_ARR_A(type, var, n)                                                                        \
-  do {                                                                                         \
-    size_t nelts = (n);                                                                                \
-    (var) = (type *)((ir_arr_descr *)alloca(ARR_ELTS_OFFS + sizeof(type) * nelts))->v.elts;    \
-    ARR_SET_DBGINF(ARR_DESCR ((var)), ARR_A_MAGIC, sizeof (type));                             \
-    (void)(ARR_DESCR((var))->nelts = nelts);                                                   \
+#define NEW_ARR_A(type, var, n)                                    \
+  do {                                                             \
+    size_t nelts = (n);                                            \
+    (var) = (type *)((ir_arr_descr *)alloca(ARR_ELTS_OFFS + sizeof(type) * nelts))->elts; \
+    ARR_SET_DBGINF(ARR_DESCR ((var)), ARR_A_MAGIC); \
+    (void)(ARR_DESCR((var))->nelts = nelts);                       \
   } while (0)
 
 /**
@@ -71,7 +71,7 @@
  * @return A pointer to the dynamic array (can be used as a pointer to the
  *         first element of this array).
  */
-#define CLONE_ARR_A(type, var, arr)            \
+#define CLONE_ARR_A(type, var, arr)        \
   NEW_ARR_A(type, (var), ARR_LEN((arr)))
 
 /**
@@ -87,9 +87,9 @@
  * @return A pointer to the dynamic array (can be used as a pointer to the
  *         first element of this array).
  */
-#define DUP_ARR_A(type, var, arr)                                      \
-  do { CLONE_ARR_A(type, (var), (arr));                                        \
-       memcpy((var), (arr), sizeof (type) * ARR_LEN((arr))); } \
+#define DUP_ARR_A(type, var, arr)                               \
+  do { CLONE_ARR_A(type, (var), (arr));                         \
+       memcpy((var), (arr), sizeof (type) * ARR_LEN((arr))); }  \
   while (0)
 
 #endif