diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-23 17:25:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-23 17:25:06 +0400 |
commit | f4b9e837414439ddc7055e112984687d97ef84da (patch) | |
tree | 6e98d56c9cfb1394113f071358d309915a5447ef /source/blender/blenlib | |
parent | 25a3d11260b20d340932bc88e0a1a3c66e6c2211 (diff) |
improve editmode triangulation by re-using the loop array when
possiblem, this has to guess when the size is too big so as to re-
well.
If this isnt done, then the number of faces is used to allocate the
initial array to at least avoid many small allocs.
added BLI_array_reserve() to reserve elements and avoid reallocing many
small arrays when the loop starts.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_array.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index bd14793e0f9..a5453f1537b 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -140,6 +140,10 @@ (&arr[_##arr##_count - 1]) \ ) +#define BLI_array_reserve(arr, num) \ + BLI_array_growitems(arr, num), (void)(_##arr##_count -= num) + + #define BLI_array_free(arr) \ if (arr && (char *)arr != _##arr##_static) { \ BLI_array_fake_user(arr); \ |