function libtest_pal_malloc

Jump to navigation Jump to search

Source Files

        │   └───libtest
        │           libtest_porting_abstraction_layer.h


void *libtest_pal_malloc( lfds710_pal_uint_t size );


lfds710_pal_uint_t size

The length in bytes of the requested allocation.

Return Value

If successful, returns a pointer to the allocation. If unsuccessful, returns NULL. Behaviour with zero length allocation is that of the underlying call which is actually making the allocation. The code which uses this function never makes zero length allocations.


void *libtest_pal_malloc( lfds710_pal_uint_t size )

   // TRD : size can be any value in its range

   rv = malloc( (size_t) size );

   return rv;


This function is and is only used by one of the unbounded, many producer, many consumer queue tests. This particular queue permits the deallocation of elements after they have left the queue. As such, there is a test which actually mallocs, queues, then frees. If this function is implemented, the define LIBTEST_PAL_MALLOC must be created (it only needs to exist; its value is not used). If this define does not exist, then a placeholder function ends up being compiled, so that libtest can compile and in this case, the test which uses this function will not be run.

See Also