magic -> integrity

This commit is contained in:
Eduardo Quezada 2025-12-30 11:25:03 -03:00
parent 22d5820e4a
commit a237516399
2 changed files with 4 additions and 4 deletions

View File

@ -7,13 +7,13 @@
static inline void String_Assert(const String *string) {
GF_ASSERT(string != NULL);
GF_ASSERT(string->magic == STR16_MAGIC);
GF_ASSERT(string->integrity == STR16_MAGIC);
}
String *String_New(u32 length, enum HeapID heapID) {
String *ret = Heap_Alloc(heapID, length * 2 + 10);
if (ret != NULL) {
ret->magic = STR16_MAGIC;
ret->integrity = STR16_MAGIC;
ret->maxSize = (u16)length;
ret->size = 0;
ret->data[0] = EOS;
@ -23,7 +23,7 @@ String *String_New(u32 length, enum HeapID heapID) {
void String_Free(String *string) {
String_Assert(string);
string->magic = STR16_MAGIC | 1;
string->integrity = STR16_MAGIC | 1;
Heap_Free(string);
}

View File

@ -7,7 +7,7 @@
typedef struct String {
u16 maxSize;
u16 size;
u32 magic;
u32 integrity;
u16 data[1];
u8 padding[2];
} String;