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

Function malloc_conf_multi_sizes_next

deps/jemalloc/src/jemalloc.c:779–820  ·  view source on GitHub ↗

Reads the next size pair in a multi-sized option. */

Source from the content-addressed store, hash-verified

777
778/* Reads the next size pair in a multi-sized option. */
779static bool
780malloc_conf_multi_sizes_next(const char **slab_size_segment_cur,
781 size_t *vlen_left, size_t *slab_start, size_t *slab_end, size_t *new_size) {
782 const char *cur = *slab_size_segment_cur;
783 char *end;
784 uintmax_t um;
785
786 set_errno(0);
787
788 /* First number, then '-' */
789 um = malloc_strtoumax(cur, &end, 0);
790 if (get_errno() != 0 || *end != '-') {
791 return true;
792 }
793 *slab_start = (size_t)um;
794 cur = end + 1;
795
796 /* Second number, then ':' */
797 um = malloc_strtoumax(cur, &end, 0);
798 if (get_errno() != 0 || *end != ':') {
799 return true;
800 }
801 *slab_end = (size_t)um;
802 cur = end + 1;
803
804 /* Last number */
805 um = malloc_strtoumax(cur, &end, 0);
806 if (get_errno() != 0) {
807 return true;
808 }
809 *new_size = (size_t)um;
810
811 /* Consume the separator if there is one. */
812 if (*end == '|') {
813 end++;
814 }
815
816 *vlen_left -= end - *slab_size_segment_cur;
817 *slab_size_segment_cur = end;
818
819 return false;
820}
821
822static bool
823malloc_conf_next(char const **opts_p, char const **k_p, size_t *klen_p,

Callers 1

malloc_conf_init_helperFunction · 0.85

Calls 3

malloc_strtoumaxFunction · 0.70
set_errnoFunction · 0.50
get_errnoFunction · 0.50

Tested by

no test coverage detected