diff options
author | Guido van Rossum <guido@python.org> | 2002-07-20 00:38:01 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-07-20 00:38:01 (GMT) |
commit | 0b624f69b59597a4d88de46f1f5cc0751bf22887 (patch) | |
tree | f9f497d5ceac13f64a83ace859e6420b1fc2cab7 /Modules | |
parent | 65692578b7c934148b0bb6b4bddc4def21d008e2 (diff) | |
download | cpython-0b624f69b59597a4d88de46f1f5cc0751bf22887.zip cpython-0b624f69b59597a4d88de46f1f5cc0751bf22887.tar.gz cpython-0b624f69b59597a4d88de46f1f5cc0751bf22887.tar.bz2 |
unpack_string(): avoid a compiler warning (about a real bug!) by
copying the result of fgetc() into an int variable before testing it
for EOF.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_hotshot.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c index 7bd99c8..625d1ba 100644 --- a/Modules/_hotshot.c +++ b/Modules/_hotshot.c @@ -305,6 +305,7 @@ unpack_string(LogReaderObject *self, PyObject **pvalue) int i; int len; int err; + int ch; char *buf; if ((err = unpack_packed_int(self, &len, 0))) @@ -312,7 +313,9 @@ unpack_string(LogReaderObject *self, PyObject **pvalue) buf = malloc(len); for (i=0; i < len; i++) { - if ((buf[i] = fgetc(self->logfp)) == EOF) { + ch = fgetc(self->logfp); + buf[i] = ch; + if (ch == EOF) { free(buf); return ERR_EOF; } |