Clean up ugly whitespace, some of which survived my r=brendan comments.

This commit is contained in:
brendan%mozilla.org 2000-04-05 02:17:38 +00:00
Родитель dcd6b5cbbe
Коммит 6b71fed163
12 изменённых файлов: 70 добавлений и 63 удалений

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

@ -18,7 +18,7 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
@ -53,12 +53,12 @@ typedef unsigned long jsbitmap_t;
/*
** Compute the log of the least power of 2 greater than or equal to n
*/
extern JS_PUBLIC_API(JSIntn) JS_CeilingLog2(JSUint32 i);
extern JS_PUBLIC_API(JSIntn) JS_CeilingLog2(JSUint32 i);
/*
** Compute the log of the greatest power of 2 less than or equal to n
*/
extern JS_PUBLIC_API(JSIntn) JS_FloorLog2(JSUint32 i);
extern JS_PUBLIC_API(JSIntn) JS_FloorLog2(JSUint32 i);
/*
** Macro version of JS_CeilingLog2: Compute the log of the least power of

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

@ -1,24 +1,24 @@
/*
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.

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

@ -18,7 +18,7 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
@ -268,7 +268,7 @@ JSBool
js_InCatchBlock(JSTreeContext *tc, JSAtom *atom)
{
JSStmtInfo *stmt;
for (stmt = tc->topStmt; stmt; stmt = stmt->down) {
if (stmt->type == STMT_CATCH && stmt->label == atom)
return JS_TRUE;

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

@ -18,7 +18,7 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
@ -196,9 +196,9 @@ js_AllocGCThing(JSContext *cx, uintN flags)
/* Fix for GC bug - previous allocation of a new atom has
not yet found a home, so a subsequent call to GC here will
flush that atom. This 'hack' prevents that from happening
by requiring that the heap grow rather than running a GC.
by requiring that the heap grow rather than running a GC.
The concern is that enough GC's will not occur then, since
we're counting on back-branches and force_GC's from the
we're counting on back-branches and force_GC's from the
server.
*/
tried_gc = JS_TRUE;

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

@ -821,7 +821,7 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
line = 0;
principals = NULL;
}
if (!indirectCall)
cx->fp->special |= JSFRAME_EVAL;
script = JS_CompileUCScriptForPrincipals(cx, scopeobj, principals,
@ -982,13 +982,13 @@ obj_defineGetter(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
JSMSG_BAD_GETTER_OR_SETTER,
js_getter_str);
return JS_FALSE;
}
}
atom = js_ValueToStringAtom(cx, argv[0]);
if (!atom)
return JS_FALSE;
return OBJ_DEFINE_PROPERTY(cx, obj, (jsid)atom, JSVAL_VOID,
return OBJ_DEFINE_PROPERTY(cx, obj, (jsid)atom, JSVAL_VOID,
(JSPropertyOp) JSVAL_TO_OBJECT(fval), NULL,
JSPROP_GETTER, NULL);
}

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

@ -18,7 +18,7 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
@ -2057,7 +2057,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
todo = Sprint(&ss->sprinter, "%s%s%s %s%s",
lval,
(lval[1] != '\0') ? ", " : "",
(lastop == JSOP_GETTER)
(lastop == JSOP_GETTER)
? js_get_str : js_set_str,
xval,
rval + strlen(js_function_str) + 1);

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

@ -2485,15 +2485,14 @@ PrimaryExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
#if JS_HAS_GETTER_SETTER
atom = CURRENT_TOKEN(ts).t_atom;
rt = cx->runtime;
if (atom == rt->atomState.getAtom ||
if (atom == rt->atomState.getAtom ||
atom == rt->atomState.setAtom) {
op = (atom == rt->atomState.getAtom)
? JSOP_GETTER
? JSOP_GETTER
: JSOP_SETTER;
if (js_MatchToken(cx, ts, TOK_NAME)) {
pn3 = NewParseNode(cx, &CURRENT_TOKEN(ts),
PN_NAME);
if (!pn3)
pn3 = NewParseNode(cx, &CURRENT_TOKEN(ts), PN_NAME);
if (!pn3)
return NULL;
pn3->pn_atom = CURRENT_TOKEN(ts).t_atom;
pn3->pn_expr = NULL;

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

@ -18,7 +18,7 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
@ -671,7 +671,7 @@ AddToTokenBuf(JSContext *cx, JSTokenBuf *tb, jschar c)
* escape sequence - returning it's value if so.
* Otherwise, non-destructively return the original '\'.
*/
static int32
static int32
GetUnicodeEscape(JSTokenStream *ts)
{
jschar cp[5];
@ -740,7 +740,7 @@ retry:
hadUnicodeEscape = JS_FALSE;
if (JS_ISIDENT_START(c) ||
(c == '\\' &&
(c = GetUnicodeEscape(ts),
(c = GetUnicodeEscape(ts),
hadUnicodeEscape = JS_ISIDENT_START(c)))) {
INIT_TOKENBUF(&ts->tokenbuf);
for (;;) {

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

@ -217,7 +217,7 @@ js_hash_scope_slot_invalidator(JSHashEntry *he, intN i, void *arg)
sprop->slot = SPROP_INVALID_SLOT;
}
return HT_ENUMERATE_NEXT;
}
}
/* Forward declaration for use by js_hash_scope_clear(). */
extern JS_FRIEND_DATA(JSScopeOps) js_list_scope_ops;

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

@ -70,7 +70,7 @@
/*
* Forward declarations for URI encode/decode and helper routines
*/
static JSBool
static JSBool
str_decodeURI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
static JSBool
str_decodeURI_Component(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
@ -259,7 +259,7 @@ static JSBool
str_uneval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSString *str;
str = js_ValueToSource(cx, argv[0]);
if (!str)
return JS_FALSE;
@ -583,7 +583,7 @@ static JSBool
str_charAt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSString *str;
jsdouble d = 0.0;
jsdouble d;
size_t index;
jschar buf[2];
@ -592,11 +592,14 @@ str_charAt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return JS_FALSE;
argv[-1] = STRING_TO_JSVAL(str);
if (argc) {
if (!js_ValueToNumber(cx, argv[0], &d))
if (argc == 0) {
d = 0.0;
} else {
if (!js_ValueToNumber(cx, argv[0], &d))
return JS_FALSE;
d = js_DoubleToInteger(d);
}
if (d < 0 || str->length <= d) {
*rval = JS_GetEmptyStringValue(cx);
} else {
@ -616,7 +619,7 @@ str_charCodeAt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
{
JSString *str;
jsdouble d = 0.0;
jsdouble d;
size_t index;
str = js_ValueToString(cx, OBJECT_TO_JSVAL(obj));
@ -624,11 +627,14 @@ str_charCodeAt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
return JS_FALSE;
argv[-1] = STRING_TO_JSVAL(str);
if (argc) {
if (!js_ValueToNumber(cx, argv[0], &d))
if (argc == 0) {
d = 0.0;
} else {
if (!js_ValueToNumber(cx, argv[0], &d))
return JS_FALSE;
d = js_DoubleToInteger(d);
}
if (d < 0 || str->length <= d) {
*rval = JS_GetNaNValue(cx);
} else {
@ -884,7 +890,7 @@ match_or_replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
ok = JS_TRUE;
re->lastIndex = 0;
for (count = 0; index <= str->length; count++) {
ok = js_ExecuteRegExp(cx, re, str, &index, JS_TRUE, rval);
ok = js_ExecuteRegExp(cx, re, str, &index, JS_TRUE, rval);
if (!ok || *rval != JSVAL_TRUE)
break;
ok = glob(cx, count, data);
@ -999,8 +1005,8 @@ interpret_dollar(JSContext *cx, jschar *dp, ReplaceData *rdata, size_t *skip)
JSString *str;
JS_ASSERT(*dp == '$');
/*
/*
* Allow a real backslash (literal "\\") to escape "$1" etc.
* Do this for versions less than 1.5 (ECMA 3) only
*/
@ -1297,8 +1303,9 @@ str_replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
rdata.length = 0;
rdata.index = 0;
rdata.leftIndex = 0;
/*
* For ECMA 3, the first argument is to be treated as a string
/*
* For ECMA 3, the first argument is to be treated as a string
* (i.e. converted to one if necessary) UNLESS it's a reg.exp object.
*/
if (!match_or_replace(cx, obj, argc, argv, replace_glob, &rdata.base, rval,
@ -3831,13 +3838,13 @@ add_bytes(JSContext *cx, JSString *str, char *bytes, size_t length)
return JS_TRUE;
}
/*
* ECMA 3, 15.1.3 URI Handling Function Properties
*
* The following are implementations of the algorithms
* given in the ECMA specification for the hidden functions
* 'Encode' and 'Decode'.
*/
/*
* ECMA 3, 15.1.3 URI Handling Function Properties
*
* The following are implementations of the algorithms
* given in the ECMA specification for the hidden functions
* 'Encode' and 'Decode'.
*/
static JSBool encode(JSContext *cx, JSString *str, JSString *unescapedSet, jsval *rval)
{
size_t j, k = 0, L;
@ -3911,7 +3918,7 @@ static JSBool decode(JSContext *cx, JSString *str, JSString *reservedSet, jsval
if (C == '%') {
start = k;
if ((k + 2) >= str->length) goto errOut;
if (!JS7_ISHEX(str->chars[k + 1]) || !JS7_ISHEX(str->chars[k + 2]))
if (!JS7_ISHEX(str->chars[k + 1]) || !JS7_ISHEX(str->chars[k + 2]))
goto errOut;
B = JS7_UNHEX(str->chars[k + 1]) * 16 + JS7_UNHEX(str->chars[k + 2]);
k += 2;
@ -3926,7 +3933,7 @@ static JSBool decode(JSContext *cx, JSString *str, JSString *reservedSet, jsval
for (j = 1; j < n; j++) {
k++;
if (str->chars[k] != '%') goto errOut;
if (!JS7_ISHEX(str->chars[k + 1]) || !JS7_ISHEX(str->chars[k + 2]))
if (!JS7_ISHEX(str->chars[k + 1]) || !JS7_ISHEX(str->chars[k + 2]))
goto errOut;
B = JS7_UNHEX(str->chars[k + 1]) * 16 + JS7_UNHEX(str->chars[k + 2]);
if ((B & 0xC0) != 0x80) goto errOut;
@ -3988,7 +3995,8 @@ str_decodeURI_Component(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
static JSBool
str_encodeURI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSString *str, *unescapedURISet;
JSString *str, *unescapedURISet;
str = js_ValueToString(cx, argv[0]);
if (!str)
return JS_FALSE;

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

@ -61,18 +61,18 @@
static void PStrFromCStr(const char* src, Str255 dst)
{
short length = 0;
/* handle case of overlapping strings */
if ( (void*)src == (void*)dst )
{
unsigned char* curdst = &dst[1];
unsigned char thisChar;
thisChar = *(const unsigned char*)src++;
while ( thisChar != '\0' )
while ( thisChar != '\0' )
{
unsigned char nextChar;
/*
* Use nextChar so we don't overwrite what we
* are about to read
@ -80,7 +80,7 @@ static void PStrFromCStr(const char* src, Str255 dst)
nextChar = *(const unsigned char*)src++;
*curdst++ = thisChar;
thisChar = nextChar;
if ( ++length >= 255 )
break;
}
@ -91,16 +91,16 @@ static void PStrFromCStr(const char* src, Str255 dst)
/* count down so test it loop is faster */
short overflow = 255;
register char temp;
/*
* Can't do the K&R C thing of while (*s++ = *t++)
* because it will copy trailing zero which might
* overrun pascal buffer. Instead we use a temp variable.
*/
while ( (temp = *src++) != 0 )
while ( (temp = *src++) != 0 )
{
*(char*)curdst++ = temp;
if ( --overflow <= 0 )
break;
}
@ -112,7 +112,7 @@ static void PStrFromCStr(const char* src, Str255 dst)
static void jsdebugstr(const char *debuggerMsg)
{
Str255 pStr;
PStrFromCStr(debuggerMsg, pStr);
DebugStr(pStr);
}
@ -121,11 +121,11 @@ static void dprintf(const char *format, ...)
{
va_list ap;
char *buffer;
va_start(ap, format);
buffer = (char *)JS_vsmprintf(format, ap);
va_end(ap);
jsdebugstr(buffer);
JS_DELETE(buffer);
}

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

@ -74,7 +74,7 @@ JS_BEGIN_EXTERN_C
#ifdef DEBUG
extern JS_PUBLIC_API(void)
extern JS_PUBLIC_API(void)
JS_Assert(const char *s, const char *file, JSIntn ln);
#define JS_ASSERT(_expr) \
((_expr)?((void)0):JS_Assert(# _expr,__FILE__,__LINE__))