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

  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. --- a/lsmmc.c
  14. +++ b/lsmmc.c
  15. @@ -393,10 +393,9 @@ char *read_file(char *name)
  16. start++;
  17. len--;
  18. }
  19. - memmove(line, start, len);
  20. - line[len] = '\0';
  21. - return strdup(line);
  22. + start[len] = '\0';
  23. + return strdup(start);
  24. }
  25. /* Hexadecimal string parsing functions */