Returns the errno-style error code of the allocation. */
| 1923 | |
| 1924 | /* Returns the errno-style error code of the allocation. */ |
| 1925 | JEMALLOC_ALWAYS_INLINE int |
| 1926 | imalloc(static_opts_t *sopts, dynamic_opts_t *dopts) { |
| 1927 | if (unlikely(!malloc_initialized()) && unlikely(malloc_init())) { |
| 1928 | if (config_xmalloc && unlikely(opt_xmalloc)) { |
| 1929 | malloc_write(sopts->oom_string); |
| 1930 | abort(); |
| 1931 | } |
| 1932 | UTRACE(NULL, dopts->num_items * dopts->item_size, NULL); |
| 1933 | set_errno(ENOMEM); |
| 1934 | *dopts->result = NULL; |
| 1935 | |
| 1936 | return ENOMEM; |
| 1937 | } |
| 1938 | |
| 1939 | /* We always need the tsd. Let's grab it right away. */ |
| 1940 | tsd_t *tsd = tsd_fetch(); |
| 1941 | assert(tsd); |
| 1942 | if (likely(tsd_fast(tsd))) { |
| 1943 | /* Fast and common path. */ |
| 1944 | tsd_assert_fast(tsd); |
| 1945 | sopts->slow = false; |
| 1946 | return imalloc_body(sopts, dopts, tsd); |
| 1947 | } else { |
| 1948 | sopts->slow = true; |
| 1949 | return imalloc_body(sopts, dopts, tsd); |
| 1950 | } |
| 1951 | } |
| 1952 | /******************************************************************************/ |
| 1953 | /* |
| 1954 | * Begin malloc(3)-compatible functions. |
no test coverage detected