[Python-checkins] cpython: Silence a gcc "may be used uninitialized" compiler warning. Not true.

gregory.p.smith python-checkins at python.org
Sun Apr 26 08:51:50 CEST 2015


https://hg.python.org/cpython/rev/106c5ee3c024
changeset:   95806:106c5ee3c024
user:        Gregory P. Smith <greg at krypto.org>
date:        Sat Apr 25 23:51:39 2015 -0700
summary:
  Silence a gcc "may be used uninitialized" compiler warning.  Not true.
Initializing retval prevents the naive warning.

files:
  Python/pystrhex.c |  1 +
  1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/Python/pystrhex.c b/Python/pystrhex.c
--- a/Python/pystrhex.c
+++ b/Python/pystrhex.c
@@ -18,6 +18,7 @@
         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)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list