Index: generic/nsfError.c =================================================================== diff -u -r836e08bf2af69a30dcd2cf6bb2e19f97d798b98a -rc84389e914e1747d194fa33f9e03412d43546fe8 --- generic/nsfError.c (.../nsfError.c) (revision 836e08bf2af69a30dcd2cf6bb2e19f97d798b98a) +++ generic/nsfError.c (.../nsfError.c) (revision c84389e914e1747d194fa33f9e03412d43546fe8) @@ -81,10 +81,20 @@ failure = (result > avail); #endif - if (failure) { + if (likely(failure == 0)) { + /* + * vsnprintf() has already copied all content, + * we have just to adjust the length. + */ + Tcl_DStringSetLength(dsPtr, offset + result); + } else { int addedStringLength; + /* + * vsnprintf() has already not copied all content, + * we have to determine the required length (MS), + * adjust the DString size and copy again. + */ #if defined(_MSC_VER) - /* Compute the required size of the Tcl_DString */ va_copy(vargsCopy, vargs); addedStringLength = _vscprintf(fmt, vargsCopy); va_end(vargsCopy);