Commit 9ed83c4
authored
Cleanup pymalloc:
* Rename _PyObject_Alloc() to pymalloc_alloc()
* Rename _PyObject_FreeImpl() to pymalloc_free()
* Rename _PyObject_Realloc() to pymalloc_realloc()
* pymalloc_alloc() and pymalloc_realloc() don't fallback on the raw
allocator anymore, it now must be done by the caller
* Add "success" and "failed" labels to pymalloc_alloc() and
pymalloc_free()
* pymalloc_alloc() and pymalloc_free() don't update
num_allocated_blocks anymore: it should be done in the caller
* _PyObject_Calloc() is now responsible to fill the memory block
allocated by pymalloc with zeros
* Simplify pymalloc_alloc() prototype
* _PyObject_Realloc() now calls _PyObject_Malloc() rather than
calling directly pymalloc_alloc()
_PyMem_DebugRawAlloc() and _PyMem_DebugRawRealloc():
* document the layout of a memory block
* don't increase the serial number if the allocation failed
* check for integer overflow before computing the total size
* add a 'data' variable to make the code easiler to follow
test_setallocators() of _testcapimodule.c now test also the context.
1 parent ec2cbdd commit 9ed83c4
2 files changed
Lines changed: 565 additions & 479 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3273 | 3273 | | |
3274 | 3274 | | |
3275 | 3275 | | |
| 3276 | + | |
3276 | 3277 | | |
3277 | 3278 | | |
3278 | | - | |
| 3279 | + | |
3279 | 3280 | | |
3280 | 3281 | | |
| 3282 | + | |
3281 | 3283 | | |
3282 | 3284 | | |
3283 | 3285 | | |
3284 | 3286 | | |
3285 | | - | |
| 3287 | + | |
3286 | 3288 | | |
3287 | 3289 | | |
| 3290 | + | |
3288 | 3291 | | |
3289 | 3292 | | |
3290 | 3293 | | |
3291 | 3294 | | |
3292 | 3295 | | |
3293 | | - | |
| 3296 | + | |
3294 | 3297 | | |
3295 | 3298 | | |
| 3299 | + | |
3296 | 3300 | | |
3297 | 3301 | | |
3298 | 3302 | | |
3299 | 3303 | | |
3300 | 3304 | | |
3301 | | - | |
| 3305 | + | |
3302 | 3306 | | |
3303 | 3307 | | |
| 3308 | + | |
3304 | 3309 | | |
3305 | 3310 | | |
3306 | 3311 | | |
| |||
3325 | 3330 | | |
3326 | 3331 | | |
3327 | 3332 | | |
| 3333 | + | |
3328 | 3334 | | |
| 3335 | + | |
3329 | 3336 | | |
3330 | 3337 | | |
3331 | 3338 | | |
| |||
3334 | 3341 | | |
3335 | 3342 | | |
3336 | 3343 | | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
3337 | 3351 | | |
3338 | 3352 | | |
3339 | 3353 | | |
3340 | 3354 | | |
3341 | | - | |
| 3355 | + | |
3342 | 3356 | | |
3343 | 3357 | | |
3344 | 3358 | | |
| |||
3357 | 3371 | | |
3358 | 3372 | | |
3359 | 3373 | | |
3360 | | - | |
| 3374 | + | |
3361 | 3375 | | |
3362 | 3376 | | |
3363 | 3377 | | |
| |||
3371 | 3385 | | |
3372 | 3386 | | |
3373 | 3387 | | |
| 3388 | + | |
3374 | 3389 | | |
3375 | 3390 | | |
3376 | 3391 | | |
3377 | 3392 | | |
3378 | 3393 | | |
| 3394 | + | |
3379 | 3395 | | |
3380 | 3396 | | |
3381 | 3397 | | |
| |||
3390 | 3406 | | |
3391 | 3407 | | |
3392 | 3408 | | |
3393 | | - | |
| 3409 | + | |
3394 | 3410 | | |
3395 | 3411 | | |
3396 | 3412 | | |
3397 | 3413 | | |
3398 | 3414 | | |
| 3415 | + | |
3399 | 3416 | | |
3400 | 3417 | | |
3401 | 3418 | | |
3402 | 3419 | | |
3403 | 3420 | | |
3404 | 3421 | | |
3405 | 3422 | | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
3406 | 3429 | | |
3407 | 3430 | | |
3408 | 3431 | | |
| |||
3413 | 3436 | | |
3414 | 3437 | | |
3415 | 3438 | | |
| 3439 | + | |
| 3440 | + | |
3416 | 3441 | | |
3417 | 3442 | | |
3418 | 3443 | | |
| |||
0 commit comments