Some functions don't modify their parameter which should be marked as const.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
/* dummy function - just check if pointer is non-null */
static inline int
-malloc_elem_cookies_ok(struct malloc_elem *elem){ return elem != NULL; }
+malloc_elem_cookies_ok(const struct malloc_elem *elem){ return elem != NULL; }
/* dummy function - no header if malloc_debug is not enabled */
static inline void
/* check that the header and trailer cookies are set correctly */
static inline int
-malloc_elem_cookies_ok(struct malloc_elem *elem)
+malloc_elem_cookies_ok(const struct malloc_elem *elem)
{
return (elem != NULL &&
MALLOC_ELEM_HEADER(elem) == MALLOC_HEADER_COOKIE &&
* the actual malloc_elem header for that block.
*/
static inline struct malloc_elem *
-malloc_elem_from_data(void *data)
+malloc_elem_from_data(const void *data)
{
if (data == NULL)
return NULL;
* Function to retrieve data for heap on given socket
*/
int
-malloc_heap_get_stats(struct malloc_heap *heap,
+malloc_heap_get_stats(const struct malloc_heap *heap,
struct rte_malloc_socket_stats *socket_stats)
{
if (!heap->initialised)
size_t size, unsigned align);
int
-malloc_heap_get_stats(struct malloc_heap *heap,
+malloc_heap_get_stats(const struct malloc_heap *heap,
struct rte_malloc_socket_stats *socket_stats);
int
}
int
-rte_malloc_validate(void *ptr, size_t *size)
+rte_malloc_validate(const void *ptr, size_t *size)
{
- struct malloc_elem *elem = malloc_elem_from_data(ptr);
+ const struct malloc_elem *elem = malloc_elem_from_data(ptr);
if (!malloc_elem_cookies_ok(elem))
return -1;
if (size != NULL)
* 0 on success
*/
int
-rte_malloc_validate(void *ptr, size_t *size);
+rte_malloc_validate(const void *ptr, size_t *size);
/**
* Get heap statistics for the specified heap.