Returns the errno-style error code of the allocation. */
| 1982 | |
| 1983 | /* Returns the errno-style error code of the allocation. */ |
| 1984 | JEMALLOC_ALWAYS_INLINE int |
| 1985 | imalloc(static_opts_t *sopts, dynamic_opts_t *dopts) { |
| 1986 | if (unlikely(!malloc_initialized()) && unlikely(malloc_init())) { |
| 1987 | if (config_xmalloc && unlikely(opt_xmalloc)) { |
| 1988 | malloc_write(sopts->oom_string); |
| 1989 | abort(); |
| 1990 | } |
| 1991 | UTRACE(NULL, dopts->num_items * dopts->item_size, NULL); |
| 1992 | set_errno(ENOMEM); |
| 1993 | *dopts->result = NULL; |
| 1994 | |
| 1995 | return ENOMEM; |
| 1996 | } |
| 1997 | |
| 1998 | /* We always need the tsd. Let's grab it right away. */ |
| 1999 | tsd_t *tsd = tsd_fetch(); |
| 2000 | assert(tsd); |
| 2001 | if (likely(tsd_fast(tsd))) { |
| 2002 | /* Fast and common path. */ |
| 2003 | tsd_assert_fast(tsd); |
| 2004 | sopts->slow = false; |
| 2005 | return imalloc_body(sopts, dopts, tsd); |
| 2006 | } else { |
| 2007 | sopts->slow = true; |
| 2008 | return imalloc_body(sopts, dopts, tsd); |
| 2009 | } |
| 2010 | } |
| 2011 | /******************************************************************************/ |
| 2012 | /* |
| 2013 | * Begin malloc(3)-compatible functions. |
no test coverage detected