Update android/utils/ with misc. new features.
This introduces a few new features to android/utils/ that will
be used in later patches.
+ <android/utils/assert.h> to handle assertions
+ <android/utils/vector.h> to handle dynamic arrays
+ <android/utils/reflist.h> slightly updated (more docs)
+ <android/utils/refset.h> implements a set of pointers
Change-Id: Iebc14cfefd1c0e8aaecda9958a980d40f0be610a
diff --git a/android/utils/system.h b/android/utils/system.h
index 804aa7d..5053786 100644
--- a/android/utils/system.h
+++ b/android/utils/system.h
@@ -14,6 +14,12 @@
#include <string.h>
#include <stdint.h>
+#include "android/utils/assert.h"
+
+/* internal helpers */
+void* _android_array_alloc( size_t itemSize, size_t count );
+void* _android_array_alloc0( size_t itemSize, size_t count );
+void* _android_array_realloc( void* block, size_t itemSize, size_t count );
/* the following functions perform 'checked allocations', i.e.
* they abort if there is not enough memory.
@@ -42,10 +48,9 @@
#define AMEM_COPY(dst,src,size) memcpy((char*)(dst),(const char*)(src),(size_t)(size))
#define AMEM_MOVE(dst,src,size) memmove((char*)(dst),(const char*)(src),(size_t)(size))
-#define AARRAY_NEW(p,count) ((p) = android_alloc(sizeof(*p)*(count)))
-#define AARRAY_NEW0(p,count) ((p) = android_alloc0(sizeof(*p)*(count)))
-
-#define AARRAY_RENEW(p,count) ((p) = android_realloc((p),sizeof(*(p))*(count)))
+#define AARRAY_NEW(p,count) (AASSERT_LOC(), (p) = _android_array_alloc(sizeof(*p),(count)))
+#define AARRAY_NEW0(p,count) (AASSERT_LOC(), (p) = _android_array_alloc0(sizeof(*p),(count)))
+#define AARRAY_RENEW(p,count) (AASSERT_LOC(), (p) = _android_array_realloc((p),sizeof(*(p)),(count)))
#define AARRAY_COPY(dst,src,count) AMEM_COPY(dst,src,(count)*sizeof((dst)[0]))
#define AARRAY_MOVE(dst,src,count) AMEM_MOVE(dst,src,(count)*sizeof((dst)[0]))