Skip to content

Commit 08fef51

Browse files
committed
feat(RDScratchBuffer): added rd_scratch_each macro
1 parent 3cccdd0 commit 08fef51

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎include/redasm/support/scratch.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ RD_API const char* rd_scratch_data(const RDScratchBuffer* self);
2121
RD_API usize rd_scratch_length(const RDScratchBuffer* self);
2222
RD_API usize rd_scratch_capacity(const RDScratchBuffer* self);
2323
// clang-format on
24+
25+
#define rd_scratch_each(it, self) \
26+
for((it) = rd_scratch_data(self); \
27+
rd_scratch_data(self) && \
28+
((it) < rd_scratch_data(self) + rd_scratch_length(self)); \
29+
(it)++)

0 commit comments

Comments
 (0)