36 lines
900 B
Diff
36 lines
900 B
Diff
|
From 3539243dcab7b84bb8a45e2c2da80e162284bffc Mon Sep 17 00:00:00 2001
|
||
|
From: Michael Heimpold <mhei@heimpold.de>
|
||
|
Date: Sat, 8 Dec 2018 10:43:01 +0100
|
||
|
Subject: [PATCH] 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 <mhei@heimpold.de>
|
||
|
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
|
||
|
---
|
||
|
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 */
|
||
|
--
|
||
|
2.17.1
|
||
|
|