From e9aca43d89fa4ee5bb468717c59a66e351fc2ea7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 May 2025 13:49:52 +1000 Subject: [PATCH] Cleanup: use bool for comment variable in makesdna.cc Also assert the value is set as expected when entering/exiting comments. --- source/blender/makesdna/intern/makesdna.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/blender/makesdna/intern/makesdna.cc b/source/blender/makesdna/intern/makesdna.cc index 3b307544415..5b566054bce 100644 --- a/source/blender/makesdna/intern/makesdna.cc +++ b/source/blender/makesdna/intern/makesdna.cc @@ -576,13 +576,13 @@ static int preprocess_include(char *maindata, const int maindata_len) /* replace all enters/tabs/etc with spaces */ char *cp = temp; int a = maindata_len; - int comment = 0; + bool comment = false; while (a--) { if (cp[0] == '/' && cp[1] == '/') { - comment = 1; + comment = true; } else if (*cp == '\n') { - comment = 0; + comment = false; } if (comment || *cp < 32 || *cp > 128) { *cp = 32; @@ -598,17 +598,19 @@ static int preprocess_include(char *maindata, const int maindata_len) cp = temp; char *md = maindata; int newlen = 0; - comment = 0; + comment = false; a = maindata_len; bool skip_until_closing_brace = false; while (a--) { if (cp[0] == '/' && cp[1] == '*') { - comment = 1; + BLI_assert(comment == false); + comment = true; cp[0] = cp[1] = 32; } if (cp[0] == '*' && cp[1] == '/') { - comment = 0; + BLI_assert(comment == true); + comment = false; cp[0] = cp[1] = 32; }