From 7769a4d7abe339ce273c13a203394a79a11fcff9 Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Mon, 20 Sep 2021 21:46:33 +0200 Subject: [PATCH] mmc-utils: One further optimization of trimming routine The last change to the trimming routine made it more efficient, however, we can even get rid of the memmove() as we leave the function with strdup() anyway. Signed-off-by: Michael Heimpold Reviewed-by: Wolfram Sang Acked-by: Avri Altman Link: https://lore.kernel.org/r/20210920194633.814-1-mhei@heimpold.de Signed-off-by: Ulf Hansson --- lsmmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lsmmc.c b/lsmmc.c index 06cc0b8..05d59e8 100644 --- a/lsmmc.c +++ b/lsmmc.c @@ -393,10 +393,9 @@ char *read_file(char *name) start++; len--; } - memmove(line, start, len); - line[len] = '\0'; - return strdup(line); + start[len] = '\0'; + return strdup(start); } /* Hexadecimal string parsing functions */