Commit 7c47beb8 authored by Barry Warsaw's avatar Barry Warsaw

Two improvements suggested by Greg Stein:

PyString_FromFormatV(): In the final resize at the end, we can use
    PyString_AS_STRING() since we know the object is a string and can
    avoid the typechecking.

PyString_FromFormat(): GS sez: "For safety/propriety, you should call
    va_end() on the vargs variable."
parent 5a6fdcd3
......@@ -292,13 +292,14 @@ PyString_FromFormatV(const char *format, va_list vargs)
}
end:
_PyString_Resize(&string, s - PyString_AsString(string));
_PyString_Resize(&string, s - PyString_AS_STRING(string));
return string;
}
PyObject *
PyString_FromFormat(const char *format, ...)
{
PyObject* ret;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
......@@ -306,7 +307,9 @@ PyString_FromFormat(const char *format, ...)
#else
va_start(vargs);
#endif
return PyString_FromFormatV(format, vargs);
ret = PyString_FromFormatV(format, vargs);
va_end(vargs);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment