JSString

  • Revision slug: SpiderMonkey/JSAPI_Reference/JSString
  • Revision title: JSString
  • Revision id: 69107
  • Created:
  • Creator: kunpeng
  • Is current revision? No
  • Comment 119 words added; page display name reset to default

Revision Content

JSString is the type of strings in the JSAPI.

/*
 * The original GC-thing "string" type, a flat character string owned by its
 * GC-thing descriptor.  The chars member points to a vector having byte size
 * (length + 1) * sizeof(jschar), terminated at index length by a zero jschar.
 * The terminator is purely a backstop, in case the chars pointer flows out to
 * native code that requires \u0000 termination.
 *
 * NB: Always use the JSSTRING_LENGTH and JSSTRING_CHARS accessor macros,
 * unless you guard str->member uses with !JSSTRING_IS_DEPENDENT(str).
 */
struct JSString {
    size_t          length;
    jschar          *chars;
};

Revision Source

<p><strong><code>JSString</code></strong> is the type of strings in the JSAPI.</p>
<p>/*<br>
 * The original GC-thing "string" type, a flat character string owned by its<br>
 * GC-thing descriptor.  The chars member points to a vector having byte size<br>
 * (length + 1) * sizeof(jschar), terminated at index length by a zero jschar.<br>
 * The terminator is purely a backstop, in case the chars pointer flows out to<br>
 * native code that requires \u0000 termination.<br>
 *<br>
 * NB: Always use the JSSTRING_LENGTH and JSSTRING_CHARS accessor macros,<br>
 * unless you guard str-&gt;member uses with !JSSTRING_IS_DEPENDENT(str).<br>
 */<br>
struct JSString {<br>
    size_t          length;<br>
    jschar          *chars;<br>
};</p>
Revert to this revision