Don't add space after comma unless there was already one (prevents a rare overflow). Optimize loop slightly. Don't exit if realloc can't shrink a buffer (just continue and use the larger buffer).
Don't add space after comma unless there was already one (prevents a
rare overflow). Optimize loop slightly. Don't exit if realloc can't
shrink a buffer (just continue and use the larger buffer).

Obtained from:	OpenBSD
MFC after:	2 weeks

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase