@@ -274,32 +274,35 @@ 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 } },
285- { 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 }},
285+ {0 }
286286};
287287
288288/* Get a pointer to the correct arena for this context. In this case where we
289289 * are using a round-robin approach to the statically allocated arenas, we will
290290 * return the arena that is assigned to the thread on first use.
291291 */
292- ImagingMemoryArena ImagingGetArena (void ) {
292+ ImagingMemoryArena
293+ ImagingGetArena (void ) {
293294 if (ImagingArenaThreadIndex == UINT64_MAX ) {
294- ImagingArenaThreadIndex = _Py_atomic_add_uint64 (& ImagingArenaIndex , 1 ) % IMAGING_ARENAS_COUNT ;
295+ ImagingArenaThreadIndex =
296+ _Py_atomic_add_uint64 (& ImagingArenaIndex , 1 ) % IMAGING_ARENAS_COUNT ;
295297 }
296298 return & ImagingArenas [ImagingArenaThreadIndex ];
297299}
298300
299301/* Return the arena associated with the given image. In this case the index of
300302 * the arena is stored on the image itself.
301303 */
302- ImagingMemoryArena ImagingGetArenaFromImaging (Imaging im ) {
304+ ImagingMemoryArena
305+ ImagingGetArenaFromImaging (Imaging im ) {
303306 int arenaindex = im -> arenaindex ;
304307 assert (arenaindex >= 0 && arenaindex < IMAGING_ARENAS_COUNT );
305308 return & ImagingArenas [arenaindex ];
@@ -309,7 +312,8 @@ ImagingMemoryArena ImagingGetArenaFromImaging(Imaging im) {
309312 * is necessary in order to return the blocks to the correct arena when the
310313 * image is destroyed.
311314 */
312- static void ImagingSetArenaOnImaging (Imaging im , ImagingMemoryArena arena ) {
315+ static void
316+ ImagingSetArenaOnImaging (Imaging im , ImagingMemoryArena arena ) {
313317 im -> arenaindex = arena -> index ;
314318}
315319#else
@@ -340,7 +344,8 @@ struct ImagingMemoryArena ImagingDefaultArena = {
340344 * either have the GIL or we do not have TLS, we will return only the default
341345 * arena.
342346 */
343- ImagingMemoryArena ImagingGetArena (void ) {
347+ ImagingMemoryArena
348+ ImagingGetArena (void ) {
344349 return & ImagingDefaultArena ;
345350}
346351
@@ -589,9 +594,7 @@ ImagingNewInternal(const char *mode, int xsize, int ysize, int dirty) {
589594 ImagingSetArenaOnImaging (im , arena );
590595
591596 MUTEX_LOCK (& arena -> mutex );
592- Imaging tmp = ImagingAllocateArray (
593- im , arena , dirty , arena -> block_size
594- );
597+ Imaging tmp = ImagingAllocateArray (im , arena , dirty , arena -> block_size );
595598 MUTEX_UNLOCK (& arena -> mutex );
596599 if (tmp ) {
597600 return im ;
0 commit comments