MCPcopy Create free account
hub / github.com/F-Stack/f-stack / malloc_conf_next

Function malloc_conf_next

app/redis-6.2.6/deps/jemalloc/src/jemalloc.c:764–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

malloc_conf_initFunction · 0.85

Calls 1

malloc_writeFunction · 0.85

Tested by

no test coverage detected