pr_realloc.rst (815B)
1 PR_Realloc 2 ========== 3 4 Resizes allocated memory on the heap. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prmem.h> 13 14 void *PR_Realloc ( 15 void *ptr, 16 PRUint32 size); 17 18 19 Parameters 20 ~~~~~~~~~~ 21 22 ``ptr`` 23 A pointer to the existing memory block being resized. 24 ``size`` 25 The size of the new memory block. 26 27 28 Returns 29 ~~~~~~~ 30 31 An untyped pointer to the allocated memory, or if the allocation attempt 32 fails, ``NULL``. Call ``PR_GetError()`` to retrieve the error returned 33 by the libc function ``realloc()``. 34 35 36 Description 37 ~~~~~~~~~~~ 38 39 This function attempts to enlarge or shrink the memory block addressed 40 by ptr to a new size. The contents of the specified memory remains the 41 same up to the smaller of its old size and new size, although the new 42 memory block's address can be different from the original address.