mirror of
https://github.com/nicbarker/clay.git
synced 2025-01-23 18:06:04 +00:00
13 lines
520 B
C
13 lines
520 B
C
void $NAME$_Set($NAME$ *array, int index, $TYPE$ value) {
|
|
if (index < array->capacity && index >= 0) {
|
|
array->internalArray[index] = value;
|
|
array->length = index < array->length ? array->length : index + 1;
|
|
} else {
|
|
if (Clay__warningsEnabled) {
|
|
Clay__WarningArray_Add(&Clay_warnings, (Clay__Warning) { CLAY_STRING("Attempting to allocate array in arena, but arena is already at capacity and would overflow.") });
|
|
}
|
|
#ifdef CLAY_OVERFLOW_TRAP
|
|
raise(SIGTRAP);
|
|
#endif
|
|
}
|
|
} |