gpu: define EXPAND_ARRAY_IF_NEEDED macro once and make it function-like

This commit is contained in:
Anonymous Maarten
2024-12-08 18:08:36 +01:00
committed by Anonymous Maarten
parent 0370b92d80
commit fb71b44231
4 changed files with 22 additions and 28 deletions

View File

@@ -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