MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / malloc_conf_next

Function malloc_conf_next

deps/jemalloc/src/jemalloc.c:822–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

820}
821
822static bool
823malloc_conf_next(char const **opts_p, char const **k_p, size_t *klen_p,
824 char const **v_p, size_t *vlen_p) {
825 bool accept;
826 const char *opts = *opts_p;
827
828 *k_p = opts;
829
830 for (accept = false; !accept;) {
831 switch (*opts) {
832 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
833 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
834 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
835 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
836 case 'Y': case 'Z':
837 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
838 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
839 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
840 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
841 case 'y': case 'z':
842 case '0': case '1': case '2': case '3': case '4': case '5':
843 case '6': case '7': case '8': case '9':
844 case '_':
845 opts++;
846 break;
847 case ':':
848 opts++;
849 *klen_p = (uintptr_t)opts - 1 - (uintptr_t)*k_p;
850 *v_p = opts;
851 accept = true;
852 break;
853 case '\0':
854 if (opts != *opts_p) {
855 malloc_write("<jemalloc>: Conf string ends "
856 "with key\n");
857 }
858 return true;
859 default:
860 malloc_write("<jemalloc>: Malformed conf string\n");
861 return true;
862 }
863 }
864
865 for (accept = false; !accept;) {
866 switch (*opts) {
867 case ',':
868 opts++;
869 /*
870 * Look ahead one character here, because the next time
871 * this function is called, it will assume that end of
872 * input has been cleanly reached if no input remains,
873 * but we have optimistically already consumed the
874 * comma if one exists.
875 */
876 if (*opts == '\0') {
877 malloc_write("<jemalloc>: Conf string ends "
878 "with comma\n");
879 }

Callers 1

malloc_conf_init_helperFunction · 0.70

Calls 1

malloc_writeFunction · 0.70

Tested by

no test coverage detected