Bug 749617 - rm XDRState::codeString (r=njn,a=not-libxul)

This commit is contained in:
Luke Wagner
2012-05-01 14:01:06 -07:00
parent f94da75e5e
commit f99bf99bf0
5 changed files with 18 additions and 53 deletions

View File

@@ -665,14 +665,18 @@ bool
js::XDRAtom(XDRState<mode> *xdr, JSAtom **atomp)
{
if (mode == XDR_ENCODE) {
JSString *str = *atomp;
return xdr->codeString(&str);
uint32_t nchars = (*atomp)->length();
if (!xdr->codeUint32(&nchars))
return false;
jschar *chars = const_cast<jschar *>((*atomp)->getChars(xdr->cx()));
if (!chars)
return false;
return xdr->codeChars(chars, nchars);
}
/*
* Inline XDRState::codeString when decoding to avoid JSString allocation
* for already existing atoms. See bug 321985.
*/
/* Avoid JSString allocation for already existing atoms. See bug 321985. */
uint32_t nchars;
if (!xdr->codeUint32(&nchars))
return false;