mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-23 03:28:30 +00:00
gpu: define EXPAND_ARRAY_IF_NEEDED macro once and make it function-like
This commit is contained in:

committed by
Anonymous Maarten

parent
0370b92d80
commit
fb71b44231
@@ -391,12 +391,14 @@ static inline Uint32 BytesPerRow(
|
||||
// Internal Macros
|
||||
|
||||
#define EXPAND_ARRAY_IF_NEEDED(arr, elementType, newCount, capacity, newCapacity) \
|
||||
if (newCount >= capacity) { \
|
||||
capacity = newCapacity; \
|
||||
arr = (elementType *)SDL_realloc( \
|
||||
arr, \
|
||||
sizeof(elementType) * capacity); \
|
||||
}
|
||||
do { \
|
||||
if ((newCount) >= (capacity)) { \
|
||||
(capacity) = (newCapacity); \
|
||||
(arr) = (elementType *)SDL_realloc( \
|
||||
(arr), \
|
||||
sizeof(elementType) * (capacity)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Internal Declarations
|
||||
|
||||
|
Reference in New Issue
Block a user