[PATCH v3] mmc-utils: One further optimization of trimming routine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
Reviewed-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
---

While doing some house-keeping, I found this somewhat older
patch still hanging around (v2 was sent on 2018-12-08).
I'm just resending to check what's the current opinion
about it :-)

 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




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux