mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-07 21:33:28 +03:00
no reasons to release GIL for one calloc
This commit is contained in:
parent
acb19d8e45
commit
430c53707f
|
@ -46,11 +46,9 @@ int ImagingNewCount = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Imaging
|
Imaging
|
||||||
ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize,
|
ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize, int size)
|
||||||
int size)
|
|
||||||
{
|
{
|
||||||
Imaging im;
|
Imaging im;
|
||||||
ImagingSectionCookie cookie;
|
|
||||||
|
|
||||||
im = (Imaging) calloc(1, size);
|
im = (Imaging) calloc(1, size);
|
||||||
if (!im)
|
if (!im)
|
||||||
|
@ -212,14 +210,10 @@ ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize,
|
||||||
/* Setup image descriptor */
|
/* Setup image descriptor */
|
||||||
strcpy(im->mode, mode);
|
strcpy(im->mode, mode);
|
||||||
|
|
||||||
ImagingSectionEnter(&cookie);
|
|
||||||
|
|
||||||
/* Pointer array (allocate at least one line, to avoid MemoryError
|
/* Pointer array (allocate at least one line, to avoid MemoryError
|
||||||
exceptions on platforms where calloc(0, x) returns NULL) */
|
exceptions on platforms where calloc(0, x) returns NULL) */
|
||||||
im->image = (char **) calloc((ysize > 0) ? ysize : 1, sizeof(void *));
|
im->image = (char **) calloc((ysize > 0) ? ysize : 1, sizeof(void *));
|
||||||
|
|
||||||
ImagingSectionLeave(&cookie);
|
|
||||||
|
|
||||||
if (!im->image) {
|
if (!im->image) {
|
||||||
free(im);
|
free(im);
|
||||||
return (Imaging) ImagingError_MemoryError();
|
return (Imaging) ImagingError_MemoryError();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user