* Given a pointer to the start of a memory block returned by malloc, get * the actual malloc_elem header for that block. */
| 304 | * the actual malloc_elem header for that block. |
| 305 | */ |
| 306 | static inline struct malloc_elem * |
| 307 | malloc_elem_from_data(const void *data) |
| 308 | { |
| 309 | if (data == NULL) |
| 310 | return NULL; |
| 311 | |
| 312 | struct malloc_elem *elem = RTE_PTR_SUB(data, MALLOC_ELEM_HEADER_LEN); |
| 313 | if (!malloc_elem_cookies_ok(elem)) |
| 314 | return NULL; |
| 315 | return elem->state != ELEM_PAD ? elem: RTE_PTR_SUB(elem, elem->pad); |
| 316 | } |
| 317 | |
| 318 | /* |
| 319 | * initialise a malloc_elem header |
no test coverage detected