The PERM_STRDUP macro is a platform-independent substitute for the C library routine strdup. This macro creates a new copy of a string in memory that persists after the request that is being processed has been completed. If pooled memory has been disabled in the configuration file with the built-in pool-init SAF PERM_STRDUP and STRDUP both obtain their memory from the system heap.
The PERM_STRDUP routine is functionally equivalent to the following code:
newstr = (char *) PERM_MALLOC(strlen(str) + 1);strcpy(newstr, str); |
A string created with PERM_STRDUP should be disposed with PERM_FREE.
char *PERM_STRDUP(char *ptr);
A pointer to the new string.
char *ptr is a pointer to a string.
PERM_MALLOC() Macro, PERM_FREE() Macro, PERM_CALLOC() Macro, PERM_REALLOC() Macro, MALLOC() Macro, FREE() Macro, STRDUP() Macro, CALLOC() Macro, REALLOC() Macro