Mercurial > cpython-lru_cache-weakref
changeset 39587:bbef2ecdee33 2.4
Patch #1540329: _hotshot.c fix backports.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 19 Aug 2006 07:48:06 +0000 |
| parents | e7a5b287f27c |
| children | 2f6b42aead94 |
| files | Modules/_hotshot.c |
| diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/_hotshot.c Fri Aug 18 13:56:50 2006 +0000 +++ b/Modules/_hotshot.c Sat Aug 19 07:48:06 2006 +0000 @@ -308,7 +308,12 @@ if ((err = unpack_packed_int(self, &len, 0))) return err; - buf = malloc(len); + buf = (char *)malloc(len); + if (!buf) { + PyErr_NoMemory(); + return ERR_EXCEPTION; + } + for (i=0; i < len; i++) { ch = fgetc(self->logfp); buf[i] = ch; @@ -1398,11 +1403,11 @@ char *buffer; int i = 0; - while (*rev && !isdigit((int)*rev)) + while (*rev && !isdigit(Py_CHARMASK(*rev))) ++rev; while (rev[i] != ' ' && rev[i] != '\0') ++i; - buffer = malloc(i + 1); + buffer = (char *)malloc(i + 1); if (buffer != NULL) { memmove(buffer, rev, i); buffer[i] = '\0';
