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.

35 lines
900 B

  1. From 3539243dcab7b84bb8a45e2c2da80e162284bffc Mon Sep 17 00:00:00 2001
  2. From: Michael Heimpold <mhei@heimpold.de>
  3. Date: Sat, 8 Dec 2018 10:43:01 +0100
  4. Subject: [PATCH] One further optimization of trimming routine
  5. The last change to the trimming routine made it more efficient,
  6. however, we can even get rid of the memmove() as we leave the
  7. function with strdup() anyway.
  8. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
  9. Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
  10. ---
  11. lsmmc.c | 5 ++---
  12. 1 file changed, 2 insertions(+), 3 deletions(-)
  13. diff --git a/lsmmc.c b/lsmmc.c
  14. index 06cc0b8..05d59e8 100644
  15. --- a/lsmmc.c
  16. +++ b/lsmmc.c
  17. @@ -393,10 +393,9 @@ char *read_file(char *name)
  18. start++;
  19. len--;
  20. }
  21. - memmove(line, start, len);
  22. - line[len] = '\0';
  23. - return strdup(line);
  24. + start[len] = '\0';
  25. + return strdup(start);
  26. }
  27. /* Hexadecimal string parsing functions */
  28. --
  29. 2.17.1