Bug 347927: consistently using JS_ARRAY_LENGTH macro. r,a=brendan

This commit is contained in:
igor@mir2.org 2007-11-26 07:18:43 -08:00
Родитель d8b650c73e
Коммит 748930e7a4
5 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -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;