diff options
author | David 'Digit' Turner <digit@android.com> | 2010-11-17 17:55:17 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2010-11-17 17:55:17 +0100 |
commit | 4c0f745dc80d392fddea23eb8d4d7d86425ce0c6 (patch) | |
tree | 5da693710d1a3e81a7af3590619c8cbc6c7942d8 /android/utils/system.h | |
parent | 44e750e6d0375543f0d91d0a68432ae9c8489ccd (diff) | |
download | external_qemu-4c0f745dc80d392fddea23eb8d4d7d86425ce0c6.zip external_qemu-4c0f745dc80d392fddea23eb8d4d7d86425ce0c6.tar.gz external_qemu-4c0f745dc80d392fddea23eb8d4d7d86425ce0c6.tar.bz2 |
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
Diffstat (limited to 'android/utils/system.h')
-rw-r--r-- | android/utils/system.h | 13 |
1 files changed, 9 insertions, 4 deletions
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 @@ void android_free( void* block ); #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])) |