зеркало из https://github.com/mozilla/pjs.git
Bug 347927: consistently using JS_ARRAY_LENGTH macro. r,a=brendan
This commit is contained in:
Родитель
c233dbba7e
Коммит
9b36e597df
|
@ -747,7 +747,7 @@ date_parseString(JSString *str, jsdouble *result)
|
|||
}
|
||||
if (i <= st + 1)
|
||||
goto syntax;
|
||||
for (k = (sizeof(wtb)/sizeof(char*)); --k >= 0;)
|
||||
for (k = JS_ARRAY_LENGTH(wtb); --k >= 0;)
|
||||
if (date_regionMatches(wtb[k], 0, s, st, i-st, 1)) {
|
||||
int action = ttb[k];
|
||||
if (action != 0) {
|
||||
|
|
|
@ -1200,7 +1200,7 @@ js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp)
|
|||
|
||||
/* Protect the newly-created strings below from nesting GCs. */
|
||||
memset(tv, 0, sizeof tv);
|
||||
JS_PUSH_TEMP_ROOT(cx, sizeof tv / sizeof tv[0], tv, &tvr);
|
||||
JS_PUSH_TEMP_ROOT(cx, JS_ARRAY_LENGTH(tv), tv, &tvr);
|
||||
|
||||
/*
|
||||
* Try to get an appropriate prototype by looking up the corresponding
|
||||
|
|
|
@ -2500,7 +2500,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
|||
|
||||
LOAD_OBJECT(0);
|
||||
argc = OBJ_BLOCK_COUNT(cx, obj);
|
||||
if ((size_t)argc <= sizeof smallv / sizeof smallv[0]) {
|
||||
if ((size_t)argc <= JS_ARRAY_LENGTH(smallv)) {
|
||||
atomv = smallv;
|
||||
} else {
|
||||
atomv = (JSAtom **) JS_malloc(cx, argc * sizeof(JSAtom *));
|
||||
|
|
|
@ -3902,7 +3902,7 @@ js_regexp_toString(JSContext *cx, JSObject *obj, jsval *vp)
|
|||
JSSTRING_CHARS_AND_LENGTH(re->source, source, length);
|
||||
if (length == 0) {
|
||||
source = empty_regexp_ucstr;
|
||||
length = sizeof(empty_regexp_ucstr) / sizeof(jschar) - 1;
|
||||
length = JS_ARRAY_LENGTH(empty_regexp_ucstr) - 1;
|
||||
}
|
||||
length += 2;
|
||||
nflags = 0;
|
||||
|
|
|
@ -93,7 +93,7 @@ static const struct keyword keyword_defs[] = {
|
|||
#undef JS_KEYWORD
|
||||
};
|
||||
|
||||
#define KEYWORD_COUNT (sizeof keyword_defs / sizeof keyword_defs[0])
|
||||
#define KEYWORD_COUNT JS_ARRAY_LENGTH(keyword_defs)
|
||||
|
||||
static const struct keyword *
|
||||
FindKeyword(const jschar *s, size_t length)
|
||||
|
@ -447,7 +447,7 @@ UngetChar(JSTokenStream *ts, int32 c)
|
|||
{
|
||||
if (c == EOF)
|
||||
return;
|
||||
JS_ASSERT(ts->ungetpos < sizeof ts->ungetbuf / sizeof ts->ungetbuf[0]);
|
||||
JS_ASSERT(ts->ungetpos < JS_ARRAY_LENGTH(ts->ungetbuf));
|
||||
if (c == '\n')
|
||||
ts->lineno--;
|
||||
ts->ungetbuf[ts->ungetpos++] = (jschar)c;
|
||||
|
|
Загрузка…
Ссылка в новой задаче