| 680 | /******************************************************************************/ |
| 681 | |
| 682 | static unsigned |
| 683 | arenas_i2a_impl(size_t i, bool compat, bool validate) { |
| 684 | unsigned a; |
| 685 | |
| 686 | switch (i) { |
| 687 | case MALLCTL_ARENAS_ALL: |
| 688 | a = 0; |
| 689 | break; |
| 690 | case MALLCTL_ARENAS_DESTROYED: |
| 691 | a = 1; |
| 692 | break; |
| 693 | default: |
| 694 | if (compat && i == ctl_arenas->narenas) { |
| 695 | /* |
| 696 | * Provide deprecated backward compatibility for |
| 697 | * accessing the merged stats at index narenas rather |
| 698 | * than via MALLCTL_ARENAS_ALL. This is scheduled for |
| 699 | * removal in 6.0.0. |
| 700 | */ |
| 701 | a = 0; |
| 702 | } else if (validate && i >= ctl_arenas->narenas) { |
| 703 | a = UINT_MAX; |
| 704 | } else { |
| 705 | /* |
| 706 | * This function should never be called for an index |
| 707 | * more than one past the range of indices that have |
| 708 | * initialized ctl data. |
| 709 | */ |
| 710 | assert(i < ctl_arenas->narenas || (!validate && i == |
| 711 | ctl_arenas->narenas)); |
| 712 | a = (unsigned)i + 2; |
| 713 | } |
| 714 | break; |
| 715 | } |
| 716 | |
| 717 | return a; |
| 718 | } |
| 719 | |
| 720 | static unsigned |
| 721 | arenas_i2a(size_t i) { |
no outgoing calls
no test coverage detected