From 7c47beb860fcea2029850f1036fe1be216aab78e Mon Sep 17 00:00:00 2001
From: Barry Warsaw <barry@python.org>
Date: Mon, 27 Aug 2001 03:11:09 +0000
Subject: 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."
---
 Objects/stringobject.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 9ea32a2..1332881 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -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;
 }
 
 
-- 
cgit v0.12

