diff options
| author | iamcheeseman <[email protected]> | 2026-05-12 16:41:37 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-05-12 16:41:37 -0400 |
| commit | 897a153d290ed4d3647ad9e0100d1b717f580b5f (patch) | |
| tree | 844dee0b3b2b7d869cd8e1ba27ffb403e8d51d99 /teensy/teensy_mem.c | |
| parent | c1dd3ce9850fb2906aa5937b4374d1c0fc74ccf7 (diff) | |
typedef all structs and rename to Ada_Case
There isn't really a technical reason that I made this change. I just
wanted to use Ada_Case. All types were prefixed with ty_, e.g. ty_Image.
Diffstat (limited to 'teensy/teensy_mem.c')
| -rw-r--r-- | teensy/teensy_mem.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/teensy/teensy_mem.c b/teensy/teensy_mem.c index 62088b8..7e8dd58 100644 --- a/teensy/teensy_mem.c +++ b/teensy/teensy_mem.c @@ -14,16 +14,16 @@ uint8_t *next_temp_alloc = temp_arena; #define BACKTRACE_SIZE 16 -struct alloc { +typedef struct { void *ptr; size_t size; int backtrace_len; char **backtrace; -}; +} Alloc; int allocations_cap; int allocations_len; -struct alloc *allocations; +Alloc *allocations; #endif // TODO TEENSY_DEBUG @@ -32,7 +32,7 @@ void ty_init_mem(void) #ifdef TEENSY_DEBUG allocations_len = 0; allocations_cap = 8; - allocations = malloc(sizeof(struct alloc) * 8); + allocations = malloc(sizeof(Alloc) * 8); if (!allocations) ty_log_fatal(TY_ERR_MEM, "(%s) (track) ran out of memory", __func__); #endif // TEENSY_DEBUG @@ -43,7 +43,7 @@ void ty_deinit_mem(void) #ifdef TEENSY_DEBUG fprintf(stderr, "%d allocations leaked\n", allocations_len); for (int i = 0; i < allocations_len; i++) { - struct alloc *alloc = &allocations[i]; + Alloc *alloc = &allocations[i]; fprintf( stderr, "leaked %zu bytes at %p\n", @@ -87,7 +87,7 @@ void *ty_alloc(size_t size) #ifdef TEENSY_DEBUG // Log allocation - struct alloc alloc; + Alloc alloc; void *bt[BACKTRACE_SIZE]; int bt_len = backtrace(bt, BACKTRACE_SIZE); char **symbols = backtrace_symbols(bt, bt_len); @@ -130,7 +130,7 @@ void *ty_realloc(void *ptr, size_t new_size) #ifdef TEENSY_DEBUG for (int i = 0; i < allocations_len; i++) { - struct alloc *alloc = &allocations[i]; + Alloc *alloc = &allocations[i]; if (alloc->ptr == ptr) { alloc->ptr = new_ptr; alloc->size = new_size; @@ -148,7 +148,7 @@ void ty_free(void *ptr) bool double_free = true; for (int i = 0; i < allocations_len; i++) { - struct alloc *alloc = &allocations[i]; + Alloc *alloc = &allocations[i]; if (alloc->ptr == ptr) { free(alloc->backtrace); *alloc = allocations[allocations_len - 1]; |
