From 6c616ff6562599950fd6164bf2e678ff1b9c7975 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 9fbdf88..8326fbd 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