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_list.h | |
| 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_list.h')
| -rw-r--r-- | teensy/teensy_list.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/teensy/teensy_list.h b/teensy/teensy_list.h index fb1a401..6265e6a 100644 --- a/teensy/teensy_list.h +++ b/teensy/teensy_list.h @@ -4,36 +4,36 @@ #include "teensy_common.h" #include "teensy_mem.h" -struct ty_list_header { +typedef struct { size_t cap; size_t len; -}; +} ty_List_Header; #define TY_LIST_MIN_CAP 8 #define TY_LIST_GROW_RATE 2 -#define ty_list_get_header(arr) ((struct ty_list_header*)arr - 1) +#define ty_list_get_header(arr) ((ty_List_Header*)arr - 1) #define ty_list_cap(arr) (ty_list_get_header(arr)->cap) #define ty_list_len(arr) (ty_list_get_header(arr)->len) -#define ty_list_reserve(arr, amt) \ - do { \ - struct ty_list_header *header = ty_list_get_header(arr); \ - if (amt > header->cap) { \ - header->cap = header->cap < TY_LIST_MIN_CAP \ - ? TY_LIST_MIN_CAP \ - : header->cap * TY_LIST_GROW_RATE; \ - header = ty_realloc( \ - header, \ - (sizeof(*(arr)) * amt) + sizeof(struct ty_list_header) \ - ); \ - (arr) = (void*)(header + 1); \ - } \ +#define ty_list_reserve(arr, amt) \ + do { \ + ty_List_Header *header = ty_list_get_header(arr); \ + if (amt > header->cap) { \ + header->cap = header->cap < TY_LIST_MIN_CAP \ + ? TY_LIST_MIN_CAP \ + : header->cap * TY_LIST_GROW_RATE; \ + header = ty_realloc( \ + header, \ + (sizeof(*(arr)) * amt) + sizeof(ty_List_Header) \ + ); \ + (arr) = (void*)(header + 1); \ + } \ } while (0) #define ty_list_append(arr, elem) \ do { \ - struct ty_list_header *header = ty_list_get_header(arr); \ + ty_List_Header *header = ty_list_get_header(arr); \ ty_list_reserve(arr, header->len + 1); \ (arr)[header->len++] = (elem); \ } while (0) |
