[Python-checkins] r51405 - python/branches/release24-maint/Modules/_hotshot.c
georg.brandl
python-checkins at python.org
Sat Aug 19 09:48:07 CEST 2006
Author: georg.brandl
Date: Sat Aug 19 09:48:06 2006
New Revision: 51405
Modified:
python/branches/release24-maint/Modules/_hotshot.c
Log:
Patch #1540329: _hotshot.c fix backports.
Modified: python/branches/release24-maint/Modules/_hotshot.c
==============================================================================
--- python/branches/release24-maint/Modules/_hotshot.c (original)
+++ python/branches/release24-maint/Modules/_hotshot.c Sat Aug 19 09:48:06 2006
@@ -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';
More information about the Python-checkins
mailing list