]> granicus.if.org Git - python/commit
fix marshal uninitialized variable warnings (#4114)
authorBenjamin Peterson <benjamin@python.org>
Wed, 25 Oct 2017 06:09:55 +0000 (23:09 -0700)
committerGitHub <noreply@github.com>
Wed, 25 Oct 2017 06:09:55 +0000 (23:09 -0700)
commit88d5e2c938b014885044f1cfd016e62798f07fd2
treea613aacd228dff102ec83ec85f8c3b932cbbfc85
parent04c0a4038e8764f742de8505600b8ee97ee50776
fix marshal uninitialized variable warnings (#4114)

GCC says:
../cpython/Python/marshal.c: In function ‘PyMarshal_WriteLongToFile’:
../cpython/Python/marshal.c:70:35: warning: ‘wf.ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                       else if ((p)->ptr != (p)->end) *(p)->ptr++ = (c); \
                                   ^~
../cpython/Python/marshal.c:70:47: warning: ‘wf.end’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                       else if ((p)->ptr != (p)->end) *(p)->ptr++ = (c); \
                                               ^~
../cpython/Python/marshal.c:77:10: warning: ‘wf.str’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (p->str == NULL)
         ~^~~~~

This isn't a real problem because if the file pointer is not NULL, the
string-related fields are never touched. But, it doesn't hurt to set the unused
fields to NULL.
Python/marshal.c