Commit 98e189da authored by Guido van Rossum's avatar Guido van Rossum

Vladimir Marangozov:

Change Py_Malloc/Realloc/Free calls to PyMem_Malloc/Realloc/Free +
PyErr_Nomemory on error check.  Py_Malloc c.s. are obsolete.
parent a7cfca23
...@@ -287,17 +287,17 @@ PyLocale_strxfrm(self,args) ...@@ -287,17 +287,17 @@ PyLocale_strxfrm(self,args)
return NULL; return NULL;
/* assume no change in size, first */ /* assume no change in size, first */
n1=strlen(s)+1; n1=strlen(s)+1;
buf=Py_Malloc(n1); buf=PyMem_Malloc(n1);
if(!buf)return NULL; if(!buf)return PyErr_NoMemory();
n2=strxfrm(buf,s,n1); n2=strxfrm(buf,s,n1);
if(n2>n1){ if(n2>n1){
/* more space needed */ /* more space needed */
buf=Py_Realloc(buf,n2); buf=PyMem_Realloc(buf,n2);
if(!buf)return NULL; if(!buf)return PyErr_NoMemory();
strxfrm(buf,s,n2); strxfrm(buf,s,n2);
} }
result=PyString_FromString(buf); result=PyString_FromString(buf);
Py_Free(buf); PyMem_Free(buf);
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment