]> granicus.if.org Git - python/commitdiff
Silence a gcc "may be used uninitialized" compiler warning. Not true.
authorGregory P. Smith <greg@krypto.org>
Sun, 26 Apr 2015 06:51:39 +0000 (23:51 -0700)
committerGregory P. Smith <greg@krypto.org>
Sun, 26 Apr 2015 06:51:39 +0000 (23:51 -0700)
Initializing retval prevents the naive warning.

Python/pystrhex.c

index a20e30747b76bb672da139bf132bf015b1478792..1259ed12dffe5c9bb690698f5398a7f8c32ba06b 100644 (file)
@@ -18,6 +18,7 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
         retbuf = (Py_UCS1*) PyMem_Malloc(arglen*2);
        if (!retbuf)
            return PyErr_NoMemory();
+        retval = NULL;  /* silence a compiler warning, assigned later. */
     } else {
        retval = PyUnicode_New(arglen*2, 127);
        if (!retval)