#include <stdlib.h>
#include "array_t.h"
+#include "util.h"
#include "xmalloc.h"
/* Undefine the macros to get the functions instead, cf tmalloc.c. */
#undef xstrdup
#undef xfree
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a,b) ((a) > (b) ? (b) : (a))
-#endif
-
/**
* An empty dynamic array descriptor.
*/
-ir_arr_descr arr_mt_descr = { ARR_D_MAGIC, 0, 0, 0, { { 0 } } };
+ir_arr_descr arr_mt_descr = { ARR_D_MAGIC, 0, 0, { { 0 } } };
void ir_verify_arr(const void *arr)
{
assert(obstack);
dp = (ir_arr_descr*)obstack_alloc(obstack, ARR_ELTS_OFFS + elts_size);
- ARR_SET_DBGINF(dp, ARR_D_MAGIC, elts_size/nelts);
+ ARR_SET_DBGINF(dp, ARR_D_MAGIC);
dp->allocated = dp->nelts = nelts;
return dp->elts;
}
ir_arr_descr *newa;
newa = (ir_arr_descr*)xmalloc(ARR_ELTS_OFFS+elts_size);
- ARR_SET_DBGINF(newa, ARR_F_MAGIC, nelts ? elts_size/nelts : 0);
+ ARR_SET_DBGINF(newa, ARR_F_MAGIC);
newa->allocated = newa->nelts = nelts;
return newa->elts;
}
assert(dp->magic == ARR_F_MAGIC);
ARR_VRFY(elts);
- assert(!dp->eltsize || !nelts || (dp->eltsize == elts_size/nelts));
dp = (ir_arr_descr*) xrealloc(dp, ARR_ELTS_OFFS+elts_size);
dp->allocated = dp->nelts = nelts;
assert(dp->magic == ARR_F_MAGIC);
ARR_VRFY(elts);
- assert(dp->eltsize ? dp->eltsize == eltsize : (dp->eltsize = eltsize, 1));
/* @@@ lots of resizes for small nelts */
n = MAX(1, dp->allocated);