Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object handling #1045

Merged
merged 16 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions camlibs/ptp2/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@
* #define for_each(PTR, ARRAY) for (typeof(ARRAY.val) PTR = ARRAY.val; PTR != ARRAY.val + ARRAY.len; ++PTR)
*/
#define for_each(TYPE, PTR, ARRAY) \
for (TYPE PTR = ARRAY.val; PTR < ARRAY.val + ARRAY.len; ++PTR)
for (TYPE PTR = (ARRAY).val; PTR < (ARRAY).val + (ARRAY).len; ++PTR)

#define array_init(ARRAY) do { \
(ARRAY)->val = 0; \
(ARRAY)->len = 0; \
} while (0)

#define free_array(ARRAY) do { \
free ((ARRAY)->val); \
Expand Down Expand Up @@ -87,7 +92,7 @@

#define array_push_back(ARRAY, VAL) do { \
array_extend_capacity(ARRAY, 1); \
move((ARRAY)->val[(ARRAY)->len++], VAL); \
(ARRAY)->val[(ARRAY)->len++] = VAL; \
} while(0)

#define array_append_copy(DST, SRC) do { \
Expand Down
Loading
Loading