src/sysdep/psp/malloc.c
void *debug_malloc(size_t size, const char *file, int line)
{
    CHECK_INIT();
    if (size < MALLOC_SIZE_LIMIT) {
        if (UNLIKELY(size == 0)) {
            return NULL;
        }
        void *ptr = alloc_from_heap(size);
        if (ptr) {
# ifdef TRACE_ALLOCS
            DLOG("[%s:%d] malloc(%u) -> %p (block size %u)",
                 file, line, size, ptr,
                 ((HeapBlock *)ptr)[-1].alloc.size);
# endif
            return ptr;
        }
    }
    return debug_mem_alloc(size, 0, 0, file, line, MEM_INFO_UNKNOWN);
}
/* If we're debugging, include a version that takes source file and line
 * number, so we can pass them to the primary allocator or log them when
 * tracing allocations. */
If we're debugging, include a version that takes source file and line
number, so we can pass them to the primary allocator or log them when
tracing allocations.
If we ' re debugging include a version that takes source file and line number so we can pass them to the primary allocator or log them when tracing allocations .
void *debug_malloc(size_t size, const char *file, int line)
{
    CHECK_INIT();
    if (size < MALLOC_SIZE_LIMIT) {
        if (UNLIKELY(size == 0)) {
            return NULL;
        }
        void *ptr = alloc_from_heap(size);
        if (ptr) {
# ifdef TRACE_ALLOCS
            DLOG("[%s:%d] malloc(%u) -> %p (block size %u)",
                 file, line, size, ptr,
                 ((HeapBlock *)ptr)[-1].alloc.size);
# endif
            return ptr;
        }
    }
    return debug_mem_alloc(size, 0, 0, file, line, MEM_INFO_UNKNOWN);
}
void * debug_malloc ( size_t size , const char * file , int line ) { CHECK_INIT ( ) ; if ( size < MALLOC_SIZE_LIMIT ) { if ( UNLIKELY ( size == 0 ) ) { return NULL ; } void * ptr = alloc_from_heap ( size ) ; if ( ptr ) { # ifdef TRACE_ALLOCS DLOG ( " " , file , line , size , ptr , ( ( HeapBlock * ) ptr ) [ -1 ] . alloc . size ) ; # endif return ptr ; } } return debug_mem_alloc ( size , 0 , 0 , file , line , MEM_INFO_UNKNOWN ) ; }
If we're debugging, include a version that takes source file and line
 number, so we can pass them to the primary allocator or log them when
 tracing allocations.
If we ' re debugging include a version that takes source file and line number so we can pass them to the primary allocator or log them when tracing allocations .