The PERM_STRDUP macro is a platform-independent substitute for the C library routine strdup. It 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 pool-init built-in SAF), PERM_STRDUP and STRDUP both obtain their memory from the system heap.
The PERM_STRDUP routine is functionally equivalent to:
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.