@@ -274,31 +274,34 @@ static IMAGING_TLS uint64_t ImagingArenaThreadIndex = UINT64_MAX;
274274
275275/* These are the statically-allocated arenas. */
276276struct ImagingMemoryArena ImagingArenas [IMAGING_ARENAS_COUNT ] = {
277- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 0 , {0 } },
278- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 1 , {0 } },
279- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 2 , {0 } },
280- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 3 , {0 } },
281- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 4 , {0 } },
282- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 5 , {0 } },
283- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 6 , {0 } },
284- { 1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 7 , {0 } }
277+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 0 , {0 }},
278+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 1 , {0 }},
279+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 2 , {0 }},
280+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 3 , {0 }},
281+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 4 , {0 }},
282+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 5 , {0 }},
283+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 6 , {0 }},
284+ {1 , IMAGING_ARENA_BLOCK_SIZE , 0 , 0 , NULL , 0 , 0 , 0 , 0 , 0 , 7 , {0 }}
285285};
286286
287287/* Get a pointer to the correct arena for this context. In this case where we
288288 * are using a round-robin approach to the statically allocated arenas, we will
289289 * return the arena that is assigned to the thread on first use.
290290 */
291- ImagingMemoryArena ImagingGetArena (void ) {
291+ ImagingMemoryArena
292+ ImagingGetArena (void ) {
292293 if (ImagingArenaThreadIndex == UINT64_MAX ) {
293- ImagingArenaThreadIndex = _Py_atomic_add_uint64 (& ImagingArenaIndex , 1 ) % IMAGING_ARENAS_COUNT ;
294+ ImagingArenaThreadIndex =
295+ _Py_atomic_add_uint64 (& ImagingArenaIndex , 1 ) % IMAGING_ARENAS_COUNT ;
294296 }
295297 return & ImagingArenas [ImagingArenaThreadIndex ];
296298}
297299
298300/* Return the arena associated with the given image. In this case the index of
299301 * the arena is stored on the image itself.
300302 */
301- ImagingMemoryArena ImagingGetArenaFromImaging (Imaging im ) {
303+ ImagingMemoryArena
304+ ImagingGetArenaFromImaging (Imaging im ) {
302305 int arenaindex = im -> arenaindex ;
303306 assert (arenaindex >= 0 && arenaindex < IMAGING_ARENAS_COUNT );
304307 return & ImagingArenas [arenaindex ];
@@ -308,7 +311,8 @@ ImagingMemoryArena ImagingGetArenaFromImaging(Imaging im) {
308311 * is necessary in order to return the blocks to the correct arena when the
309312 * image is destroyed.
310313 */
311- static void ImagingSetArenaOnImaging (Imaging im , ImagingMemoryArena arena ) {
314+ static void
315+ ImagingSetArenaOnImaging (Imaging im , ImagingMemoryArena arena ) {
312316 im -> arenaindex = arena -> index ;
313317}
314318#else
@@ -339,7 +343,8 @@ struct ImagingMemoryArena ImagingDefaultArena = {
339343 * either have the GIL or we do not have TLS, we will return only the default
340344 * arena.
341345 */
342- ImagingMemoryArena ImagingGetArena (void ) {
346+ ImagingMemoryArena
347+ ImagingGetArena (void ) {
343348 return & ImagingDefaultArena ;
344349}
345350
@@ -588,9 +593,7 @@ ImagingNewInternal(const char *mode, int xsize, int ysize, int dirty) {
588593 ImagingSetArenaOnImaging (im , arena );
589594
590595 MUTEX_LOCK (& arena -> mutex );
591- Imaging tmp = ImagingAllocateArray (
592- im , arena , dirty , arena -> block_size
593- );
596+ Imaging tmp = ImagingAllocateArray (im , arena , dirty , arena -> block_size );
594597 MUTEX_UNLOCK (& arena -> mutex );
595598 if (tmp ) {
596599 return im ;
0 commit comments