mmc-utils: One further optimization of trimming routine
PATCH v3 1/1 mmc-utils: 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.
---
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(-)
lsmmc.c +2 -3
@@ -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 */
Signature · 1 line
2.17.1
Quoted 7 lines
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 withstrdup()anyway.Signed-off-by Michael Heimpold <[email protected]>Reviewed-by Wolfram Sang <[email protected]>
Quoted 29 lines
---
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(-)lsmmc.c +2
-4@@ -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
Ulf Hansson
AppliedQuoted 7 lines · Michael Heimpold
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 withstrdup()anyway.Signed-off-by Michael Heimpold <[email protected]>Reviewed-by Wolfram Sang <[email protected]>
Applied to the master branch at
https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git, thanks!
Kind regards
Uffe
Quoted 30 lines
---
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(-)lsmmc.c +2
-4@@ -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