Sun Java System Web Server 7.0 Update 4 NSAPI Developer's Guide

PERM_REALLOC() Macro

The PERM_REALLOC macro is a platform-independent substitute for the C library routine realloc. This macro changes the size of a specified memory block that was originally created by PERM_MALLOC, PERM_CALLOC, or PERM_STRDUP. The content of the object remains unchanged up to the lesser of the old and new sizes. If the new size is larger, the new space is uninitialized.


Caution – Caution –

Calling PERM_REALLOC for a block that was allocated with MALLOC, CALLOC, or STRDUP does not work.


Syntax

void *PERM_REALLOC(vod *ptr, int size)

Return Values

A void pointer to a block of memory.

Parameters

void *ptr is a void pointer to a block of memory created by PERM_MALLOC, PERM_CALLOC, or PERM_STRDUP.

int size is the number of bytes to which the memory block should be resized.

Example

char *name;
name = (char *) PERM_MALLOC(256);
if (NotBigEnough())    
   name = (char *) PERM_REALLOC(name, 512);

See Also

REALLOC() Macro, PERM_CALLOC() Macro, PERM_MALLOC() Macro, PERM_FREE() Macro, PERM_STRDUP() Macro