]> Kevux Git Server - fll/commitdiff
Bugfix: correctly calculate terminating null for fl_string_dynamic_terminate_after()
authorKevin Day <thekevinday@gmail.com>
Thu, 4 Jun 2020 03:32:20 +0000 (22:32 -0500)
committerKevin Day <thekevinday@gmail.com>
Thu, 4 Jun 2020 03:32:20 +0000 (22:32 -0500)
level_1/fl_string/c/string.c

index 7b2614f1b5f8e5690a15b903ea913d93b446bf23..0a47988a6e566422f376b69f0d69b0fdd544a3c8 100644 (file)
@@ -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
     }