Use the already calculated string length.

No point doing it twice.
This commit is contained in:
Bill Currie 2013-01-08 18:10:27 +09:00
parent 9155338404
commit d6bb5bec86

View file

@ -917,7 +917,7 @@ write_string (dstring_t *dstr, const char *str)
return;
}
// assume worst case of all octal chars plus two quotes.
dst = dstring_reservestr (dstr, strlen (str) * 4 + 2);
dst = dstring_reservestr (dstr, len * 4 + 2);
*dst++= '\"';
while (*str) {
if (*str && isascii ((byte) *str) && isprint ((byte) *str)