Bug 693469 - Use mozilla::ArrayLength and mozilla::ArrayEnd in preference to JS_ARRAY_LENGTH whenever possible. r=cjones
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "mozilla/RangedPtr.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "jstypes.h"
|
||||
#include "jsstdint.h"
|
||||
@@ -68,6 +69,7 @@
|
||||
|
||||
#include "vm/String-inl.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace js;
|
||||
using namespace js::gc;
|
||||
|
||||
@@ -363,7 +365,7 @@ js_InitCommonAtoms(JSContext *cx)
|
||||
{
|
||||
JSAtomState *state = &cx->runtime->atomState;
|
||||
JSAtom **atoms = state->commonAtomsStart();
|
||||
for (size_t i = 0; i < JS_ARRAY_LENGTH(js_common_atom_names); i++, atoms++) {
|
||||
for (size_t i = 0; i < ArrayLength(js_common_atom_names); i++, atoms++) {
|
||||
JSAtom *atom = js_Atomize(cx, js_common_atom_names[i], strlen(js_common_atom_names[i]),
|
||||
InternAtom);
|
||||
if (!atom)
|
||||
@@ -677,7 +679,7 @@ IndexToIdSlow(JSContext *cx, uint32 index, jsid *idp)
|
||||
JS_ASSERT(index > JSID_INT_MAX);
|
||||
|
||||
jschar buf[UINT32_CHAR_BUFFER_LENGTH];
|
||||
RangedPtr<jschar> end(buf + JS_ARRAY_LENGTH(buf), buf, buf + JS_ARRAY_LENGTH(buf));
|
||||
RangedPtr<jschar> end(ArrayEnd(buf), buf, ArrayEnd(buf));
|
||||
RangedPtr<jschar> start = BackfillIndexInCharBuffer(index, end);
|
||||
|
||||
JSAtom *atom = js_AtomizeChars(cx, start.get(), end - start);
|
||||
|
||||
Reference in New Issue
Block a user