Comments
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
// Repurpose free memory to eep a linked list of free slots
|
//Free memory is reused to build a linked list of slots
|
||||||
typedef struct UCSlot UCSlot;
|
typedef struct UCSlot UCSlot;
|
||||||
struct UCSlot {
|
struct UCSlot {
|
||||||
UCSlot *next;
|
UCSlot *next;
|
||||||
@@ -66,6 +66,9 @@ static inline void *uc_slot_alloc(UCSlotArena *arena)
|
|||||||
if (slot != NULL) {
|
if (slot != NULL) {
|
||||||
arena->free_list = slot->next;
|
arena->free_list = slot->next;
|
||||||
arena->used_slots++;
|
arena->used_slots++;
|
||||||
|
#ifdef DEBUG
|
||||||
|
memset(slot, 0xCB, arena->slot_size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return slot;
|
return slot;
|
||||||
|
|||||||
Reference in New Issue
Block a user