JavaScript-1.5 Reference

JS_InternUCString Function

Summary

Creates a new, static, Unicode-encoded JS string whose value is automatically shared by all string literals that are identical.

Syntax

JSString * JS_InternUCString(JSContext *cx, const jschar *s);

Description

JS_InternUCString creates a new, Unicode-encoded JS string with a specified value, s, if it does not already exist. The char array, s, must be allocated on the heap. The JS string is an interned, Unicode version of s, meaning that independent C variables that define a matching string will, when translated to a JS string value using JS_InternUCString, share the same internal copy of the JS string, rather than define their own, separate copies in memory. Use this function to save space allocation on the heap.

If it creates or reuses an interned string, JS_InternUCString returns a pointer to the string. Otherwise, on error, it returns NULL.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_CompareStrings | JS_ConvertValue | JS_GetEmptyStringValue | JS_GetStringBytes | JS_GetStringChars | JS_GetStringLength | JS_InternString | JS_InternUCStringN | JS_NewArrayObject | JS_NewDouble | JS_NewFunction | JS_NewObject | JS_NewString | JS_NewStringCopyN | JS_NewStringCopyZ | JS_NewUCString | JS_NewUCStringCopyN | JS_NewUCStringCopyZ | JS_ValueToString ]

This page was generated by APIDOC