| 596 | /******************************************************************************/ |
| 597 | |
| 598 | static unsigned |
| 599 | arenas_i2a_impl(size_t i, bool compat, bool validate) { |
| 600 | unsigned a; |
| 601 | |
| 602 | switch (i) { |
| 603 | case MALLCTL_ARENAS_ALL: |
| 604 | a = 0; |
| 605 | break; |
| 606 | case MALLCTL_ARENAS_DESTROYED: |
| 607 | a = 1; |
| 608 | break; |
| 609 | default: |
| 610 | if (compat && i == ctl_arenas->narenas) { |
| 611 | /* |
| 612 | * Provide deprecated backward compatibility for |
| 613 | * accessing the merged stats at index narenas rather |
| 614 | * than via MALLCTL_ARENAS_ALL. This is scheduled for |
| 615 | * removal in 6.0.0. |
| 616 | */ |
| 617 | a = 0; |
| 618 | } else if (validate && i >= ctl_arenas->narenas) { |
| 619 | a = UINT_MAX; |
| 620 | } else { |
| 621 | /* |
| 622 | * This function should never be called for an index |
| 623 | * more than one past the range of indices that have |
| 624 | * initialized ctl data. |
| 625 | */ |
| 626 | assert(i < ctl_arenas->narenas || (!validate && i == |
| 627 | ctl_arenas->narenas)); |
| 628 | a = (unsigned)i + 2; |
| 629 | } |
| 630 | break; |
| 631 | } |
| 632 | |
| 633 | return a; |
| 634 | } |
| 635 | |
| 636 | static unsigned |
| 637 | arenas_i2a(size_t i) { |
no outgoing calls
no test coverage detected