|
Summary
Duplicates a specified string within a specific JS executable script context.
|
Syntax
char * JS_strdup(JSContext *cx, const char *s);
Name | Type | Description |
cx | JSContext * | Pointer to a JS context from which to derive runtime information.
|
s | char * | Pointer to an existing string to duplicate.
|
|
Description
JS_strdup duplicates a specified string, s , within a specified JSContext , cx . To duplicate the string, JS_strdup allocates space from the malloc heap for the a copy of the string, and then copies s to the newly allocated location. If the allocation fails, JS_strdup returns a null pointer. Otherwise, it returns a pointer to the duplicate string.
|
See Also
|