From: Kevin Day Date: Thu, 4 Jun 2020 03:32:20 +0000 (-0500) Subject: Bugfix: correctly calculate terminating null for fl_string_dynamic_terminate_after() X-Git-Tag: 0.5.0~222 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=f5eeef4710c3a96ea3eac0d392c257502d3b193e;p=fll Bugfix: correctly calculate terminating null for fl_string_dynamic_terminate_after() --- diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 7b2614f..0a47988 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -1070,8 +1070,8 @@ extern "C" { #endif // _di_level_1_parameter_checking_ if (destination->used > 0) { - for (f_string_length i = destination->used; i > 0; i--, destination->used--) { - if (destination->string[i] == 0) continue; + for (; destination->used > 0; destination->used--) { + if (destination->string[destination->used - 1] == 0) continue; break; } // for }