From 7ed1bf87a7ba67c8206acec4e6e80b9f87d09021 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 18 Jul 2020 00:08:06 -0500 Subject: [PATCH] Bugfix: f_string_range initialize macros need to consider used = 0 case. --- level_0/f_string/c/string_range.h | 2 +- level_0/f_utf/c/utf-common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/level_0/f_string/c/string_range.h b/level_0/f_string/c/string_range.h index 1d503b3..c3460b3 100644 --- a/level_0/f_string/c/string_range.h +++ b/level_0/f_string/c/string_range.h @@ -36,7 +36,7 @@ extern "C" { #define f_string_range_initialize { 1, 0 } - #define f_macro_string_range_initialize(length) { 0, length - 1 } + #define f_macro_string_range_initialize(length) { length ? 0 : 1, length ? length - 1 : 0 } #define f_macro_string_range_clear(range) \ range.start = 1; \ diff --git a/level_0/f_utf/c/utf-common.h b/level_0/f_utf/c/utf-common.h index d7f4643..d5e3960 100644 --- a/level_0/f_utf/c/utf-common.h +++ b/level_0/f_utf/c/utf-common.h @@ -192,7 +192,7 @@ extern "C" { #define f_utf_string_range_initialize { 1, 0 } - #define f_macro_utf_string_range_initialize(length) { 0, length - 1 } + #define f_macro_utf_string_range_initialize(length) { length ? 0 : 1, length ? length - 1 : 0 } #define f_macro_utf_string_range_new(status, utf_string_range, length) status = f_memory_new((void **) & utf_string_range, sizeof(f_utf_string_range), length) #define f_macro_utf_string_range_delete(status, utf_string_range, size) status = f_memory_delete((void **) & utf_string_range, sizeof(f_utf_string_range), size) -- 1.8.3.1