pr_new.rst (534B)
1 PR_NEW 2 ====== 3 4 Allocates memory of a specified size from the heap. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prmem.h> 13 14 _type * PR_NEW(_struct); 15 16 17 Parameter 18 ~~~~~~~~~ 19 20 ``_struct`` 21 The name of a type. 22 23 24 Returns 25 ~~~~~~~ 26 27 An pointer to a buffer sized to contain the type ``_struct``, or if the 28 allocation attempt fails, ``NULL``. Call ``PR_GetError()`` to retrieve 29 the error returned by the libc function. 30 31 32 Description 33 ----------- 34 35 This macro allocates memory whose size is ``sizeof(_struct)`` and 36 returns a pointer to that memory.