Bug 839376 (part 3) - Some low-hanging exact rooting fruit. sfink.
This commit is contained in:
@@ -377,7 +377,6 @@ js::Atomize(JSContext *cx, const char *bytes, size_t length, InternBehavior ib)
|
||||
if (!JSString::validateLength(cx, length))
|
||||
return NULL;
|
||||
|
||||
UnrootedAtom atom;
|
||||
static const unsigned ATOMIZE_BUF_MAX = 32;
|
||||
if (length < ATOMIZE_BUF_MAX) {
|
||||
/*
|
||||
@@ -390,15 +389,13 @@ js::Atomize(JSContext *cx, const char *bytes, size_t length, InternBehavior ib)
|
||||
jschar inflated[ATOMIZE_BUF_MAX];
|
||||
size_t inflatedLength = ATOMIZE_BUF_MAX - 1;
|
||||
InflateStringToBuffer(cx, bytes, length, inflated, &inflatedLength);
|
||||
atom = AtomizeAndCopyStableChars<CanGC>(cx, inflated, inflatedLength, ib);
|
||||
} else {
|
||||
jschar *tbcharsZ = InflateString(cx, bytes, &length);
|
||||
if (!tbcharsZ)
|
||||
return UnrootedAtom();
|
||||
atom = AtomizeAndTakeOwnership(cx, StableCharPtr(tbcharsZ, length), length, ib);
|
||||
return AtomizeAndCopyStableChars<CanGC>(cx, inflated, inflatedLength, ib);
|
||||
}
|
||||
|
||||
return atom;
|
||||
jschar *tbcharsZ = InflateString(cx, bytes, &length);
|
||||
if (!tbcharsZ)
|
||||
return UnrootedAtom();
|
||||
return AtomizeAndTakeOwnership(cx, StableCharPtr(tbcharsZ, length), length, ib);
|
||||
}
|
||||
|
||||
template <AllowGC allowGC>
|
||||
|
||||
Reference in New Issue
Block a user