fix GCC7 build by refactoring trimming routines

I got a compile error with GCC7. When trimming white spaces from strings
lsmmc uses strncpy with overlapping memory areas. This is not allowed.
In addition, the implementation was not efficient with calling strlen
and strncpy once per iteration. Refactor the code to be valid and more

Signed-off-by: Wolfram Sang <>
Signed-off-by: Chris Ball <>
1 file changed