From e1d21149b99fbb72b8d815a387a5bcba7502fd14 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 27 Apr 2020 23:15:56 -0500 Subject: [PATCH] Update: only resize if necessary when processing string Avoid unnecessary work. --- level_1/fl_string/c/private-string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index f46b5b7..99976c3 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -182,7 +182,7 @@ extern "C" { if (result == 0) { f_macro_string_dynamic_new(status, (*result), size); } - else { + else if (size > result->size) { f_macro_string_dynamic_resize(status, (*result), size); } @@ -207,7 +207,7 @@ extern "C" { if (result == 0) { f_macro_string_dynamic_new(status, (*result), size); } - else { + else if (size > result->size) { f_macro_string_dynamic_resize(status, (*result), size); } -- 1.8.3.1