| 289 | |
| 290 | |
| 291 | Py_ssize_t numexpr_set_tempsize(Py_ssize_t newSize) { |
| 292 | |
| 293 | // printf( "DEBUG: setting temporary space to %d bytes.\n", newSize ); |
| 294 | // The bytes of pre-allocated space for temporaries PER THREAD. |
| 295 | Py_ssize_t oldSize = gs.tempSize; |
| 296 | if( newSize <= 0) { |
| 297 | // Free space for hibernation |
| 298 | gs.tempSize = 0; |
| 299 | free( gs.tempArena ); |
| 300 | |
| 301 | } else if( oldSize <= 0 ) { |
| 302 | // Space was deallocated or never initialized. |
| 303 | gs.tempSize = newSize; |
| 304 | gs.tempArena = (char *)malloc(gs.tempSize); |
| 305 | |
| 306 | } else { |
| 307 | // We can use realloc here. |
| 308 | gs.tempSize = newSize; |
| 309 | gs.tempArena = (char *)realloc(gs.tempArena, gs.tempSize); |
| 310 | } |
| 311 | return oldSize; |
| 312 | } |
| 313 | |
| 314 | PyDoc_STRVAR(SetTempSize__doc__, |
| 315 | "set_tempsize(int size) -- Sets the size of the temporary array arena. If you \ |
no outgoing calls
no test coverage detected
searching dependent graphs…