changeset 735:31bc1ed07cf5

Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Dec 2022 12:14:39 +0200
parents 2ae1045f6c18
children ca837a4417f5
files Makefile Makefile.cross-mingw tests.c th_args.c th_args.h th_config.c th_config.h th_datastruct.c th_datastruct.h th_file.c th_file.h th_ioctx.c th_ioctx.h th_ioctx_mem.c th_ioctx_stdio.c th_network.c th_network.h th_printf.c th_printf1.c th_regex.c th_strglob.c th_string.c th_string.h th_types.h th_util.c
diffstat 25 files changed, 422 insertions(+), 422 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Dec 07 11:58:54 2022 +0200
+++ b/Makefile	Wed Dec 07 12:14:39 2022 +0200
@@ -14,6 +14,7 @@
 LDFLAGS +=
 
 CFLAGS += -DHAVE_STRING_H
+CFLAGS += -DHAVE_STDBOOL_H
 CFLAGS += -DHAVE_INTTYPES_H
 #CFLAGS += -DHAVE_SYS_TYPES_H
 
--- a/Makefile.cross-mingw	Wed Dec 07 11:58:54 2022 +0200
+++ b/Makefile.cross-mingw	Wed Dec 07 12:14:39 2022 +0200
@@ -36,8 +36,8 @@
 CFLAGS += \
 	-mconsole \
 	-DTH_BYTEORDER=TH_LITTLE_ENDIAN \
-	-D_NO_BOOL_TYPEDEF \
 	-DHAVE_STRING_H \
+	-DHAVE_STDBOOL_H \
 	-DHAVE_INTTYPES_H
 
 LDFLAGS +=
--- a/tests.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/tests.c	Wed Dec 07 12:14:39 2022 +0200
@@ -30,7 +30,7 @@
 typedef struct
 {
     char *header;
-    BOOL
+    bool
         shown,	// Has test result value been shown?
         failed;	// Did the test fail? (used by some tests to show extra info)
 } test_ctx;
@@ -65,21 +65,21 @@
 static const int arg_nopts = sizeof(arg_opts) / sizeof(arg_opts[0]);
 
 
-BOOL tprintv(const int level, const char *fmt, va_list ap)
+bool tprintv(const int level, const char *fmt, va_list ap)
 {
     if (level <= th_verbosity)
     {
         vfprintf(stdout, fmt, ap);
-        return TRUE;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
 
-BOOL tprint(const int level, const char *fmt, ...)
+bool tprint(const int level, const char *fmt, ...)
 {
-    BOOL retv;
+    bool retv;
     va_list ap;
     va_start(ap, fmt);
     retv = tprintv(level, fmt, ap);
@@ -95,7 +95,7 @@
 }
 
 
-BOOL arg_handle_opt(const int optN, char *optArg, char *currArg)
+bool arg_handle_opt(const int optN, char *optArg, char *currArg)
 {
     switch (optN)
     {
@@ -110,7 +110,7 @@
 
     case 2:
         {
-            BOOL ret = TRUE;
+            bool ret = true;
             char *pos, *pstr, *next;
             pos = pstr = th_strdup(optArg);
             memset(sets_enabled, 0, sizeof(sets_enabled));
@@ -128,7 +128,7 @@
                     else
                     {
                         THERR("Invalid test number #%d, out of range [%d .. %d]\n", val, 1, SET_MAX_TESTS);
-                        ret = FALSE;
+                        ret = false;
                     }
                     th_free(tmp);
                 }
@@ -147,10 +147,10 @@
 
     default:
         THERR("Unknown option '%s'.\n", currArg);
-        return FALSE;
+        return false;
     }
 
-    return TRUE;
+    return true;
 }
 
 
@@ -177,19 +177,19 @@
 }
 
 
-void test_result_msg_v(test_ctx *ctx, BOOL check, const char *fmt, va_list ap)
+void test_result_msg_v(test_ctx *ctx, bool check, const char *fmt, va_list ap)
 {
     if (check)
     {
         if (!ctx->shown && tprint(2, "%s: OK\n", ctx->header))
-            ctx->shown = TRUE;
+            ctx->shown = true;
 
         tests_passed++;
     }
     else
     {
         if (!ctx->shown && tprint(0, "%s: FAIL\n", ctx->header))
-            ctx->shown = TRUE;
+            ctx->shown = true;
 
         if (fmt != NULL)
         {
@@ -199,12 +199,12 @@
         }
         tests_failed++;
 
-        ctx->failed = TRUE;
+        ctx->failed = true;
     }
 }
 
 
-BOOL test_result_msg(test_ctx *ctx, BOOL check, const char *fmt, ...)
+bool test_result_msg(test_ctx *ctx, bool check, const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -214,7 +214,7 @@
 }
 
 
-BOOL test_result(test_ctx *ctx, BOOL check)
+bool test_result(test_ctx *ctx, bool check)
 {
     test_result_msg_v(ctx, check, NULL, NULL);
     return check;
@@ -251,7 +251,7 @@
 
     if (ctx.failed && !th_printf_debug && th_verbosity >= 1)
     {
-        th_printf_debug = TRUE;
+        th_printf_debug = true;
         va_copy(tmp, ap); ret1 = th_vsnprintf(buf1, len, fmt, tmp);
         va_copy(tmp, ap); ret2 = vsnprintf(buf2, len, fmt, tmp);
     }
@@ -293,7 +293,7 @@
 }
 
 
-BOOL test_set_start(const char *str)
+bool test_set_start(const char *str)
 {
     if (sets_enabled[sets_total++])
     {
@@ -304,10 +304,10 @@
             "======================================================\n",
             sets_total, str);
 
-        return TRUE;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
 
@@ -498,7 +498,7 @@
     char *v_str1 = NULL;
     unsigned int v_uint1;
     int v_int1;
-    BOOL v_bool1, v_bool2;
+    bool v_bool1, v_bool2;
     th_llist_t *v_str_list = NULL;
 
     // Create v_str_list
@@ -515,7 +515,7 @@
     th_cfg_add_hexvalue(&sect1, "hexval", &v_uint1, 0x11223344);
 
     th_cfg_add_comment(&sect1, "A boolean value");
-    th_cfg_add_bool(&sect1, "boolval", &v_bool1, FALSE);
+    th_cfg_add_bool(&sect1, "boolval", &v_bool1, false);
 
     th_cfg_add_comment(&sect1, "A string list");
     th_cfg_add_string_list(&sect1, "string_list", &v_str_list);
@@ -524,7 +524,7 @@
 
     sect1 = NULL;
     th_cfg_add_comment(&sect1, "Another section");
-    th_cfg_add_bool(&sect1, "boolval", &v_bool2, TRUE);
+    th_cfg_add_bool(&sect1, "boolval", &v_bool2, true);
 
     sect2 = NULL;
     th_cfg_add_comment(&sect2, "Section inside a section");
@@ -591,10 +591,10 @@
 } test_regex_def2;
 
 
-BOOL test_regex_list_matches(const th_char_t *str,
+bool test_regex_list_matches(const th_char_t *str,
     const th_regex_match_t *matches,
     const th_char_t * const *expected,
-    const BOOL testOnly)
+    const bool testOnly)
 {
     size_t nmatch = 0;
     char *match = NULL;
@@ -618,7 +618,7 @@
         }
         else
         {
-            BOOL seqMatch = strcmp(match, expected[nmatch]) == 0;
+            bool seqMatch = strcmp(match, expected[nmatch]) == 0;
             if (testOnly && !seqMatch)
                 goto error;
 
@@ -636,11 +636,11 @@
         th_free(match);
     }
 
-    return TRUE;
+    return true;
 
 error:
     th_free(match);
-    return FALSE;
+    return false;
 }
 
 
@@ -667,7 +667,7 @@
     for (const test_regex_def1 *def = list; def->str != NULL; def++)
     {
         size_t nmatches;
-        BOOL matchOK;
+        bool matchOK;
 
         tprint(3, "\n----------------------------------------\n");
         if ((res = th_regex_match(expr, def->str,
@@ -679,7 +679,7 @@
             goto out;
         }
 
-        matchOK = test_regex_list_matches(def->str, matches, def->expected, TRUE);
+        matchOK = test_regex_list_matches(def->str, matches, def->expected, true);
         if (th_verbosity < 1 && !matchOK)
         {
             tprint(0,
@@ -703,7 +703,7 @@
         }
 #endif
 
-        test_regex_list_matches(def->str, matches, def->expected, FALSE);
+        test_regex_list_matches(def->str, matches, def->expected, false);
 
         th_regex_free_matches(matches);
         matches = NULL;
@@ -749,7 +749,7 @@
             def->pattern, def->str,
             nmatches);
 
-        test_regex_list_matches(def->str, matches, def->expected, FALSE);
+        test_regex_list_matches(def->str, matches, def->expected, false);
 
 out:
         th_regex_free_matches(matches);
@@ -931,50 +931,52 @@
     //
     if (test_set_start("String compare #1"))
     {
-        TEST2(th_strcasecmp, "aSdFq", "asdfq", TRUE);
-        TEST2(th_strcasecmp, "aSdFq", "asFfq", FALSE);
-        TEST2(th_strcasecmp, "abcde", "abcde", TRUE);
-        TEST2(th_strcasecmp, "öäå", "öäå", TRUE);
-        TEST2(th_strcasecmp, "aöäå", "aöäå", TRUE);
+        TEST2(th_strcasecmp, "aSdFq", "asdfq", true);
+        TEST2(th_strcasecmp, "aSdFq", "asFfq", false);
+        TEST2(th_strcasecmp, "abcde", "abcde", true);
+        TEST2(th_strcasecmp, "öäå", "öäå", true);
+        TEST2(th_strcasecmp, "aöäå", "aöäå", true);
     }
 
     if (test_set_start("String compare #2"))
     {
-        TEST3(th_strncasecmp, "aSdFq", "asFfqB", 4, FALSE);
-        TEST3(th_strncasecmp, "aSdFq", "asFfqQ", 2, TRUE);
-        TEST3(th_strncasecmp, "aSdFq", "asDfq", 3, TRUE);
-        TEST3(th_strncasecmp, "aSdFq", "asDfq", 2, TRUE);
-        TEST3(th_strncasecmp, "aSdFq", "asDfq", 0, TRUE);
-        TEST3(th_strncasecmp, "aSdFq", "QsDfq", 0, TRUE);
-        TEST3(th_strncasecmp, "aSdFq", "QsDfq", 1, FALSE);
+        TEST3(th_strncasecmp, "aSdFq", "asFfqB", 4, false);
+        TEST3(th_strncasecmp, "aSdFq", "asFfqQ", 2, true);
+        TEST3(th_strncasecmp, "aSdFq", "asDfq", 3, true);
+        TEST3(th_strncasecmp, "aSdFq", "asDfq", 2, true);
+        TEST3(th_strncasecmp, "aSdFq", "asDfq", 0, true);
+        TEST3(th_strncasecmp, "aSdFq", "QsDfq", 0, true);
+        TEST3(th_strncasecmp, "aSdFq", "QsDfq", 1, false);
+        TEST3(th_strncasecmp, "max=", "max=4", 4, true);
+        TEST3(th_strncasecmp, "max=", "max", 4, false);
     }
 
     if (test_set_start("String compare #3"))
     {
-        TEST2C(th_strrcasecmp, "foo aSdFq", " asdfq", TRUE);
-        TEST2C(th_strrcasecmp, "aSdFq", " asdfq", FALSE);
-        TEST2C(th_strrcasecmp, "foo aSdFq baz", "asdfq", FALSE);
+        TEST2C(th_strrcasecmp, "foo aSdFq", " asdfq", true);
+        TEST2C(th_strrcasecmp, "aSdFq", " asdfq", false);
+        TEST2C(th_strrcasecmp, "foo aSdFq baz", "asdfq", false);
     }
 
     if (test_set_start("String matching #1"))
     {
-        TEST2B(th_strmatch, "abba ABBAkukka lol", "*lol", TRUE);
-        TEST2B(th_strmatch, "abba ABBAkukka lol", "*lo*", TRUE);
-        TEST2B(th_strmatch, "abba ABBAkukka lol", "*lo", FALSE);
-        TEST2B(th_strmatch, "abba ABBAkukka lol", "abba", FALSE);
-        TEST2B(th_strmatch, "abba ABBAkukka lol", "*bba*", TRUE);
-        TEST2B(th_strmatch, "abba ABBAkukka lol", "abba*", TRUE);
-        TEST2B(th_strmatch, "abba ABBAkukka lol", "abbak*", FALSE);
-        TEST2B(th_strmatch, "abba ABBAöökukka lol", "*abbaö?", FALSE);
+        TEST2B(th_strmatch, "abba ABBAkukka lol", "*lol", true);
+        TEST2B(th_strmatch, "abba ABBAkukka lol", "*lo*", true);
+        TEST2B(th_strmatch, "abba ABBAkukka lol", "*lo", false);
+        TEST2B(th_strmatch, "abba ABBAkukka lol", "abba", false);
+        TEST2B(th_strmatch, "abba ABBAkukka lol", "*bba*", true);
+        TEST2B(th_strmatch, "abba ABBAkukka lol", "abba*", true);
+        TEST2B(th_strmatch, "abba ABBAkukka lol", "abbak*", false);
+        TEST2B(th_strmatch, "abba ABBAöökukka lol", "*abbaö?", false);
     }
 
     if (test_set_start("String matching #2"))
     {
-        TEST2B(th_strcasematch, "abba ABBAkukka lol", "abbak*", FALSE);
-        TEST2B(th_strcasematch, "abba ABBAkukka lol", "*abbak*", TRUE);
-        TEST2B(th_strcasematch, "abba ABBAkukka lol", "*ab?ak*", TRUE);
-        TEST2B(th_strcasematch, "abba ABBAkukka lol", "*abbak?", FALSE);
-        TEST2B(th_strcasematch, "abba ABBAkukka lol", "?bba?abba*", TRUE);
+        TEST2B(th_strcasematch, "abba ABBAkukka lol", "abbak*", false);
+        TEST2B(th_strcasematch, "abba ABBAkukka lol", "*abbak*", true);
+        TEST2B(th_strcasematch, "abba ABBAkukka lol", "*ab?ak*", true);
+        TEST2B(th_strcasematch, "abba ABBAkukka lol", "*abbak?", false);
+        TEST2B(th_strcasematch, "abba ABBAkukka lol", "?bba?abba*", true);
     }
 
     // Tests that test for things that do not work correctly yet
@@ -982,9 +984,9 @@
     if ((optFlags & TST_BROKEN) &&
         test_set_start("Invalid UTF-8 handling"))
     {
-        TEST2(th_strcasecmp, "ÖÄÅ", "öäå", FALSE); // SHOULD match
-        TEST3(th_strncasecmp, "Aäöå", "aöå", 2, TRUE); // should NOT match
-        TEST2B(th_strmatch, "öriÖRI! lol", "?ri?RI!*", FALSE); // should match
+        TEST2(th_strcasecmp, "ÖÄÅ", "öäå", false); // SHOULD match
+        TEST3(th_strncasecmp, "Aäöå", "aöå", 2, true); // should NOT match
+        TEST2B(th_strmatch, "öriÖRI! lol", "?ri?RI!*", false); // should match
     }
 
     //
@@ -1006,15 +1008,15 @@
 
         snprintf(tmp, sizeof(tmp), "%16" PRIx_SIZE_T "h", usiz);
 #if TH_ARCH == 32
-        TEST2(strcmp, tmp, "0000000011223344h", TRUE);
+        TEST2(strcmp, tmp, "0000000011223344h", true);
 #else
-        TEST2(strcmp, tmp, "aabbccdd11223344h", TRUE);
+        TEST2(strcmp, tmp, "aabbccdd11223344h", true);
 #endif
 
         snprintf(tmp, sizeof(tmp), "%08" PRIx32 "h", u32);
-        TEST2(strcmp, tmp, "aabbccddh", TRUE);
+        TEST2(strcmp, tmp, "aabbccddh", true);
         snprintf(tmp, sizeof(tmp), "%16" PRIx64 "h", u64);
-        TEST2(strcmp, tmp, "aabbccdd11223344h", TRUE);
+        TEST2(strcmp, tmp, "aabbccdd11223344h", true);
     }
 
     //
@@ -1032,11 +1034,11 @@
     {
         unsigned int tmpUint;
 
-        TEST1(th_get_hex_triplet("0fac11", &tmpUint) == TRUE);
+        TEST1(th_get_hex_triplet("0fac11", &tmpUint) == true);
         TEST1A("0x%06x", tmpUint, ==, 0x0fac11);
-        TEST1(th_get_hex_triplet("120fac11", &tmpUint) == TRUE);
+        TEST1(th_get_hex_triplet("120fac11", &tmpUint) == true);
         TEST1A("0x%06x", tmpUint, ==, 0x120fac11);
-        TEST1(th_get_hex_triplet("x120fac11", &tmpUint) == FALSE);
+        TEST1(th_get_hex_triplet("x120fac11", &tmpUint) == false);
     }
 
     //
--- a/th_args.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_args.c	Wed Dec 07 12:14:39 2022 +0200
@@ -19,16 +19,16 @@
  * @param[in] opts options list array
  * @param[in] nopts number of elements in options list array
  * @param[in] handle_option function pointer to callback that handles option arguments
- * @param[in] process if TRUE, actually handle the argument, aka call the handle_option() function. if FALSE, only validity of options are checked.
- * @param[in] isLong TRUE if the option is a --long-format one
- * @returns returns @c TRUE if option processing was successful
+ * @param[in] process if true, actually handle the argument, aka call the handle_option() function. if false, only validity of options are checked.
+ * @param[in] isLong true if the option is a --long-format one
+ * @returns returns @c true if option processing was successful
  */
-static BOOL th_args_process_opt(
+static bool th_args_process_opt(
     char *currArg, int *argIndex,
     int argc, char *argv[],
     const th_optarg opts[], int nopts,
-    BOOL (*handle_option)(int id, char *, char *),
-    BOOL process, BOOL isLong)
+    bool (*handle_option)(int id, char *, char *),
+    bool process, bool isLong)
 {
     const th_optarg *opt = NULL;
     char *optArg = NULL;
@@ -81,13 +81,13 @@
                 THERR("Option '%s%s' requires an argument.\n",
                     isLong ? "--" : "-",
                     currArg);
-                return FALSE;
+                return false;
             }
         }
 
         // Option was given succesfully, try to process it
         if (process && !handle_option(opt->id, optArg, currArg))
-            return FALSE;
+            return false;
     }
     else
     {
@@ -96,10 +96,10 @@
             isLong ? "--" : "-",
             currArg);
 
-        return FALSE;
+        return false;
     }
 
-    return TRUE;
+    return true;
 }
 
 
@@ -114,15 +114,15 @@
  * @param[in] handle_option callback function
  * @param[in] handle_other callback function
  * @param[in] flags processing flags
- * @return returns @c TRUE if arguments were processed successfully
+ * @return returns @c true if arguments were processed successfully
  */
-BOOL th_args_process(int argc, char *argv[],
+bool th_args_process(int argc, char *argv[],
      const th_optarg *opts, const int nopts,
-     BOOL(*handle_option)(int id, char *, char *),
-     BOOL(*handle_other)(char *), const int flags)
+     bool(*handle_option)(int id, char *, char *),
+     bool(*handle_other)(char *), const int flags)
 {
     int handleFlags = flags & OPTH_ONLY_MASK;
-    BOOL optionsOK = TRUE, endOfOptions = FALSE;
+    bool optionsOK = true, endOfOptions = false;
 
     for (int argIndex = 1; argIndex < argc; argIndex++)
     {
@@ -130,8 +130,8 @@
         if (*str == '-' && !endOfOptions)
         {
             // Should we process options?
-            BOOL process = (handleFlags & OPTH_ONLY_OPTS) || handleFlags == 0;
-            BOOL isLong;
+            bool process = (handleFlags & OPTH_ONLY_OPTS) || handleFlags == 0;
+            bool isLong;
 
             str++;
             if (*str == '-')
@@ -140,19 +140,19 @@
                 str++;
                 if (*str == 0)
                 {
-                    endOfOptions = TRUE;
+                    endOfOptions = true;
                     continue;
                 }
 
                 // We have a long option
-                isLong = TRUE;
+                isLong = true;
             }
             else
-                isLong = FALSE;
+                isLong = false;
 
             if (!th_args_process_opt(str, &argIndex, argc, argv,
                 opts, nopts, handle_option, process, isLong))
-                optionsOK = FALSE;
+                optionsOK = false;
         }
         else
         if (handleFlags == OPTH_ONLY_OTHER || handleFlags == 0)
@@ -161,13 +161,13 @@
             if (handle_other == NULL ||
                 (handle_other != NULL && !handle_other(str)))
             {
-                optionsOK = FALSE;
+                optionsOK = false;
             }
         }
 
         // Check if we bail out on invalid argument
         if (!optionsOK && (flags & OPTH_BAILOUT))
-            return FALSE;
+            return false;
     }
 
     return optionsOK;
@@ -194,14 +194,14 @@
     const int width, const char *str)
 {
     size_t pos = 0;
-    BOOL first = TRUE;
+    bool first = true;
 
     while (str[pos])
     {
         // Pre-pad line
         int linelen = first ? spad : rpad;
         th_print_pad(fh, first ? 0 : rpad, ' ');
-        first = FALSE;
+        first = false;
 
         // Skip whitespace at line start
         while (th_isspace(str[pos]) || str[pos] == '\n')
@@ -255,12 +255,12 @@
 
 static void th_args_help_print_item(FILE *fh, const th_optarg *opt,
     int *optWidth, const int maxOptWidth, const int termWidth,
-    const BOOL doPrint)
+    const bool doPrint)
 {
     const char *arg = th_args_get_optarg(opt);
     char fmtBuf[32];
     int padWidth;
-    BOOL hasLongOpt = opt->o_long != NULL;
+    bool hasLongOpt = opt->o_long != NULL;
 
     if (opt->o_short != 0)
     {
@@ -347,7 +347,7 @@
     for (index = 0; index < nopts; index++)
     {
         int optWidth = 0;
-        th_args_help_print_item(NULL, &opts[index], &optWidth, 0, width, FALSE);
+        th_args_help_print_item(NULL, &opts[index], &optWidth, 0, width, false);
         if (optWidth > maxOptWidth)
             maxOptWidth = optWidth;
     }
@@ -358,6 +358,6 @@
     for (index = 0; index < nopts; index++)
     {
         int optWidth;
-        th_args_help_print_item(fh, &opts[index], &optWidth, maxOptWidth, width, TRUE);
+        th_args_help_print_item(fh, &opts[index], &optWidth, maxOptWidth, width, true);
     }
 }
--- a/th_args.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_args.h	Wed Dec 07 12:14:39 2022 +0200
@@ -45,10 +45,10 @@
 } th_optarg;
 
 
-BOOL     th_args_process(int argc, char *argv[],
+bool     th_args_process(int argc, char *argv[],
          const th_optarg *opts, const int nopts,
-         BOOL (*handle_option)(int id, char *, char *),
-         BOOL (*handle_other)(char *), const int flags);
+         bool (*handle_option)(int id, char *, char *),
+         bool (*handle_other)(char *), const int flags);
 
 void     th_args_help(FILE *fh, const th_optarg *opts,
          const int nopts, const int flags, const int width);
--- a/th_config.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_config.c	Wed Dec 07 12:14:39 2022 +0200
@@ -125,9 +125,9 @@
 /* Add boolean type setting into given configuration
  */
 int th_cfg_add_bool(th_cfgitem_t **cfg, const char *name,
-                    BOOL *itemData, BOOL defValue)
+                    bool *itemData, bool defValue)
 {
-    th_cfgitem_t *node = th_cfg_add(cfg, name, ITEM_BOOL, (void *) itemData);
+    th_cfgitem_t *node = th_cfg_add(cfg, name, ITEM_bool, (void *) itemData);
     if (node == NULL)
         return THERR_MALLOC;
 
@@ -189,7 +189,7 @@
     PM_KEYSET,
     PM_STRING,
     PM_NUMERIC,
-    PM_BOOL,
+    PM_bool,
     PM_SECTION,
     PM_LIST,
 
@@ -223,7 +223,7 @@
 #define VADDCH(ch) if (strPos < SET_MAX_BUF) { tmpStr[strPos++] = ch; }
 
 
-static BOOL th_cfg_is_end(const int ch)
+static bool th_cfg_is_end(const int ch)
 {
     return
         ch == '\r' ||
@@ -247,8 +247,8 @@
         case ITEM_FLOAT:
             return PM_NUMERIC;
 
-        case ITEM_BOOL:
-            return PM_BOOL;
+        case ITEM_bool:
+            return PM_bool;
 
         case ITEM_SECTION:
             return PM_SECTION;
@@ -264,7 +264,7 @@
 
 static int th_cfg_set_item(th_cfgparserctx_t *ctx, th_cfgitem_t *item, const char *str)
 {
-    BOOL res = TRUE;
+    bool res = true;
 
     switch (item->type)
     {
@@ -288,7 +288,7 @@
                     return THERR_OK;
                 }
                 else
-                    res = FALSE;
+                    res = false;
             }
             break;
 
@@ -304,12 +304,12 @@
             *(item->v.val_float) = atof(str);
             break;
 
-        case ITEM_BOOL:
+        case ITEM_bool:
             res = th_get_boolean(str, item->v.val_bool);
             break;
 
         default:
-            res = FALSE;
+            res = false;
             break;
     }
 
@@ -325,14 +325,14 @@
     th_cfgitem_t *item = NULL;
     char *tmpStr = NULL;
     size_t strPos;
-    BOOL isEscaped, isStart, fpSet;
+    bool isEscaped, isStart, fpSet;
     int ret = THERR_OK;
 
     // Initialize values
     memset(&ctx, 0, sizeof(ctx));
     ctx.ch = -1;
     ctx.nextMode = ctx.prevMode = ctx.parseMode = PM_IDLE;
-    isEscaped = fpSet = isStart = FALSE;
+    isEscaped = fpSet = isStart = false;
     strPos = 0;
 
     if ((tmpStr = th_malloc(SET_MAX_BUF + 1)) == NULL)
@@ -461,15 +461,15 @@
             if (ctx.ch == '=')
             {
                 // Find key from configuration
-                BOOL found;
+                bool found;
                 tmpStr[strPos] = 0;
 
-                for (item = sect, found = FALSE; item != NULL && !found; )
+                for (item = sect, found = false; item != NULL && !found; )
                 {
                     if (item->type != ITEM_COMMENT &&
                         item->name != NULL &&
                         strcmp(item->name, tmpStr) == 0)
-                        found = TRUE;
+                        found = true;
                     else
                         item = (th_cfgitem_t *) item->node.next;
                 }
@@ -479,8 +479,8 @@
                 {
                     // Okay, set next mode
                     th_cfg_set_next_parsemode(&ctx, th_cfg_get_parsemode(item->type));
-                    isStart = TRUE;
-                    fpSet = FALSE;
+                    isStart = true;
+                    fpSet = false;
                     strPos = 0;
                 }
                 else
@@ -534,7 +534,7 @@
             {
                 th_cfg_set_next_parsemode(&ctx, PM_STRING);
                 ctx.ch = -1;
-                isStart = TRUE;
+                isStart = true;
             }
             else
             {
@@ -568,9 +568,9 @@
             {
                 // Start of string, get delimiter
                 ctx.strDelim = ctx.ch;
-                isStart = FALSE;
+                isStart = false;
                 strPos = 0;
-                isEscaped = FALSE;
+                isEscaped = false;
             }
             else
             if (!isEscaped && ctx.ch == ctx.strDelim)
@@ -584,7 +584,7 @@
             if (!isEscaped && ctx.ch == '\\')
             {
                 // Escape sequence
-                isEscaped = TRUE;
+                isEscaped = true;
             }
             else
             {
@@ -598,7 +598,7 @@
                         SET_MAX_BUF);
                     goto out;
                 }
-                isEscaped = FALSE;
+                isEscaped = false;
             }
 
             ctx.ch = -1;
@@ -624,7 +624,7 @@
             else
             if (isStart && item->type == ITEM_FLOAT && ctx.ch == '.')
             {
-                fpSet = TRUE;
+                fpSet = true;
                 VADDCH('0')
                 else
                 ret = THERR_INVALID_DATA;
@@ -636,7 +636,7 @@
             else
             if (item->type == ITEM_FLOAT && ctx.ch == '.' && !fpSet)
             {
-                fpSet = TRUE;
+                fpSet = true;
                 VADDCH(ctx.ch)
                 else
                 ret = THERR_INVALID_DATA;
@@ -677,15 +677,15 @@
                 goto out;
             }
 
-            isStart = FALSE;
+            isStart = false;
             ctx.ch = -1;
             break;
 
-        case PM_BOOL:
+        case PM_bool:
             // Boolean parsing mode
             if (isStart)
             {
-                isStart = FALSE;
+                isStart = false;
                 strPos = 0;
             }
 
@@ -736,21 +736,21 @@
 
 /* Write a configuration into file
  */
-static BOOL th_print_indent_a(th_ioctx *fh, const int nesting, const char *fmt, va_list ap)
+static bool th_print_indent_a(th_ioctx *fh, const int nesting, const char *fmt, va_list ap)
 {
     for (int i = 0; i < nesting * 4; i++)
     {
         if (thfputc(' ', fh) == EOF)
-            return FALSE;
+            return false;
     }
 
     return thvfprintf(fh, fmt, ap) >= 0;
 }
 
 
-static BOOL th_print_indent(th_ioctx *fh, const int nesting, const char *fmt, ...)
+static bool th_print_indent(th_ioctx *fh, const int nesting, const char *fmt, ...)
 {
-    BOOL ret;
+    bool ret;
     va_list ap;
     va_start(ap, fmt);
     ret = th_print_indent_a(fh, nesting, fmt, ap);
@@ -759,7 +759,7 @@
 }
 
 
-static BOOL th_cfg_is_item_valid(const th_cfgitem_t *item)
+static bool th_cfg_is_item_valid(const th_cfgitem_t *item)
 {
     switch (item->type)
     {
@@ -770,22 +770,22 @@
             return (*(item->v.list) != NULL);
 
         case ITEM_SECTION:
-            return TRUE;
+            return true;
 
         case ITEM_INT:
         case ITEM_UINT:
         case ITEM_FLOAT:
-        case ITEM_BOOL:
+        case ITEM_bool:
         case ITEM_HEX_TRIPLET:
-            return TRUE;
+            return true;
 
         default:
-            return FALSE;
+            return false;
     }
 }
 
 
-static BOOL th_cfg_write_string_escaped(th_ioctx *fh, const char *str, const char delim)
+static bool th_cfg_write_string_escaped(th_ioctx *fh, const char *str, const char delim)
 {
     for (const char *ptr = str; *ptr; ptr++)
     {
@@ -793,16 +793,16 @@
         {
             if (thfputc('\\', fh) == EOF ||
                 thfputc(*ptr, fh) == EOF)
-                return FALSE;
+                return false;
         }
         else
         {
             if (thfputc(*ptr, fh) == EOF)
-                return FALSE;
+                return false;
         }
     }
 
-    return TRUE;
+    return true;
 }
 
 
@@ -827,7 +827,7 @@
         case ITEM_FLOAT:
             return thfprintf(fh, "%1.5f", *(item->v.val_float));
 
-        case ITEM_BOOL:
+        case ITEM_bool:
             return thfprintf(fh, "%s", *(item->v.val_bool) ? "yes" : "no");
 
         case ITEM_HEX_TRIPLET:
@@ -848,28 +848,28 @@
 
         if (item->type == ITEM_COMMENT)
         {
-            BOOL lineStart = TRUE, lineFeed = FALSE;
+            bool lineStart = true, lineFeed = false;
 
             for (const char *ptr = item->name; *ptr; ptr++)
             switch (*ptr)
             {
                 case '\r':
                 case '\n':
-                    lineStart = lineFeed = TRUE;
+                    lineStart = lineFeed = true;
                     break;
 
                 default:
                     if (lineFeed)
                     {
                         thfprintf(fh, "\n");
-                        lineFeed = FALSE;
+                        lineFeed = false;
                     }
                     if (lineStart)
                     {
                         if (!th_print_indent(fh, nesting, "# "))
                             return THERR_FWRITE;
 
-                        lineStart = FALSE;
+                        lineStart = false;
                     }
 
                     if (thfputc(*ptr, fh) == EOF)
@@ -958,16 +958,16 @@
 {
     while (item != NULL)
     {
-        BOOL match = TRUE;
+        bool match = true;
 
         // Has type check been set, and does it match?
         if (type != -1 && item->type != type)
-            match = FALSE;
+            match = false;
 
         // Check item name
         if (name != NULL && item->name != NULL &&
             strcmp(name, item->name) != 0)
-            match = FALSE;
+            match = false;
 
         // Recurse to section
         if (!match && item->type == ITEM_SECTION)
--- a/th_config.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_config.h	Wed Dec 07 12:14:39 2022 +0200
@@ -28,7 +28,7 @@
     ITEM_STRING,
     ITEM_INT,
     ITEM_UINT,
-    ITEM_BOOL,
+    ITEM_bool,
     ITEM_FLOAT,
     ITEM_HEX_TRIPLET,
 
@@ -49,7 +49,7 @@
         int *val_int;
         unsigned int *val_uint;
         char **val_str;
-        BOOL *val_bool;
+        bool *val_bool;
         float *val_float;
 
         void *data;
@@ -73,7 +73,7 @@
 int     th_cfg_add_uint(th_cfgitem_t **cfg, const char *name, unsigned int *data, unsigned int defValue);
 int     th_cfg_add_float(th_cfgitem_t **cfg, const char *name, float *data, float defValue);
 int     th_cfg_add_string(th_cfgitem_t **cfg, const char *name, char **data, char *defValue);
-int     th_cfg_add_bool(th_cfgitem_t **cfg, const char *name, BOOL *data, BOOL defValue);
+int     th_cfg_add_bool(th_cfgitem_t **cfg, const char *name, bool *data, bool defValue);
 int     th_cfg_add_float(th_cfgitem_t **cfg, const char *name, float *data, float defValue);
 int     th_cfg_add_hexvalue(th_cfgitem_t **cfg, const char *name, unsigned int *data, unsigned int defValue);
 int     th_cfg_add_string_list(th_cfgitem_t **cfg, const char *name, th_llist_t **list);
--- a/th_datastruct.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_datastruct.c	Wed Dec 07 12:14:39 2022 +0200
@@ -318,7 +318,7 @@
         return res;
     }
 
-    (*buf)->is_allocated = TRUE;
+    (*buf)->is_allocated = true;
 
     return THERR_OK;
 }
@@ -391,7 +391,7 @@
         return NULL;
 
     th_growbuf_init(buf, mingrow);
-    buf->is_allocated = TRUE;
+    buf->is_allocated = true;
 
     return buf;
 }
@@ -406,131 +406,131 @@
 }
 
 
-BOOL th_growbuf_grow(th_growbuf_t *buf, const size_t amount)
+bool th_growbuf_grow(th_growbuf_t *buf, const size_t amount)
 {
     if (buf == NULL)
-        return FALSE;
+        return false;
 
     if (buf->data == NULL || buf->len + amount >= buf->size)
     {
         buf->size += amount + (buf->mingrow > 0 ? buf->mingrow : TH_BUFGROW);
         if ((buf->data = th_realloc(buf->data, buf->size)) == NULL)
-            return FALSE;
+            return false;
     }
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_puts(th_growbuf_t *buf, const char *str, BOOL eos)
+bool th_growbuf_puts(th_growbuf_t *buf, const char *str, bool eos)
 {
     size_t slen;
     if (str == NULL)
-        return FALSE;
+        return false;
 
     slen = strlen(str);
     if (!th_growbuf_grow(buf, slen + 1))
-        return FALSE;
+        return false;
 
     memcpy(buf->data + buf->len, str, slen + 1);
     buf->len += eos ? (slen + 1) : slen;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_putch(th_growbuf_t *buf, const char ch)
+bool th_growbuf_putch(th_growbuf_t *buf, const char ch)
 {
     if (!th_growbuf_grow(buf, sizeof(char)))
-        return FALSE;
+        return false;
 
     buf->data[buf->len++] = (uint8_t) ch;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_put_str(th_growbuf_t *buf, const void *str, const size_t len)
+bool th_growbuf_put_str(th_growbuf_t *buf, const void *str, const size_t len)
 {
     if (str == NULL)
-        return FALSE;
+        return false;
 
     if (!th_growbuf_grow(buf, len + 1))
-        return FALSE;
+        return false;
 
     memcpy(buf->data + buf->len, str, len + 1);
     buf->len += len;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_put_u8(th_growbuf_t *buf, const uint8_t val)
+bool th_growbuf_put_u8(th_growbuf_t *buf, const uint8_t val)
 {
     if (!th_growbuf_grow(buf, sizeof(uint8_t)))
-        return FALSE;
+        return false;
 
     buf->data[buf->len++] = val;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_put_u16_be(th_growbuf_t *buf, const uint16_t val)
+bool th_growbuf_put_u16_be(th_growbuf_t *buf, const uint16_t val)
 {
     if (!th_growbuf_grow(buf, sizeof(uint16_t)))
-        return FALSE;
+        return false;
 
     buf->data[buf->len++] = (val >> 8) & 0xff;
     buf->data[buf->len++] = val & 0xff;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_put_u16_le(th_growbuf_t *buf, const uint16_t val)
+bool th_growbuf_put_u16_le(th_growbuf_t *buf, const uint16_t val)
 {
     if (!th_growbuf_grow(buf, sizeof(uint16_t)))
-        return FALSE;
+        return false;
 
     buf->data[buf->len++] = val & 0xff;
     buf->data[buf->len++] = (val >> 8) & 0xff;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_put_u32_be(th_growbuf_t *buf, const uint32_t val)
+bool th_growbuf_put_u32_be(th_growbuf_t *buf, const uint32_t val)
 {
     if (!th_growbuf_grow(buf, sizeof(uint32_t)))
-        return FALSE;
+        return false;
 
     buf->data[buf->len++] = (val >> 24) & 0xff;
     buf->data[buf->len++] = (val >> 16) & 0xff;
     buf->data[buf->len++] = (val >> 8) & 0xff;
     buf->data[buf->len++] = val & 0xff;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_growbuf_put_u32_le(th_growbuf_t *buf, const uint32_t val)
+bool th_growbuf_put_u32_le(th_growbuf_t *buf, const uint32_t val)
 {
     if (!th_growbuf_grow(buf, sizeof(uint32_t)))
-        return FALSE;
+        return false;
 
     buf->data[buf->len++] = val & 0xff;
     buf->data[buf->len++] = (val >> 8) & 0xff;
     buf->data[buf->len++] = (val >> 16) & 0xff;
     buf->data[buf->len++] = (val >> 24) & 0xff;
 
-    return TRUE;
+    return true;
 }
 
 
 /*
  * Simple legacy string growing buffer
  */
-BOOL th_strbuf_grow(char **buf, size_t *bufsize, size_t *len, size_t grow)
+bool th_strbuf_grow(char **buf, size_t *bufsize, size_t *len, size_t grow)
 {
     if (*buf == NULL)
         *bufsize = *len = 0;
@@ -540,52 +540,52 @@
         *bufsize += grow + TH_BUFGROW;
         *buf = th_realloc(*buf, *bufsize);
         if (*buf == NULL)
-            return FALSE;
+            return false;
     }
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_strbuf_putch(char **buf, size_t *bufsize, size_t *len, const uint8_t ch)
+bool th_strbuf_putch(char **buf, size_t *bufsize, size_t *len, const uint8_t ch)
 {
     if (!th_strbuf_grow(buf, bufsize, len, 1))
-        return FALSE;
+        return false;
 
     (*buf)[*len] = ch;
     (*len)++;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_strbuf_putsn(char **buf, size_t *bufsize, size_t *len, const char *str, const size_t slen)
+bool th_strbuf_putsn(char **buf, size_t *bufsize, size_t *len, const char *str, const size_t slen)
 {
     if (str == NULL)
-        return FALSE;
+        return false;
 
     if (!th_strbuf_grow(buf, bufsize, len, slen + 1))
-        return FALSE;
+        return false;
 
     memcpy(*buf + *len, str, slen);
     (*len) += slen;
     *(buf + *len + slen) = 0;
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_strbuf_puts(char **buf, size_t *bufsize, size_t *len, const char *str)
+bool th_strbuf_puts(char **buf, size_t *bufsize, size_t *len, const char *str)
 {
     size_t slen;
     if (str == NULL)
-        return FALSE;
+        return false;
 
     slen = strlen(str);
     if (!th_strbuf_grow(buf, bufsize, len, slen + 1))
-        return FALSE;
+        return false;
 
     memcpy(*buf + *len, str, slen + 1);
     (*len) += slen;
 
-    return TRUE;
+    return true;
 }
--- a/th_datastruct.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_datastruct.h	Wed Dec 07 12:14:39 2022 +0200
@@ -55,7 +55,7 @@
  */
 typedef struct
 {
-    BOOL is_allocated; ///< True if this structure has been allocated dynamically
+    bool is_allocated; ///< True if this structure has been allocated dynamically
     void **data;    ///< Array of pointers to the data
     size_t size;    ///< Size of this ringbuffer in elements (aka pointers to data)
     size_t n;       ///< Number of elements currently in the ringbuffer (@p n <= @p size)
@@ -77,10 +77,10 @@
 
 /* Simple growing string buffer
  */
-BOOL    th_strbuf_grow(char **buf, size_t *bufsize, size_t *len, const size_t grow);
-BOOL    th_strbuf_putch(char **buf, size_t *bufsize, size_t *len, const uint8_t ch);
-BOOL    th_strbuf_putsn(char **buf, size_t *bufsize, size_t *len, const char *str, const size_t slen);
-BOOL    th_strbuf_puts(char **buf, size_t *bufsize, size_t *len, const char *str);
+bool    th_strbuf_grow(char **buf, size_t *bufsize, size_t *len, const size_t grow);
+bool    th_strbuf_putch(char **buf, size_t *bufsize, size_t *len, const uint8_t ch);
+bool    th_strbuf_putsn(char **buf, size_t *bufsize, size_t *len, const char *str, const size_t slen);
+bool    th_strbuf_puts(char **buf, size_t *bufsize, size_t *len, const char *str);
 
 
 /** @brief
@@ -88,7 +88,7 @@
  */
 typedef struct
 {
-    BOOL is_allocated; ///< True if this structure has been allocated dynamically
+    bool is_allocated; ///< True if this structure has been allocated dynamically
     uint8_t *data;     ///< Pointer to data
     size_t size;       ///< Current allocated size of data
     size_t len;        ///< Actual used size of data (must be < size)
@@ -105,15 +105,15 @@
 void    th_growbuf_free(th_growbuf_t *buf);
 
 
-BOOL    th_growbuf_grow(th_growbuf_t *buf, const size_t grow);
-BOOL    th_growbuf_puts(th_growbuf_t *buf, const char *str, BOOL eos);
-BOOL    th_growbuf_putch(th_growbuf_t *buf, const char ch);
-BOOL    th_growbuf_put_str(th_growbuf_t *buf, const void *s, const size_t len);
-BOOL    th_growbuf_put_u8(th_growbuf_t *buf, const uint8_t val);
-BOOL    th_growbuf_put_u16_be(th_growbuf_t *buf, const uint16_t val);
-BOOL    th_growbuf_put_u16_le(th_growbuf_t *buf, const uint16_t val);
-BOOL    th_growbuf_put_u32_be(th_growbuf_t *buf, const uint32_t val);
-BOOL    th_growbuf_put_u32_le(th_growbuf_t *buf, const uint32_t val);
+bool    th_growbuf_grow(th_growbuf_t *buf, const size_t grow);
+bool    th_growbuf_puts(th_growbuf_t *buf, const char *str, bool eos);
+bool    th_growbuf_putch(th_growbuf_t *buf, const char ch);
+bool    th_growbuf_put_str(th_growbuf_t *buf, const void *s, const size_t len);
+bool    th_growbuf_put_u8(th_growbuf_t *buf, const uint8_t val);
+bool    th_growbuf_put_u16_be(th_growbuf_t *buf, const uint16_t val);
+bool    th_growbuf_put_u16_le(th_growbuf_t *buf, const uint16_t val);
+bool    th_growbuf_put_u32_be(th_growbuf_t *buf, const uint32_t val);
+bool    th_growbuf_put_u32_le(th_growbuf_t *buf, const uint32_t val);
 
 
 #ifdef __cplusplus
--- a/th_file.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_file.c	Wed Dec 07 12:14:39 2022 +0200
@@ -101,12 +101,12 @@
 #endif
 
 
-BOOL th_stat_path(const char *path, th_stat_data *data)
+bool th_stat_path(const char *path, th_stat_data *data)
 {
 #if defined(TH_PLAT_WINDOWS)
     WIN32_FILE_ATTRIBUTE_DATA fdata;
     if (!GetFileAttributesExA(path, GetFileExInfoStandard, &fdata))
-        return FALSE;
+        return false;
 
     data->size   = (((uint64_t) fdata.nFileSizeHigh) << 32ULL) | ((uint64_t) fdata.nFileSizeLow);
     data->ctime  = th_convert_windows_time(fdata.ftCreationTime);
@@ -125,7 +125,7 @@
 
     struct stat sb;
     if (stat(path, &sb) < 0)
-        return FALSE;
+        return false;
 
     data->size   = sb.st_size;
     data->ctime  = sb.st_ctime;
@@ -150,15 +150,15 @@
 
 #endif
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_mkdir_path(const char *cpath, const int mode)
+bool th_mkdir_path(const char *cpath, const int mode)
 {
     char save, *path = th_strdup(cpath);
     size_t start = 0, end;
-    BOOL res = FALSE;
+    bool res = false;
 
 #if defined(TH_PLAT_WINDOWS)
     (void) mode;
@@ -180,7 +180,7 @@
         if (path[start] != 0)
         {
             th_stat_data sdata;
-            BOOL exists = th_stat_path(path, &sdata);
+            bool exists = th_stat_path(path, &sdata);
             if (exists && (sdata.flags & TH_IS_DIR) == 0)
                 goto error;
 
@@ -201,7 +201,7 @@
         start = end + 1;
     } while (save != 0);
 
-    res = TRUE;
+    res = true;
 
 error:
     th_free(path);
--- a/th_file.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_file.h	Wed Dec 07 12:14:39 2022 +0200
@@ -48,8 +48,8 @@
 char *  th_get_home_dir(void);
 char *  th_get_config_dir(const char *name);
 
-BOOL    th_stat_path(const char *path, th_stat_data *data);
-BOOL    th_mkdir_path(const char *path, const int mode);
+bool    th_stat_path(const char *path, th_stat_data *data);
+bool    th_mkdir_path(const char *path, const int mode);
 
 
 #ifdef __cplusplus
--- a/th_ioctx.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_ioctx.c	Wed Dec 07 12:14:39 2022 +0200
@@ -40,18 +40,18 @@
 
     th_io_init(ctx);
 
-    ctx->allocated = TRUE;
+    ctx->allocated = true;
     ctx->fops = fops;
 
     ctx->filename = th_strdup(filename);
-    ctx->fallocated = TRUE;
+    ctx->fallocated = true;
     if (filename != NULL && ctx->filename == NULL)
         goto err;
 
     if (mode != NULL && (ctx->mode = th_strdup(mode)) == NULL)
         goto err;
 
-    ctx->mallocated = TRUE;
+    ctx->mallocated = true;
 
     return ctx;
 
@@ -95,7 +95,7 @@
     }
     else
     {
-        ctx->mallocated = TRUE;
+        ctx->mallocated = true;
         if ((ctx->mode = th_strdup(mode)) == NULL)
             return THERR_MALLOC;
     }
@@ -122,17 +122,17 @@
 }
 
 
-BOOL th_io_set_handlers(th_ioctx *ctx,
+bool th_io_set_handlers(th_ioctx *ctx,
     void (*error)(th_ioctx *, const int, const char *msg),
     void (*msg)(th_ioctx *, const int, const char *msg))
 {
     if (ctx == NULL)
-        return FALSE;
+        return false;
 
     ctx->error = error;
     ctx->msg = msg;
 
-    return TRUE;
+    return true;
 }
 
 
@@ -240,7 +240,7 @@
 }
 
 
-BOOL thfeof(th_ioctx *ctx)
+bool thfeof(th_ioctx *ctx)
 {
     th_io_update_atime(ctx);
     return ctx->fops->feof(ctx);
@@ -332,25 +332,25 @@
 }
 
 
-BOOL thfread_str(th_ioctx *ctx, void *ptr, const size_t len)
+bool thfread_str(th_ioctx *ctx, void *ptr, const size_t len)
 {
     return thfread(ptr, sizeof(uint8_t), len, ctx) == len;
 }
 
 
-BOOL thfread_u8(th_ioctx *ctx, uint8_t *val)
+bool thfread_u8(th_ioctx *ctx, uint8_t *val)
 {
     return (thfread(val, sizeof(uint8_t), 1, ctx) == 1);
 }
 
 
-BOOL thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len)
+bool thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len)
 {
     return thfwrite(ptr, sizeof(uint8_t), len, ctx) == len;
 }
 
 
-BOOL thfwrite_u8(th_ioctx *ctx, const uint8_t val)
+bool thfwrite_u8(th_ioctx *ctx, const uint8_t val)
 {
     return thfwrite(&val, sizeof(uint8_t), 1, ctx) == 1;
 }
@@ -360,21 +360,21 @@
 // File routines for endian-dependant data
 //
 #define TH_DEFINE_FUNC(xname, xtype, xmacro)               \
-BOOL thfread_ ## xname (th_ioctx *ctx, xtype *v)           \
+bool thfread_ ## xname (th_ioctx *ctx, xtype *v)           \
 {                                                          \
     xtype result;                                          \
     if (thfread(&result, sizeof( xtype ), 1, ctx) != 1)    \
-        return FALSE;                                      \
+        return false;                                      \
     *v = TH_ ## xmacro ## _TO_NATIVE (result);             \
-    return TRUE;                                           \
+    return true;                                           \
 }                                                          \
                                                            \
-BOOL thfwrite_ ## xname (th_ioctx *ctx, const xtype v)     \
+bool thfwrite_ ## xname (th_ioctx *ctx, const xtype v)     \
 {                                                          \
     xtype result = TH_NATIVE_TO_ ## xmacro (v);            \
     if (thfwrite(&result, sizeof( xtype ), 1, ctx) != 1)   \
-        return FALSE;                                      \
-    return TRUE;                                           \
+        return false;                                      \
+    return true;                                           \
 }
 
 
--- a/th_ioctx.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_ioctx.h	Wed Dec 07 12:14:39 2022 +0200
@@ -31,10 +31,10 @@
 typedef struct th_ioctx
 {
     char *filename;     ///< Context filename, if any. May be NULL.
-    BOOL fallocated;    ///< TRUE if filename is allocated, FALSE if "const"
+    bool fallocated;    ///< true if filename is allocated, false if "const"
     char *mode;         ///< Context's stdio open "mode", may also be NULL.
-    BOOL mallocated;    ///< TRUE if mode string is allocated, FALSE if "const"
-    BOOL allocated;     ///< TRUE if this structure has been allocated
+    bool mallocated;    ///< true if mode string is allocated, false if "const"
+    bool allocated;     ///< true if this structure has been allocated
 
     void *data;         ///< Internal data
     time_t atime;       ///< Last access time
@@ -49,8 +49,8 @@
     size_t minAlloc;    ///< Minimum allocation increase (0 = default)
     off_t  memOffset;   ///< Current offset in data
     uint8_t *memData;   ///< Pointer to data
-    BOOL   memFree;     ///< TRUE = free the allocated memory on thfclose(), FALSE = no
-    BOOL   memWrite;    ///< TRUE = memory can be written to / expanded etc. FALSE = no
+    bool   memFree;     ///< true = free the allocated memory on thfclose(), false = no
+    bool   memWrite;    ///< true = memory can be written to / expanded etc. false = no
 
     // Message functions
     void (*error)(struct th_ioctx *ctx, const int err, const char *msg);
@@ -72,7 +72,7 @@
     int     (*fseek)(th_ioctx *ctx, const off_t, const int whence);
     off_t   (*fsize)(th_ioctx *ctx);
     off_t   (*ftell)(th_ioctx *ctx);
-    BOOL    (*feof)(th_ioctx *ctx);
+    bool    (*feof)(th_ioctx *ctx);
     int     (*fgetc)(th_ioctx *ctx);
     int     (*fputc)(int, th_ioctx *ctx);
     size_t  (*fread)(void *ptr, const size_t, const size_t, th_ioctx *ctx);
@@ -102,7 +102,7 @@
 
 void         th_io_init_stdio(th_ioctx *ctx, FILE *fh);
 
-BOOL         th_io_set_handlers(th_ioctx *ctx,
+bool         th_io_set_handlers(th_ioctx *ctx,
              void (*error)(th_ioctx *, const int, const char *msg),
              void (*msg)(th_ioctx *, const int, const char *msg));
 
@@ -125,7 +125,7 @@
 int          thfseek(th_ioctx *ctx, const off_t, const int whence);
 off_t        thfsize(th_ioctx *ctx);
 off_t        thftell(th_ioctx *ctx);
-BOOL         thfeof(th_ioctx *ctx);
+bool         thfeof(th_ioctx *ctx);
 int          thfgetc(th_ioctx *ctx);
 int          thfputc(int ch, th_ioctx *ctx);
 size_t       thfread(void *ptr, const size_t, const size_t, th_ioctx *ctx);
@@ -136,35 +136,35 @@
 int          thfprintf(th_ioctx *ctx, const char *fmt, ...)
              TH_ATTR_PRINTF_FMT(2, 3);
 
-BOOL         thfread_str(th_ioctx *ctx, void *ptr, const size_t len);
-BOOL         thfread_u8(th_ioctx *ctx, uint8_t *);
-BOOL         thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len);
-BOOL         thfwrite_u8(th_ioctx *ctx, const uint8_t);
+bool         thfread_str(th_ioctx *ctx, void *ptr, const size_t len);
+bool         thfread_u8(th_ioctx *ctx, uint8_t *);
+bool         thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len);
+bool         thfwrite_u8(th_ioctx *ctx, const uint8_t);
 
 
 //
 // Endian-handling file read/write routines
 //
-BOOL         thfwrite_ne16(th_ioctx *ctx, const uint16_t v);
-BOOL         thfwrite_ne32(th_ioctx *ctx, const uint32_t v);
-BOOL         thfwrite_ne64(th_ioctx *ctx, const uint64_t v);
-BOOL         thfread_ne16(th_ioctx *ctx, uint16_t *v);
-BOOL         thfread_ne32(th_ioctx *ctx, uint32_t *v);
-BOOL         thfread_ne64(th_ioctx *ctx, uint64_t *v);
+bool         thfwrite_ne16(th_ioctx *ctx, const uint16_t v);
+bool         thfwrite_ne32(th_ioctx *ctx, const uint32_t v);
+bool         thfwrite_ne64(th_ioctx *ctx, const uint64_t v);
+bool         thfread_ne16(th_ioctx *ctx, uint16_t *v);
+bool         thfread_ne32(th_ioctx *ctx, uint32_t *v);
+bool         thfread_ne64(th_ioctx *ctx, uint64_t *v);
 
-BOOL         thfwrite_le16(th_ioctx *ctx, const uint16_t v);
-BOOL         thfwrite_le32(th_ioctx *ctx, const uint32_t v);
-BOOL         thfwrite_le64(th_ioctx *ctx, const uint64_t v);
-BOOL         thfread_le16(th_ioctx *ctx, uint16_t *v);
-BOOL         thfread_le32(th_ioctx *ctx, uint32_t *v);
-BOOL         thfread_le64(th_ioctx *ctx, uint64_t *v);
+bool         thfwrite_le16(th_ioctx *ctx, const uint16_t v);
+bool         thfwrite_le32(th_ioctx *ctx, const uint32_t v);
+bool         thfwrite_le64(th_ioctx *ctx, const uint64_t v);
+bool         thfread_le16(th_ioctx *ctx, uint16_t *v);
+bool         thfread_le32(th_ioctx *ctx, uint32_t *v);
+bool         thfread_le64(th_ioctx *ctx, uint64_t *v);
 
-BOOL         thfwrite_be16(th_ioctx *ctx, const uint16_t v);
-BOOL         thfwrite_be32(th_ioctx *ctx, const uint32_t v);
-BOOL         thfwrite_be64(th_ioctx *ctx, const uint64_t v);
-BOOL         thfread_be16(th_ioctx *ctx, uint16_t *v);
-BOOL         thfread_be32(th_ioctx *ctx, uint32_t *v);
-BOOL         thfread_be64(th_ioctx *ctx, uint64_t *v);
+bool         thfwrite_be16(th_ioctx *ctx, const uint16_t v);
+bool         thfwrite_be32(th_ioctx *ctx, const uint32_t v);
+bool         thfwrite_be64(th_ioctx *ctx, const uint64_t v);
+bool         thfread_be16(th_ioctx *ctx, uint16_t *v);
+bool         thfread_be32(th_ioctx *ctx, uint32_t *v);
+bool         thfread_be64(th_ioctx *ctx, uint64_t *v);
 
 
 #ifdef __cplusplus
--- a/th_ioctx_mem.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_ioctx_mem.c	Wed Dec 07 12:14:39 2022 +0200
@@ -18,7 +18,7 @@
     {
         case 'a':
             // Append
-            ctx->memWrite = TRUE;
+            ctx->memWrite = true;
             ctx->memOffset = ctx->memSize;
             break;
 
@@ -32,7 +32,7 @@
             // Write, so truncate size
             ctx->memOffset = 0;
             ctx->memSize = 0;
-            ctx->memWrite = TRUE;
+            ctx->memWrite = true;
             break;
 
         default:
@@ -54,7 +54,7 @@
 }
 
 
-static BOOL th_mem_realloc(th_ioctx *ctx, const size_t newSize)
+static bool th_mem_realloc(th_ioctx *ctx, const size_t newSize)
 {
     size_t grow;
 
@@ -62,7 +62,7 @@
     if (!ctx->memWrite)
     {
         ctx->status = THERR_FWRITE;
-        return FALSE;
+        return false;
     }
 
     if (ctx->memData == NULL)
@@ -72,7 +72,7 @@
     if (ctx->maxSize > 0 && newSize > ctx->maxSize)
     {
         ctx->status = THERR_BOUNDS;
-        return FALSE;
+        return false;
     }
 
     // New size is smaller than old
@@ -87,7 +87,7 @@
     if (ctx->maxSize > 0 && ctx->memAlloc + grow >= ctx->maxSize)
     {
         ctx->status = THERR_BOUNDS;
-        return FALSE;
+        return false;
     }
 
     // Grow the buffer
@@ -95,13 +95,13 @@
     if ((ctx->memData = th_realloc(ctx->memData, ctx->memAlloc)) == NULL)
     {
         ctx->status = THERR_MALLOC;
-        return FALSE;
+        return false;
     }
 
 out:
     ctx->memSize = newSize;
 
-    return TRUE;
+    return true;
 }
 
 
@@ -171,7 +171,7 @@
 }
 
 
-static BOOL th_mem_feof(th_ioctx *ctx)
+static bool th_mem_feof(th_ioctx *ctx)
 {
     return ((size_t) ctx->memOffset) >= ctx->memSize;
 }
--- a/th_ioctx_stdio.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_ioctx_stdio.c	Wed Dec 07 12:14:39 2022 +0200
@@ -81,7 +81,7 @@
 }
 
 
-static BOOL th_stdio_feof(th_ioctx *ctx)
+static bool th_stdio_feof(th_ioctx *ctx)
 {
     return feof(CTX_FH);
 }
--- a/th_network.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_network.c	Wed Dec 07 12:14:39 2022 +0200
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 
-static BOOL th_network_inited = FALSE;
+static bool th_network_inited = false;
 static th_llist_t *th_conn_list = NULL;
 
 
@@ -114,14 +114,14 @@
 }
 
 
-BOOL th_base_conn_init(th_base_conn_t *base, ssize_t bufsize)
+bool th_base_conn_init(th_base_conn_t *base, ssize_t bufsize)
 {
     // Allocate connection data buffer
     base->bufsize = (bufsize <= 0) ? TH_CONNBUF_SIZE : bufsize;
     if ((base->buf = th_malloc(base->bufsize)) == NULL)
-        return FALSE;
+        return false;
 
-    return TRUE;
+    return true;
 }
 
 
@@ -150,17 +150,17 @@
 }
 
 
-static BOOL th_get_addr(struct in_addr *addr, struct hostent *hst)
+static bool th_get_addr(struct in_addr *addr, struct hostent *hst)
 {
     if (hst != NULL)
     {
         *addr = *(struct in_addr *) (hst->h_addr_list[0]);
-        return TRUE;
+        return true;
     }
     else
     {
         addr->s_addr = 0;
-        return FALSE;
+        return false;
     }
 }
 
@@ -321,9 +321,9 @@
             goto out;
     }
 
-    th_growbuf_puts(&buf, conn->proxy.userid, TRUE);
+    th_growbuf_puts(&buf, conn->proxy.userid, true);
     if (conn->proxy.addr_type == TH_PROXY_ADDR_DOMAIN)
-        th_growbuf_puts(&buf, host, TRUE);
+        th_growbuf_puts(&buf, host, true);
 
     // Send request
     if ((err = th_conn_proxy_send(conn, &buf)) != THERR_OK)
@@ -465,9 +465,9 @@
 
         th_growbuf_put_u8(&buf, 0x01);
         th_growbuf_put_u8(&buf, strlen(conn->proxy.userid));
-        th_growbuf_puts(&buf, conn->proxy.userid, FALSE);
+        th_growbuf_puts(&buf, conn->proxy.userid, false);
         th_growbuf_put_u8(&buf, strlen(conn->proxy.passwd));
-        th_growbuf_puts(&buf, conn->proxy.passwd, FALSE);
+        th_growbuf_puts(&buf, conn->proxy.passwd, false);
 
         // Send request
         if ((err = th_conn_proxy_send(conn, &buf)) != THERR_OK)
@@ -829,10 +829,10 @@
 }
 
 
-BOOL th_conn_check(th_conn_t *conn)
+bool th_conn_check(th_conn_t *conn)
 {
     if (conn == NULL)
-        return FALSE;
+        return false;
 
     return conn->err == 0 && conn->status == TH_CONN_OPEN;
 }
@@ -851,7 +851,7 @@
     }
 #endif
 
-    th_network_inited = TRUE;
+    th_network_inited = true;
 
     th_conn_list = NULL;
 
@@ -877,25 +877,25 @@
 #endif
     }
 
-    th_network_inited = FALSE;
+    th_network_inited = false;
 }
 
 
-BOOL th_conn_buf_check(th_conn_t *conn, size_t n)
+bool th_conn_buf_check(th_conn_t *conn, size_t n)
 {
     return conn && (conn->base.ptr + n <= conn->base.in_ptr);
 }
 
 
-BOOL th_conn_buf_skip(th_conn_t *conn, size_t n)
+bool th_conn_buf_skip(th_conn_t *conn, size_t n)
 {
     if (th_conn_buf_check(conn, n))
     {
         conn->base.ptr += n;
-        return TRUE;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
 
--- a/th_network.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_network.h	Wed Dec 07 12:14:39 2022 +0200
@@ -14,7 +14,7 @@
 
 
 #ifdef TH_PLAT_WINDOWS
-#    define __OBJC_BOOL // A nasty hack
+#    define __OBJC_bool // A nasty hack
 #    include <windows.h>
 #    include <winsock.h>
 typedef uint16_t in_port_t;
@@ -157,11 +157,11 @@
 int         th_conn_pull(th_conn_t *);
 int         th_conn_send_buf(th_conn_t *, const void *buf, const size_t len);
 int         th_conn_send_growbuf(th_conn_t *, th_growbuf_t *buf);
-BOOL        th_conn_check(th_conn_t *);
+bool        th_conn_check(th_conn_t *);
 
 
-BOOL        th_conn_buf_check(th_conn_t *conn, size_t n);
-BOOL        th_conn_buf_skip(th_conn_t *conn, size_t n);
+bool        th_conn_buf_check(th_conn_t *conn, size_t n);
+bool        th_conn_buf_skip(th_conn_t *conn, size_t n);
 int         th_conn_buf_strncmp(th_conn_t *conn, const char *str, const size_t n);
 int         th_conn_buf_strcmp(th_conn_t *conn, const char *str);
 char *      th_conn_buf_strstr(th_conn_t *conn, const char *str);
--- a/th_printf.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_printf.c	Wed Dec 07 12:14:39 2022 +0200
@@ -8,7 +8,7 @@
 
 
 #ifdef TH_PRINTF_DEBUG
-BOOL th_printf_debug = FALSE;
+bool th_printf_debug = false;
 char *th_printf_debug_prefix = NULL;
 
 
@@ -152,7 +152,7 @@
 
 int th_vprintf_put_int_format(th_vprintf_ctx *ctx, th_vprintf_putch vputch,
     th_char_t *buf, int f_flags, int f_width, int f_prec, int f_len, int vret,
-    BOOL f_neg, BOOL f_unsig, th_vprintf_altfmt_func f_alt)
+    bool f_neg, bool f_unsig, th_vprintf_altfmt_func f_alt)
 {
     int ret = 0, nspacepad, nzeropad, f_altstr_len = 0;
     th_char_t f_sign, *f_altstr;
@@ -252,11 +252,11 @@
 
 int th_vprintf_put_int(th_vprintf_ctx *ctx, th_vprintf_putch vputch,
     va_list ap, const int f_radix, int f_flags, int f_width, int f_prec,
-    const BOOL f_unsig, th_vprintf_altfmt_func f_alt)
+    const bool f_unsig, th_vprintf_altfmt_func f_alt)
 {
     th_char_t buf[32];
     int f_len = 0, vret;
-    BOOL f_neg = FALSE;
+    bool f_neg = false;
 
     if (f_flags & TH_PF_LONGLONG)
     {
@@ -326,7 +326,7 @@
     memcpy(&val, &pval, sizeof(int64_t));
 
     // We have sign, exponent and mantissa
-    BOOL f_sign    = (val >> 63) & 0x01;
+    bool f_sign    = (val >> 63) & 0x01;
     int64_t d_exp  = (val >> 52) & 0x7ff;
     uint64_t d_man = val & 0x0fffffffffffff;
 
@@ -358,7 +358,7 @@
             return th_printf_pad_post(ctx, vputch, f_width - 1, f_flags);
 
         case 'o':
-            return th_vprintf_put_int(ctx, vputch, ap, 8, f_flags, f_width, f_prec, TRUE, th_vprintf_altfmt_oct);
+            return th_vprintf_put_int(ctx, vputch, ap, 8, f_flags, f_width, f_prec, true, th_vprintf_altfmt_oct);
 
         case 'u':
         case 'i':
@@ -370,7 +370,7 @@
             if (fmt == 'X')
                 f_flags |= TH_PF_UPCASE;
 
-            return th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, TRUE, th_vprintf_altfmt_hex);
+            return th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, true, th_vprintf_altfmt_hex);
 
         case 'p':
             // Check for invalid flags
@@ -384,7 +384,7 @@
 #endif
             f_flags |= TH_PF_ALT | TH_PF_POINTER;
 
-            return th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, TRUE, th_vprintf_altfmt_hex);
+            return th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, true, th_vprintf_altfmt_hex);
 
 #ifdef TH_WIP_FLOAT_SUPPORT
         case 'f':
@@ -418,7 +418,7 @@
         else
         {
             int f_width = -1, f_prec = -1, f_flags = 0;
-            BOOL end = FALSE;
+            bool end = false;
 
             fmt++;
 
@@ -452,7 +452,7 @@
                         break;
 
                     default:
-                        end = TRUE;
+                        end = true;
                         break;
                 }
                 if (!end) fmt++;
--- a/th_printf1.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_printf1.c	Wed Dec 07 12:14:39 2022 +0200
@@ -8,8 +8,8 @@
 
 
 int TH_VPRINTF_INTFMT_NAME (char *buf, const int len, int *pos,
-    TH_VPRINTF_INTFMT_TYPE_S pval, const int f_radix, const BOOL f_upcase,
-    const BOOL f_unsig, BOOL *f_neg)
+    TH_VPRINTF_INTFMT_TYPE_S pval, const int f_radix, const bool f_upcase,
+    const bool f_unsig, bool *f_neg)
 #ifdef TH_VPRINTF_INTFMT_HEADER
 ;
 #else
@@ -20,11 +20,11 @@
     // Check for negative value
     if (!f_unsig && pval < 0)
     {
-        *f_neg = TRUE;
+        *f_neg = true;
         pval = -pval;
     }
     else
-        *f_neg = FALSE;
+        *f_neg = false;
 
     // Render the value to a string in buf (reversed)
     TH_VPRINTF_INTFMT_TYPE_U val = pval;
--- a/th_regex.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_regex.c	Wed Dec 07 12:14:39 2022 +0200
@@ -219,32 +219,32 @@
 }
 
 
-static BOOL th_regex_find_next(const th_char_t *str,
+static bool th_regex_find_next(const th_char_t *str,
     const size_t start, size_t *offs,
     const th_char_t delim)
 {
     for (*offs = start; str[*offs] != 0; (*offs)++)
     {
         if (str[*offs] == delim)
-            return TRUE;
+            return true;
     }
-    return FALSE;
+    return false;
 }
 
 
-static BOOL th_regex_parse_ssize_t(const th_char_t *str,
+static bool th_regex_parse_ssize_t(const th_char_t *str,
     ssize_t *value)
 {
     th_char_t ch;
-    BOOL neg;
+    bool neg;
 
     if (*str == '-')
     {
         str++;
-        neg = TRUE;
+        neg = true;
     }
     else
-        neg = FALSE;
+        neg = false;
 
     // Is the value negative?
     while ((ch = *str++))
@@ -255,13 +255,13 @@
             *value += ch - '0';
         }
         else
-            return FALSE;
+            return false;
     }
 
     if (neg)
         *value = -(*value);
 
-    return TRUE;
+    return true;
 }
 
 
@@ -416,7 +416,7 @@
 }
 
 
-static int th_regex_parse_ctx_node_commit_strchr(th_regex_parse_ctx_t *ctx, const BOOL split)
+static int th_regex_parse_ctx_node_commit_strchr(th_regex_parse_ctx_t *ctx, const bool split)
 {
     int res = THERR_OK;;
 
@@ -486,7 +486,7 @@
             case '?':
             case '*':
             case '+':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, TRUE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, true)) != THERR_OK)
                     goto out;
 
                 if ((res = th_regex_parse_ctx_get_prev_node(&ctx, &pnode)) != THERR_OK)
@@ -526,7 +526,7 @@
                 break;
 
             case '{':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, TRUE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, true)) != THERR_OK)
                     goto out;
 
                 // {n} | {min,max}
@@ -578,7 +578,7 @@
 
 /*
             case '|':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
 
                 // Alt pattern .. how to handle these?
@@ -586,7 +586,7 @@
 */
 
             case '(':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
 
                 // Start of subpattern
@@ -595,7 +595,7 @@
                 break;
 
             case ')':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
 
                 // End of subpattern
@@ -608,7 +608,7 @@
                 break;
 
             case '^':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
 
                 // Start of line anchor
@@ -620,7 +620,7 @@
                 break;
 
             case '$':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
 
                 // End of line anchor
@@ -632,7 +632,7 @@
                 break;
 
             case '[':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
 
                 // Start of char list
@@ -660,7 +660,7 @@
                 break;
 
             case '.':
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
 
                 // Any single character matches
@@ -687,14 +687,14 @@
                 if (ctx.bufPos < ctx.bufSize)
                     ctx.buf[ctx.bufPos++] = ctx.pattern[ctx.offs];
                 else
-                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+                if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
                     goto out;
                 break;
         }
     }
 
     // Commit last string/char if any
-    if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, FALSE)) != THERR_OK)
+    if ((res = th_regex_parse_ctx_node_commit_strchr(&ctx, false)) != THERR_OK)
         goto out;
 
     // Create root node
@@ -841,7 +841,7 @@
 }
 
 
-static BOOL th_regex_match_list(const th_regex_list_t *list, const th_char_t cch)
+static bool th_regex_match_list(const th_regex_list_t *list, const th_char_t cch)
 {
     // Could be optimized, perhaps .. sort match.chars, binary search etc?
     for (size_t nitem = 0; nitem < list->nitems; nitem++)
@@ -853,21 +853,21 @@
             for (size_t n = 0; n < item->nchars; n++)
             {
                 if (item->chars[n] == cch)
-                    return TRUE;
+                    return true;
             }
         }
         else
         {
             if (cch >= item->start && cch <= item->end)
-                return TRUE;
+                return true;
         }
     }
 
-    return FALSE;
+    return false;
 }
 
 
-static BOOL th_regex_match_expr(
+static bool th_regex_match_expr(
     const th_char_t *haystack,
     size_t *offs,
     const th_regex_t *expr,
@@ -877,7 +877,7 @@
     );
 
 
-static BOOL th_regex_match_one(
+static bool th_regex_match_one(
     const th_char_t *haystack,
     size_t *offs,
     const th_regex_node_t *node,
@@ -886,7 +886,7 @@
     )
 {
     th_char_t cch;
-    BOOL res = FALSE;
+    bool res = false;
 
     switch (node->type)
     {
@@ -897,7 +897,7 @@
         case TH_RE_TYPE_LIST:
         case TH_RE_TYPE_LIST_REVERSE:
             if ((cch = haystack[*offs]) == 0)
-                res = FALSE;
+                res = false;
             else
             {
                 res = th_regex_match_list(&node->match.list, cch);
@@ -911,17 +911,17 @@
 
         case TH_RE_TYPE_ANY_CHAR:
             if ((cch = haystack[*offs]) == 0)
-                res = FALSE;
+                res = false;
             else
             {
-                res = TRUE;
+                res = true;
                 (*offs)++;
             }
             break;
 
         case TH_RE_TYPE_CHAR:
             if ((cch = haystack[*offs]) == 0)
-                res = FALSE;
+                res = false;
             else
             {
                 res = (cch == node->match.chr);
@@ -930,13 +930,13 @@
             break;
 
         case TH_RE_TYPE_STR:
-            res = TRUE;
+            res = true;
             for (th_char_t *str = node->match.str;
                 res && *str != 0;
                 str++, (*offs)++)
             {
                 if (haystack[*offs] != *str)
-                    res = FALSE;
+                    res = false;
             }
             break;
     }
@@ -945,7 +945,7 @@
 }
 
 
-static BOOL th_regex_match_count(
+static bool th_regex_match_count(
     const th_char_t *haystack,
     size_t *offs,
     const th_regex_t *expr,
@@ -962,6 +962,7 @@
     {
         // Attempt to match the repeated node once
         size_t poffs = toffs;
+
         if (th_regex_match_one(haystack, &poffs, node, flags, level))
         {
             // Matched, increase count of repeats
@@ -1024,7 +1025,7 @@
     } while (haystack[toffs] != 0);
 
     // Check results
-    BOOL res = count >= node->repeatMin ||
+    bool res = count >= node->repeatMin ||
         (node->repeatMax > 0 && count >= node->repeatMax);
 
     if (res)
@@ -1041,7 +1042,7 @@
 }
 
 
-static BOOL th_regex_match_expr(
+static bool th_regex_match_expr(
     const th_char_t *haystack,
     size_t *offs,
     const th_regex_t *expr,
@@ -1050,7 +1051,7 @@
     const int level
     )
 {
-    BOOL res = TRUE;
+    bool res = true;
     size_t soffs = *offs;
 
     for (size_t nnode = startnode; res && nnode < expr->nnodes; nnode++)
--- a/th_strglob.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_strglob.c	Wed Dec 07 12:14:39 2022 +0200
@@ -6,14 +6,14 @@
  * Please read file 'COPYING' for information on license and distribution.
  */
 
-BOOL TH_STRGLOB_FUNC (const char *haystack, const char *pattern)
+bool TH_STRGLOB_FUNC (const char *haystack, const char *pattern)
 {
-    BOOL matched = TRUE, any = FALSE, end = FALSE;
+    bool matched = true, any = false, end = false;
     const char *tmp = NULL;
 
     // Check given pattern and string
     if (haystack == NULL || pattern == NULL)
-        return FALSE;
+        return false;
 
     // Start comparision
     while (matched && !end)
@@ -27,14 +27,14 @@
             haystack++;
         }
         else
-            matched = FALSE;
+            matched = false;
         break;
 
     case '*':
         pattern++;
         if (!*pattern || *pattern == '?')
-            end = TRUE;
-        any = TRUE;
+            end = true;
+        any = true;
         tmp = pattern;
         break;
 
@@ -44,37 +44,37 @@
             if (*haystack)
                 haystack++;
             else
-                end = TRUE;
+                end = true;
         }
         else
         if (*haystack)
         {
             if (tmp)
             {
-                any = TRUE;
+                any = true;
                 pattern = tmp;
             }
             else
-                matched = FALSE;
+                matched = false;
         }
         else
-            end = TRUE;
+            end = true;
         break;
 
     default:
         {
-            BOOL equals = TH_STRGLOB_COLLATE(*pattern) == TH_STRGLOB_COLLATE(*haystack);
+            bool equals = TH_STRGLOB_COLLATE(*pattern) == TH_STRGLOB_COLLATE(*haystack);
             if (any)
             {
                 if (equals)
                 {
-                    any = FALSE;
+                    any = false;
                 }
                 else
                 if (*haystack)
                     haystack++;
                 else
-                    matched = FALSE;
+                    matched = false;
             }
             else
             {
@@ -88,15 +88,15 @@
                 else
                 if (tmp)
                 {
-                    any = TRUE;
+                    any = true;
                     pattern = tmp;
                 }
                 else
-                    matched = FALSE;
+                    matched = false;
             }
 
             if (!*haystack && !*pattern)
-                end = TRUE;
+                end = true;
         }
         break;
     }
--- a/th_string.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_string.c	Wed Dec 07 12:14:39 2022 +0200
@@ -594,7 +594,7 @@
 int th_split_string_elems(const th_char_t *str, th_strelems_t *ctx, const th_char_t *sep)
 {
     size_t start = 0, end;
-    BOOL match = FALSE;
+    bool match = false;
 
     if (str == NULL || ctx == NULL || sep == NULL)
         return THERR_NULLPTR;
@@ -605,12 +605,12 @@
     do
     {
         // Split foremost str element out
-        match = FALSE;
+        match = false;
         for (end = start; str[end] != 0; end++)
         {
             if (th_strchr(sep, str[end]))
             {
-                match = TRUE;
+                match = true;
                 break;
             }
         }
@@ -786,7 +786,7 @@
 #include "th_strglob.c"
 
 
-BOOL th_get_hex_triplet(const th_char_t *str, unsigned int *value)
+bool th_get_hex_triplet(const th_char_t *str, unsigned int *value)
 {
     const th_char_t *p = str;
     int len;
@@ -812,22 +812,22 @@
             (*value) |= (*p - 'a') + 10;
         }
         else
-            return FALSE;
+            return false;
     }
 
     return (len >= 3 * 2 && len <= 4 * 2);
 }
 
 
-BOOL th_get_boolean(const th_char_t *str, BOOL *value)
+bool th_get_boolean(const th_char_t *str, bool *value)
 {
     if (!th_strcasecmp(str, "yes") ||
         !th_strcasecmp(str, "on") ||
         !th_strcasecmp(str, "true") ||
         !th_strcasecmp(str, "1"))
     {
-        *value = TRUE;
-        return TRUE;
+        *value = true;
+        return true;
     }
     else
     if (!th_strcasecmp(str, "no") ||
@@ -835,42 +835,42 @@
         !th_strcasecmp(str, "false") ||
         !th_strcasecmp(str, "0"))
     {
-        *value = FALSE;
-        return TRUE;
+        *value = false;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
 
-BOOL th_get_int(const th_char_t *str, unsigned int *value, BOOL *neg)
+bool th_get_int(const th_char_t *str, unsigned int *value, bool *neg)
 {
     int ch;
-    BOOL hex = FALSE;
+    bool hex = false;
 
     // Is the value negative?
     if (*str == '-')
     {
         if (neg == NULL)
-            return FALSE;
+            return false;
 
-        *neg = TRUE;
+        *neg = true;
         str++;
     }
     else
     if (neg != NULL)
-        *neg = FALSE;
+        *neg = false;
 
     // Is it hexadecimal?
     if (*str == '$')
     {
-        hex = TRUE;
+        hex = true;
         str++;
     }
     else
     if (str[0] == '0' && str[1] == 'x')
     {
-        hex = TRUE;
+        hex = true;
         str += 2;
     }
 
@@ -898,7 +898,7 @@
                 *value |= ch - 'a' + 10;
             }
             else
-                return FALSE;
+                return false;
         }
     }
     else
@@ -911,8 +911,8 @@
                 *value += ch - '0';
             }
             else
-                return FALSE;
+                return false;
         }
     }
-    return TRUE;
+    return true;
 }
--- a/th_string.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_string.h	Wed Dec 07 12:14:39 2022 +0200
@@ -188,11 +188,11 @@
 
 int 	    th_vprintf_put_int(th_vprintf_ctx *ctx, th_vprintf_putch vputch,
             va_list ap, const int f_radix, int f_flags, int f_width, int f_prec,
-            const BOOL f_unsig, th_vprintf_altfmt_func f_alt);
+            const bool f_unsig, th_vprintf_altfmt_func f_alt);
 
 int	    th_vprintf_put_int_format(th_vprintf_ctx *ctx, th_vprintf_putch vputch,
             th_char_t *buf, int f_flags, int f_width, int f_prec, int f_len, int vret,
-            BOOL f_neg, BOOL f_unsig, th_vprintf_altfmt_func f_alt);
+            bool f_neg, bool f_unsig, th_vprintf_altfmt_func f_alt);
 
 
 #define TH_VPRINTF_INTFMT_NAME th_vprintf_buf_int
@@ -210,7 +210,7 @@
 
 
 #ifdef TH_PRINTF_DEBUG
-extern BOOL th_printf_debug;
+extern bool th_printf_debug;
 extern char *th_printf_debug_prefix;
 #endif
 
@@ -221,12 +221,12 @@
 const th_char_t  *th_findsep(const th_char_t *str, size_t *pos, const th_char_t sep);
 const th_char_t  *th_findseporspace(const th_char_t *str, size_t *pos, const th_char_t sep);
 
-BOOL        th_strmatch(const th_char_t *haystack, const th_char_t *pattern);
-BOOL        th_strcasematch(const th_char_t *haystack, const th_char_t *pattern);
+bool        th_strmatch(const th_char_t *haystack, const th_char_t *pattern);
+bool        th_strcasematch(const th_char_t *haystack, const th_char_t *pattern);
 
-BOOL        th_get_hex_triplet(const th_char_t *str, unsigned int *value);
-BOOL        th_get_boolean(const th_char_t *str, BOOL *value);
-BOOL        th_get_int(const th_char_t *str, unsigned int *value, BOOL *neg);
+bool        th_get_hex_triplet(const th_char_t *str, unsigned int *value);
+bool        th_get_boolean(const th_char_t *str, bool *value);
+bool        th_get_int(const th_char_t *str, unsigned int *value, bool *neg);
 
 
 #ifdef __cplusplus
--- a/th_types.h	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_types.h	Wed Dec 07 12:14:39 2022 +0200
@@ -179,16 +179,12 @@
 
 /* Define a boolean type, if needed
  */
-#if !defined(FALSE) && !defined(TRUE) && !defined(BOOL)
-typedef enum { FALSE = 0, TRUE = 1 } BOOL;
-#endif
-
-#ifndef BOOL
-#    ifdef bool
-#        define BOOL bool
-#    else
-#        define BOOL int
-#    endif
+#if defined(HAVE_STDBOOL_H)
+#  include <stdbool.h>
+#elif !defined(false) && !defined(true) && !defined(bool)
+typedef enum { false = 0, true = 1 } bool;
+#else
+#  error Missing boolean definition and could not define our own.
 #endif
 
 
--- a/th_util.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_util.c	Wed Dec 07 12:14:39 2022 +0200
@@ -15,7 +15,7 @@
 
 /* Default settings
  */
-static BOOL    th_initialized = FALSE;
+static bool    th_initialized = false;
 int            th_verbosity = 2;
 char           *th_prog_name = NULL,
                *th_prog_desc = NULL,
@@ -45,7 +45,7 @@
     th_prog_license  = license;
 #endif
 
-    th_initialized = TRUE;
+    th_initialized = true;
 }
 
 
@@ -116,7 +116,7 @@
  */
 void THERR_V(const char *fmt, va_list ap)
 {
-    assert(th_initialized == TRUE);
+    assert(th_initialized == true);
 
     fprintf(stderr, "%s: ", th_prog_name);
     vfprintf(stderr, fmt, ap);
@@ -125,7 +125,7 @@
 
 void THMSG_V(int level, const char *fmt, va_list ap)
 {
-    assert(th_initialized == TRUE);
+    assert(th_initialized == true);
 
     if (th_verbosity >= level)
     {
@@ -137,7 +137,7 @@
 
 void THPRINT_V(int level, const char *fmt, va_list ap)
 {
-    assert(th_initialized == TRUE);
+    assert(th_initialized == true);
 
     if (th_verbosity >= level)
     {
@@ -149,7 +149,7 @@
 void THERR(const char *fmt, ...)
 {
     va_list ap;
-    assert(th_initialized == TRUE);
+    assert(th_initialized == true);
 
     va_start(ap, fmt);
     THERR_V(fmt, ap);
@@ -160,7 +160,7 @@
 void THMSG(int level, const char *fmt, ...)
 {
     va_list ap;
-    assert(th_initialized == TRUE);
+    assert(th_initialized == true);
 
     va_start(ap, fmt);
     THMSG_V(level, fmt, ap);
@@ -171,7 +171,7 @@
 void THPRINT(int level, const char *fmt, ...)
 {
     va_list ap;
-    assert(th_initialized == TRUE);
+    assert(th_initialized == true);
 
     va_start(ap, fmt);
     THPRINT_V(level, fmt, ap);