univalue: make spaceStr thread-safe

Simply add spaces to the existing string instead of using a
temporary.

Fixes #4756.
Merge pull request #4851

41ef558 univalue: make spaceStr thread-safe (Wladimir J. van der Laan)