]> granicus.if.org Git - python/commitdiff
PyFloat_FromString(): Move s_buffer[] up to the top-level function
authorBarry Warsaw <barry@python.org>
Fri, 18 Aug 2000 05:00:03 +0000 (05:00 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 18 Aug 2000 05:00:03 +0000 (05:00 +0000)
scope.  Previously, s_buffer[] was defined inside the
PyUnicode_Check() scope, but referred to in the outer scope via
assignment to s.  This quiets an Insure portability warning.

Objects/floatobject.c

index 26b39e89212e11a9d6bb2a2bbfeb1a428ee3e8f8..5650b41302e59dc11d4d84292a4cf5f67a6b34e0 100644 (file)
@@ -133,6 +133,7 @@ PyFloat_FromString(PyObject *v, char **pend)
        const char *s, *last, *end;
        double x;
        char buffer[256]; /* For errors */
+       char s_buffer[256];
        int len;
 
        if (PyString_Check(v)) {
@@ -140,8 +141,6 @@ PyFloat_FromString(PyObject *v, char **pend)
                len = PyString_GET_SIZE(v);
        }
        else if (PyUnicode_Check(v)) {
-               char s_buffer[256];
-
                if (PyUnicode_GET_SIZE(v) >= sizeof(s_buffer)) {
                        PyErr_SetString(PyExc_ValueError,
                                 "float() literal too large to convert");