diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-25 08:44:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-25 08:44:46 +0400 |
commit | 9e6d27bbf0afed29f3b31800d75c17ee68472a9c (patch) | |
tree | 84082a76c5c017b1c678d4af50f808ee1d277189 /source/blender/blenkernel/intern/customdata.c | |
parent | 69fa77d279f602641c965919a3071713cb4addb7 (diff) |
add BLI_STATIC_ASSERT macro.
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 0eacd78a72f..d8082902a44 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -65,6 +65,12 @@ /* number of layers to add when growing a CustomData object */ #define CUSTOMDATA_GROW 5 +/* ensure typemap size is ok */ +BLI_STATIC_ASSERT(sizeof(((CustomData *)NULL)->typemap) / + sizeof(((CustomData *)NULL)->typemap[0]) == CD_NUMTYPES, + "size mismatch"); + + /********************* Layer type information **********************/ typedef struct LayerTypeInfo { int size; /* the memory size of one element of this layer's data */ @@ -1221,9 +1227,6 @@ void CustomData_update_typemap(CustomData *data) { int i, lasttype = -1; - /* since we cant do in a pre-processor do here as an assert */ - BLI_assert(sizeof(data->typemap) / sizeof(int) >= CD_NUMTYPES); - for (i = 0; i < CD_NUMTYPES; i++) { data->typemap[i] = -1; } |