diff options
author | Bad Diode <bd@badd10de.dev> | 2024-06-18 08:53:34 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2024-06-18 08:53:34 +0200 |
commit | f392b0818e651ece33cec091eac0639883a126ec (patch) | |
tree | 94b8409b940d16004bb49438c528ef49fb17e28e /src/badlib.h | |
parent | c581804c6ffa5824a9b762097a990425007e49cf (diff) | |
download | bdl-f392b0818e651ece33cec091eac0639883a126ec.tar.gz bdl-f392b0818e651ece33cec091eac0639883a126ec.zip |
Add let, set and struct definitions
Diffstat (limited to 'src/badlib.h')
-rw-r--r-- | src/badlib.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/badlib.h b/src/badlib.h index 6432562..25bb92b 100644 --- a/src/badlib.h +++ b/src/badlib.h | |||
@@ -930,7 +930,8 @@ typedef struct ArrayHeader { | |||
930 | (ARR)[array_head(ARR)->size++] = (T)) | 930 | (ARR)[array_head(ARR)->size++] = (T)) |
931 | 931 | ||
932 | // Return the last element of the array. Can be used to build stacks. | 932 | // Return the last element of the array. Can be used to build stacks. |
933 | #define array_pop(ARR) (ARR)[--array_head(ARR)->size] | 933 | #define array_pop(ARR) \ |
934 | ((ARR) && array_size(ARR) ? (ARR)[--array_head(ARR)->size] : NULL) | ||
934 | 935 | ||
935 | // Return the value stored at the OFFSET position from the tail of the array. | 936 | // Return the value stored at the OFFSET position from the tail of the array. |
936 | #define array_peek(ARR, OFFSET) (ARR)[array_head(ARR)->size - 1 - (OFFSET)] | 937 | #define array_peek(ARR, OFFSET) (ARR)[array_head(ARR)->size - 1 - (OFFSET)] |