From 46a2ff94eae5b5f3fa7be897c5136a4bbef65b24 Mon Sep 17 00:00:00 2001 From: "brendan%mozilla.org" Date: Tue, 29 Mar 2005 01:40:30 +0000 Subject: [PATCH] - Fix longstanding goof in js_PushLocalRoot, where m (n % local-root-chunk) was returned rather than n (the index of lrs->scopeMark). I'm mortified. - Followup fix to GC local rooting fix in ParseNodeToXML -- missed a few early returns from what used to be no-local-roots switch cases. --- js/src/jscntxt.c | 2 +- js/src/jscntxt.h | 2 +- js/src/jsxml.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/src/jscntxt.c b/js/src/jscntxt.c index 90ec8d595aaa..35607b4a87c5 100644 --- a/js/src/jscntxt.c +++ b/js/src/jscntxt.c @@ -625,7 +625,7 @@ js_PushLocalRoot(JSContext *cx, JSLocalRootStack *lrs, jsval v) } lrs->rootCount = n + 1; lrc->roots[m] = v; - return (int) m; + return (int) n; } void diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index db5deb4401b6..b8328974efaf 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -346,7 +346,7 @@ typedef struct JSLocalRootStack { JSLocalRootChunk firstChunk; } JSLocalRootStack; -#define JSLRS_NULL_MARK ((uint16) -1) +#define JSLRS_NULL_MARK ((uint32) -1) struct JSContext { JSCList links; diff --git a/js/src/jsxml.c b/js/src/jsxml.c index c396ad56bfc8..2605a65812c1 100644 --- a/js/src/jsxml.c +++ b/js/src/jsxml.c @@ -1467,7 +1467,7 @@ ParseNodeToXML(JSContext *cx, JSParseNode *pn, JSXMLArray *inScopeNSes, pn2 = pn->pn_head; xml = ParseNodeToXML(cx, pn2, inScopeNSes, flags); if (!xml) - return NULL; + goto fail; flags &= ~XSF_PRECOMPILED_ROOT; n = pn->pn_count; @@ -1526,7 +1526,7 @@ ParseNodeToXML(JSContext *cx, JSParseNode *pn, JSXMLArray *inScopeNSes, case TOK_XMLLIST: xml = js_NewXML(cx, JSXML_CLASS_LIST); if (!xml) - return NULL; + goto fail; n = pn->pn_count; if (!XMLArraySetCapacity(cx, &xml->xml_kids, n)) @@ -1596,7 +1596,7 @@ ParseNodeToXML(JSContext *cx, JSParseNode *pn, JSXMLArray *inScopeNSes, JSMSG_DUPLICATE_XML_ATTR, js_ValueToPrintableString(cx, ATOM_KEY(pn2->pn_atom))); - return NULL; + goto fail; } } @@ -1735,7 +1735,7 @@ ParseNodeToXML(JSContext *cx, JSParseNode *pn, JSXMLArray *inScopeNSes, JSMSG_RESERVED_ID, js_ValueToPrintableString(cx, STRING_TO_JSVAL(str))); - return NULL; + goto fail; } if (flags & XSF_IGNORE_PROCESSING_INSTRUCTIONS)