NUMPY_API * Reallocate/resize memory for array data. */
| 339 | * Reallocate/resize memory for array data. |
| 340 | */ |
| 341 | NPY_NO_EXPORT void * |
| 342 | PyDataMem_RENEW(void *ptr, size_t size) |
| 343 | { |
| 344 | void *result; |
| 345 | |
| 346 | assert(size != 0); |
| 347 | result = realloc(ptr, size); |
| 348 | if (result != ptr) { |
| 349 | PyTraceMalloc_Untrack(NPY_TRACE_DOMAIN, (npy_uintp)ptr); |
| 350 | } |
| 351 | PyTraceMalloc_Track(NPY_TRACE_DOMAIN, (npy_uintp)result, size); |
| 352 | if (_PyDataMem_eventhook != NULL) { |
| 353 | NPY_ALLOW_C_API_DEF |
| 354 | NPY_ALLOW_C_API |
| 355 | if (_PyDataMem_eventhook != NULL) { |
| 356 | (*_PyDataMem_eventhook)(ptr, result, size, |
| 357 | _PyDataMem_eventhook_user_data); |
| 358 | } |
| 359 | NPY_DISABLE_C_API |
| 360 | } |
| 361 | return result; |
| 362 | } |
| 363 | |
| 364 | // The default data mem allocator malloc routine does not make use of a ctx. |
| 365 | // It should be called only through PyDataMem_UserNEW |
nothing calls this directly
no outgoing calls
no test coverage detected