| 761 | } |
| 762 | |
| 763 | static bool |
| 764 | malloc_conf_next(char const **opts_p, char const **k_p, size_t *klen_p, |
| 765 | char const **v_p, size_t *vlen_p) { |
| 766 | bool accept; |
| 767 | const char *opts = *opts_p; |
| 768 | |
| 769 | *k_p = opts; |
| 770 | |
| 771 | for (accept = false; !accept;) { |
| 772 | switch (*opts) { |
| 773 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': |
| 774 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': |
| 775 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': |
| 776 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': |
| 777 | case 'Y': case 'Z': |
| 778 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': |
| 779 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': |
| 780 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': |
| 781 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': |
| 782 | case 'y': case 'z': |
| 783 | case '0': case '1': case '2': case '3': case '4': case '5': |
| 784 | case '6': case '7': case '8': case '9': |
| 785 | case '_': |
| 786 | opts++; |
| 787 | break; |
| 788 | case ':': |
| 789 | opts++; |
| 790 | *klen_p = (uintptr_t)opts - 1 - (uintptr_t)*k_p; |
| 791 | *v_p = opts; |
| 792 | accept = true; |
| 793 | break; |
| 794 | case '\0': |
| 795 | if (opts != *opts_p) { |
| 796 | malloc_write("<jemalloc>: Conf string ends " |
| 797 | "with key\n"); |
| 798 | } |
| 799 | return true; |
| 800 | default: |
| 801 | malloc_write("<jemalloc>: Malformed conf string\n"); |
| 802 | return true; |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | for (accept = false; !accept;) { |
| 807 | switch (*opts) { |
| 808 | case ',': |
| 809 | opts++; |
| 810 | /* |
| 811 | * Look ahead one character here, because the next time |
| 812 | * this function is called, it will assume that end of |
| 813 | * input has been cleanly reached if no input remains, |
| 814 | * but we have optimistically already consumed the |
| 815 | * comma if one exists. |
| 816 | */ |
| 817 | if (*opts == '\0') { |
| 818 | malloc_write("<jemalloc>: Conf string ends " |
| 819 | "with comma\n"); |
| 820 | } |
no test coverage detected