You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
827 B

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(-)
--- 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 */