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
effective.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Chris Ball <chris@printf.net>
1 file changed