From 08d4a22121c657e9e69e0e991130fb8fae9c7677 Mon Sep 17 00:00:00 2001 From: "Taylor Robbins (Piggybank Studios)" Date: Mon, 24 Mar 2025 18:21:24 -0700 Subject: [PATCH] Fixed a bug in the CLAY macro that would cause an infinite loop if 256 for loops ended at the same time (i.e. without another for loop starting). This was caused by the CLAY__ELEMENT_DEFINITION_LATCH static uint8_t overflowing to 0 when incremented in the post-loop step which causes the loop to wrongfully run a second time --- clay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clay.h b/clay.h index 0fd4fe5..37d3c80 100644 --- a/clay.h +++ b/clay.h @@ -132,7 +132,7 @@ static uint8_t CLAY__ELEMENT_DEFINITION_LATCH; for ( \ CLAY__ELEMENT_DEFINITION_LATCH = (Clay__OpenElement(), Clay__ConfigureOpenElement(CLAY__CONFIG_WRAPPER(Clay_ElementDeclaration, __VA_ARGS__)), 0); \ CLAY__ELEMENT_DEFINITION_LATCH < 1; \ - ++CLAY__ELEMENT_DEFINITION_LATCH, Clay__CloseElement() \ + CLAY__ELEMENT_DEFINITION_LATCH=1, Clay__CloseElement() \ ) // These macros exist to allow the CLAY() macro to be called both with an inline struct definition, such as