From ed2fb6d739912d19e7d471f10a152ba4001c3fa7 Mon Sep 17 00:00:00 2001 From: Koichiro IWAO Date: Tue, 12 Oct 2021 17:39:27 +0900 Subject: [PATCH] tests(g_strtrim): string copy is not necessary here --- tests/common/test_string_calls.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/common/test_string_calls.c b/tests/common/test_string_calls.c index c5df8478..cd15c72f 100644 --- a/tests/common/test_string_calls.c +++ b/tests/common/test_string_calls.c @@ -328,8 +328,7 @@ END_TEST START_TEST(test_strtrim__trim_left) { /* setup */ - const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; - char *output = g_strdup(input); + char output[] = "\t\t \tDone is better than perfect.\t\t \n\n"; /* test */ g_strtrim(output, 1); @@ -342,8 +341,7 @@ END_TEST START_TEST(test_strtrim__trim_right) { /* setup */ - const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; - char *output = g_strdup(input); + char output[] = "\t\t \tDone is better than perfect.\t\t \n\n"; /* test */ g_strtrim(output, 2); @@ -356,8 +354,7 @@ END_TEST START_TEST(test_strtrim__trim_both) { /* setup */ - const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; - char *output = g_strdup(input); + char output[] = "\t\t \tDone is better than perfect.\t\t \n\n"; /* test */ g_strtrim(output, 3); @@ -370,8 +367,7 @@ END_TEST START_TEST(test_strtrim__trim_through) { /* setup */ - const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; - char *output = g_strdup(input); + char output[] = "\t\t \tDone is better than perfect.\t\t \n\n"; /* test */ g_strtrim(output, 4);