Lines 1421-1455
Link Here
|
1421 |
#define last(b) ((b)->bk) |
1421 |
#define last(b) ((b)->bk) |
1422 |
|
1422 |
|
1423 |
/* Take a chunk off a bin list */ |
1423 |
/* Take a chunk off a bin list */ |
1424 |
#define unlink(AV, P, BK, FD) { \ |
1424 |
#define unlink(AV, P, BK, FD) { \ |
1425 |
FD = P->fd; \ |
1425 |
FD = P->fd; \ |
1426 |
BK = P->bk; \ |
1426 |
BK = P->bk; \ |
1427 |
if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \ |
1427 |
if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \ |
1428 |
mutex_unlock(&(AV)->mutex); \ |
1428 |
mutex_unlock(&(AV)->mutex); \ |
1429 |
malloc_printerr (check_action, "corrupted double-linked list", P); \ |
1429 |
malloc_printerr (check_action, "corrupted linked list (main)", P); \ |
1430 |
mutex_lock(&(AV)->mutex); \ |
1430 |
mutex_lock(&(AV)->mutex); \ |
1431 |
} else { \ |
1431 |
} else { \ |
1432 |
FD->bk = BK; \ |
1432 |
FD->bk = BK; \ |
1433 |
BK->fd = FD; \ |
1433 |
BK->fd = FD; \ |
1434 |
if (!in_smallbin_range (P->size) \ |
1434 |
if (!in_smallbin_range (P->size) \ |
1435 |
&& __builtin_expect (P->fd_nextsize != NULL, 0)) { \ |
1435 |
&& __builtin_expect (P->fd_nextsize != NULL, 0)) { \ |
1436 |
assert (P->fd_nextsize->bk_nextsize == P); \ |
1436 |
if (__builtin_expect (P->fd_nextsize->bk_nextsize != P \ |
1437 |
assert (P->bk_nextsize->fd_nextsize == P); \ |
1437 |
|| P->bk_nextsize->fd_nextsize != P, 0)) { \ |
1438 |
if (FD->fd_nextsize == NULL) { \ |
1438 |
mutex_unlock(&(AV)->mutex); \ |
1439 |
if (P->fd_nextsize == P) \ |
1439 |
malloc_printerr (check_action, "corrupted linked list (large)", P); \ |
1440 |
FD->fd_nextsize = FD->bk_nextsize = FD; \ |
1440 |
mutex_lock(&(AV)->mutex); \ |
1441 |
else { \ |
1441 |
} else { \ |
1442 |
FD->fd_nextsize = P->fd_nextsize; \ |
1442 |
if (FD->fd_nextsize == NULL) { \ |
1443 |
FD->bk_nextsize = P->bk_nextsize; \ |
1443 |
if (P->fd_nextsize == P) \ |
1444 |
P->fd_nextsize->bk_nextsize = FD; \ |
1444 |
FD->fd_nextsize = FD->bk_nextsize = FD; \ |
1445 |
P->bk_nextsize->fd_nextsize = FD; \ |
1445 |
else { \ |
1446 |
} \ |
1446 |
FD->fd_nextsize = P->fd_nextsize; \ |
1447 |
} else { \ |
1447 |
FD->bk_nextsize = P->bk_nextsize; \ |
1448 |
P->fd_nextsize->bk_nextsize = P->bk_nextsize; \ |
1448 |
P->fd_nextsize->bk_nextsize = FD; \ |
1449 |
P->bk_nextsize->fd_nextsize = P->fd_nextsize; \ |
1449 |
P->bk_nextsize->fd_nextsize = FD; \ |
1450 |
} \ |
1450 |
} \ |
1451 |
} \ |
1451 |
} else { \ |
1452 |
} \ |
1452 |
P->fd_nextsize->bk_nextsize = P->bk_nextsize; \ |
|
|
1453 |
P->bk_nextsize->fd_nextsize = P->fd_nextsize; \ |
1454 |
} \ |
1455 |
} \ |
1456 |
} \ |
1457 |
} \ |
1453 |
} |
1458 |
} |
1454 |
|
1459 |
|
1455 |
/* |
1460 |
/* |