From 68cdb7d0b0688f160e2bcf421ccf34b85a2892d5 Mon Sep 17 00:00:00 2001 From: "brendan%netscape.com" Date: Tue, 25 Aug 1998 08:23:34 +0000 Subject: [PATCH] Fix typos, int type mismatch, white-space, and layout style nits. git-svn-id: svn://10.0.0.236/trunk@8438 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/src/jsapi.c | 2 -- mozilla/js/src/jsapi.h | 2 +- mozilla/js/src/jscntxt.h | 2 +- mozilla/js/src/jsdate.c | 1 - mozilla/js/src/jsemit.c | 28 ++++++++++++++-------------- mozilla/js/src/jsgc.c | 3 ++- mozilla/js/src/jsinterp.c | 31 +++++++++++++++---------------- mozilla/js/src/jslock.c | 1 - mozilla/js/src/jsmath.c | 1 - mozilla/js/src/jsopcode.c | 4 ++-- mozilla/js/src/jsparse.c | 23 +++++++++++------------ mozilla/js/src/jsregexp.c | 4 ++-- mozilla/js/src/jsscan.c | 3 +-- 13 files changed, 49 insertions(+), 56 deletions(-) diff --git a/mozilla/js/src/jsapi.c b/mozilla/js/src/jsapi.c index f62f86c59e1..03d7b13f5ce 100644 --- a/mozilla/js/src/jsapi.c +++ b/mozilla/js/src/jsapi.c @@ -2655,5 +2655,3 @@ BOOL CALLBACK __loadds WEP(BOOL fSystemExit) #endif /* !_WIN32 */ #endif /* XP_OS2 */ #endif /* XP_PC */ - - diff --git a/mozilla/js/src/jsapi.h b/mozilla/js/src/jsapi.h index 4d012ff0bf9..2b5b732d8f5 100644 --- a/mozilla/js/src/jsapi.h +++ b/mozilla/js/src/jsapi.h @@ -149,7 +149,7 @@ JS_GetEmptyStringValue(JSContext *cx); * The variable argument list after format must consist of &b, &c, &s, e.g., * where those variables have the types given above. For the pointer types * char *, JSString *, and JSObject *, the pointed-at memory returned belongs - * to the JS runtime, not to the calling native code. The runtimes promises + * to the JS runtime, not to the calling native code. The runtime promises * to keep this memory valid so long as argv refers to allocated stack space * (so long as the native function is active). * diff --git a/mozilla/js/src/jscntxt.h b/mozilla/js/src/jscntxt.h index 81820cc71c5..d7f13c62f3f 100644 --- a/mozilla/js/src/jscntxt.h +++ b/mozilla/js/src/jscntxt.h @@ -153,7 +153,7 @@ struct JSContext { /* Client opaque pointer */ void *data; - + /* Java environment and JS errors to throw as exceptions. */ void *javaEnv; void *savedErrors; diff --git a/mozilla/js/src/jsdate.c b/mozilla/js/src/jsdate.c index 4ae73cc3985..c628977f376 100644 --- a/mozilla/js/src/jsdate.c +++ b/mozilla/js/src/jsdate.c @@ -2020,4 +2020,3 @@ js_DateSetSeconds(JSContext *cx, JSObject *obj, int seconds) msFromTime(local)); *date = UTC(local); } - diff --git a/mozilla/js/src/jsemit.c b/mozilla/js/src/jsemit.c index 7d5d5781644..15507309839 100644 --- a/mozilla/js/src/jsemit.c +++ b/mozilla/js/src/jsemit.c @@ -242,7 +242,7 @@ EmitGoto(JSContext *cx, JSCodeGenerator *cg, JSStmtInfo *toStmt, switch (stmt->type) { case STMT_FINALLY: if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0 || - js_Emit3(cx, cg, JSOP_JSR, JUMP_OFFSET_HI(finallyIndex), + js_Emit3(cx, cg, JSOP_JSR, JUMP_OFFSET_HI(finallyIndex), JUMP_OFFSET_LO(finallyIndex)) < 0) return -1; finallyIndex--; @@ -494,7 +494,7 @@ FixupCatchJumps(JSContext *cx, JSCodeGenerator *cg, ptrdiff_t tryStart, ); return JS_TRUE; } - + #endif JSBool @@ -1154,10 +1154,10 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) * NOTE: This will cause problems if we use JSRs for something other * than finally handling in the future. Caveat hacker! */ - - if (pn->pn_kid3) + if (pn->pn_kid3) { js_PushStatement(&cg->treeContext, &stmtInfo, STMT_FINALLY, CG_OFFSET(cg)); + } /* mark try location for decompilation, then emit try block */ if (js_NewSrcNote2(cx, cg, SRC_TRYFIN, 0) < 0 || @@ -1211,7 +1211,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) iter = iter->pn_kid2; disc = iter->pn_kid1; - + if (catchjmp != -1) { /* fix up and clean up previous catch block */ CHECK_AND_SET_JUMP_OFFSET_AT(cx, cg, catchjmp); @@ -1239,7 +1239,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) js_Emit1(cx, cg, JSOP_NEWINIT) < 0 || js_Emit1(cx, cg, JSOP_EXCEPTION) < 0) return JS_FALSE; - + /* setprop */ ale = js_IndexAtom(cx, disc->pn_atom, &cg->atomList); if (!ale) @@ -1249,7 +1249,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0 || js_Emit1(cx, cg, JSOP_ENTERWITH) < 0) return JS_FALSE; - + /* boolean_expr */ if (disc->pn_expr) { ptrdiff_t guardstart = CG_OFFSET(cg); @@ -1259,8 +1259,8 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) catchjmp = js_Emit3(cx, cg, JSOP_IFEQ, 0, 0); if (catchjmp < 0) return JS_FALSE; - if (!js_SetSrcNoteOffset(cx, cg, guardnote, 0, - (ptrdiff_t)CG_OFFSET(cg) - + if (!js_SetSrcNoteOffset(cx, cg, guardnote, 0, + (ptrdiff_t)CG_OFFSET(cg) - guardstart)) return JS_FALSE; } @@ -1275,7 +1275,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) * jump over the remaining catch blocks * this counts as a non-local jump, so do the finally thing */ - + /* popscope */ if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0 || js_Emit1(cx, cg, JSOP_LEAVEWITH) < 0) @@ -1284,7 +1284,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) /* jsr , if required */ if (pn->pn_kid3) EMIT_FINALLY_JSR(cx, cg); - + /* this will get fixed up to jump to after catch/finally */ if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0 || js_Emit3(cx, cg, JSOP_GOTO, 0, 0) < 0) @@ -1313,7 +1313,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0 || js_Emit1(cx, cg, JSOP_LEAVEWITH) < 0)) return JS_FALSE; - + if (pn->pn_kid3) { finallyCatch = CG_OFFSET(cg); EMIT_FINALLY_JSR(cx, cg); @@ -1339,7 +1339,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) !js_EmitTree(cx, cg, pn->pn_kid3) || js_Emit1(cx, cg, JSOP_RETSUB) < 0) return JS_FALSE; - + } if (js_NewSrcNote(cx, cg, SRC_ENDBRACE) < 0 || @@ -1351,7 +1351,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) return JS_FALSE; CHECK_AND_SET_JUMP_OFFSET_AT(cx, cg, jmp); - + /* * Add the try note last, to let post-order give us the right ordering * (first to last, inner to outer). diff --git a/mozilla/js/src/jsgc.c b/mozilla/js/src/jsgc.c index 4f402bc6091..955d4794b52 100644 --- a/mozilla/js/src/jsgc.c +++ b/mozilla/js/src/jsgc.c @@ -703,7 +703,8 @@ restart: js_MarkAtomState(&rt->atomState, gc_mark); iter = NULL; while ((acx = js_ContextIterator(rt, &iter)) != NULL) { - /* Iterate frame chain and dormant chains. Temporarily tack current + /* + * Iterate frame chain and dormant chains. Temporarily tack current * frame onto the head of the dormant list to ease iteration. * * (NOTE: see comment on this whole 'dormant' thing in js_Execute) diff --git a/mozilla/js/src/jsinterp.c b/mozilla/js/src/jsinterp.c index 1020312eeb2..f2608219ef5 100644 --- a/mozilla/js/src/jsinterp.c +++ b/mozilla/js/src/jsinterp.c @@ -118,7 +118,7 @@ static JSClass prop_iterator_class = { * Stack macros and functions. These all use a local variable, jsval *sp, to * point to the next free stack slot. SAVE_SP must be called before any call * to a function that may invoke the interpreter. RESTORE_SP must be called - * only after return from Call, because only Call changes fp->sp. + * only after return from js_Invoke, because only js_Invoke changes fp->sp. */ #define PUSH(v) (*sp++ = (v)) #define POP() (*--sp) @@ -782,19 +782,18 @@ js_Execute(JSContext *cx, JSObject *chain, JSScript *script, JSFunction *fun, frame.throwing = JS_FALSE; frame.dormantNext = NULL; - - /* Here we wrap the call to js_Interpret with code to (conditionally) + /* + * Here we wrap the call to js_Interpret with code to (conditionally) * save and restore the old stack frame chain into a chain of 'dormant' * frame chains. Since we are replacing cx->fp we were running into the - * problem that if gc was called, then some of the objects associated - * with the old frame chain (stored here in the C stack as 'oldfp') were + * problem that if gc was called, then some of the objects associated + * with the old frame chain (stored here in the C stack as 'oldfp') were * not rooted and were being collected. This was bad. So, now we * preserve the links to these 'dormant' frame chains in cx before * calling js_Interpret and cleanup afterwards. gc walks these dormant * chains and marks objects in the same way that it marks object in the * primary cx->fp chain. */ - if (oldfp && oldfp != down) { PR_ASSERT(!oldfp->dormantNext); oldfp->dormantNext = cx->dormantFrameChain; @@ -889,9 +888,9 @@ ImportProperty(JSContext *cx, JSObject *obj, jsid id) goto out; } /* - * The Closure() constructor resets the closure object's parent to be - * the current scope chain. Set it to the object that the imported - * function is being defined in. + * The Closure() constructor resets the closure object's parent + * to be the current scope chain. Set it to the object that the + * imported function is being defined in. */ OBJ_SET_PARENT(cx, closure, obj); value = OBJECT_TO_JSVAL(closure); @@ -1245,7 +1244,7 @@ js_Interpret(JSContext *cx, jsval *result) do_forinloop: /* - * ECMA-compatible for/in bytecodes eval object just once, before loop. + * ECMA-compatible for/in evals the object just once, before loop. */ if (cs->format & JOF_FOR2) { obj = JSVAL_TO_OBJECT(sp[-1]); @@ -2597,7 +2596,7 @@ js_Interpret(JSContext *cx, jsval *result) len = 0; CHECK_BRANCH(-1); break; - + case JSOP_EXCEPTION: PUSH(fp->exception); break; @@ -2657,13 +2656,13 @@ js_Interpret(JSContext *cx, jsval *result) switch (handler(cx, script, pc, &rval, rt->debuggerHandlerData)) { case JSTRAP_ERROR: - ok = JS_FALSE; - goto out; + ok = JS_FALSE; + goto out; case JSTRAP_CONTINUE: - break; + break; case JSTRAP_RETURN: - fp->rval = rval; - goto out; + fp->rval = rval; + goto out; default:; } } diff --git a/mozilla/js/src/jslock.c b/mozilla/js/src/jslock.c index 16be24e97f9..654e5162ec6 100644 --- a/mozilla/js/src/jslock.c +++ b/mozilla/js/src/jslock.c @@ -764,4 +764,3 @@ js_IsScopeLocked(JSScope *scope) #endif #endif /* JS_THREADSAFE */ - diff --git a/mozilla/js/src/jsmath.c b/mozilla/js/src/jsmath.c index 51c92b46818..497102692fd 100644 --- a/mozilla/js/src/jsmath.c +++ b/mozilla/js/src/jsmath.c @@ -412,4 +412,3 @@ js_InitMathClass(JSContext *cx, JSObject *obj) return NULL; return proto; } - diff --git a/mozilla/js/src/jsopcode.c b/mozilla/js/src/jsopcode.c index db71cbe1fe9..98ade32488e 100644 --- a/mozilla/js/src/jsopcode.c +++ b/mozilla/js/src/jsopcode.c @@ -835,8 +835,8 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb) pc += oplen; js_printf(jp, "\t} catch ("); /* balance) */ pc += 6; /* name Object, pushobj, exception */ - js_printf(jp, "%s", ATOM_BYTES(GET_ATOM(cx, - jp->script, pc))); + js_printf(jp, "%s", + ATOM_BYTES(GET_ATOM(cx, jp->script, pc))); len = js_GetSrcNoteOffset(sn, 0); pc += 4; /* initprop, enterwith */ if (len) { diff --git a/mozilla/js/src/jsparse.c b/mozilla/js/src/jsparse.c index 1eb6d08d4ff..4688f1d8d16 100644 --- a/mozilla/js/src/jsparse.c +++ b/mozilla/js/src/jsparse.c @@ -990,15 +990,14 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc) } else { /* Set pn1 to a var list or an initializing expression. */ #if JS_HAS_IN_OPERATOR - /* + /* * Set the TCF_IN_FOR_INIT flag during parsing of the first clause - * of the for statement. This flag will will be used by the - * RelExpr production; if it flag is set, then the 'in' keyword - * will not be recognized as an operator, leaving it available to - * be parsed as part of a for/in loop. A side effect of this - * restriction is that (unparenthesized) expressions involving an - * 'in' operator are illegal in the init clause of an ordinary for - * loop. + * of the for statement. This flag will be used by the RelExpr + * production; if it is set, then the 'in' keyword will not be + * recognized as an operator, leaving it available to be parsed as + * part of a for/in loop. A side effect of this restriction is + * that (unparenthesized) expressions involving an 'in' operator + * are illegal in the init clause of an ordinary for loop. */ tc->flags |= TCF_IN_FOR_INIT; #endif /* JS_HAS_IN_OPERATOR */ @@ -1124,7 +1123,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc) * catch (v) * catch (v if ) */ - + if (!catchtail->pn_kid1->pn_expr) { js_ReportCompileError(cx, ts, "catch clause after general catch"); @@ -1207,7 +1206,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc) case TOK_CATCH: js_ReportCompileError(cx, ts, "catch without try"); return NULL; - + case TOK_FINALLY: js_ReportCompileError(cx, ts, "finally without try"); return NULL; @@ -1865,7 +1864,7 @@ RelExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc) inForInitFlag = tc->flags & TCF_IN_FOR_INIT; /* - * Uses of the in operator in ShiftExprs are always unambiguous, + * Uses of the in operator in ShiftExprs are always unambiguous, * so unset the flag that prohibits recognizing it. */ tc->flags &= ~TCF_IN_FOR_INIT; @@ -1893,7 +1892,7 @@ RelExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc) /* Restore previous state of inForInit flag. */ tc->flags |= inForInitFlag; #endif /* JS_HAS_IN_OPERATOR */ - + return pn; } diff --git a/mozilla/js/src/jsregexp.c b/mozilla/js/src/jsregexp.c index 4bd88235726..7dab1093da6 100644 --- a/mozilla/js/src/jsregexp.c +++ b/mozilla/js/src/jsregexp.c @@ -2000,8 +2000,8 @@ js_NewRegExp(JSContext *cx, JSString *str, uintN flags) #ifdef DEBUG_notme { /* print the compiled regexp program bytecode */ - jsuint i; - for (i=0; i < state.progLength; i++) { + size_t i; + for (i = 0; i < state.progLength; i++) { int b = (int) re->program[i]; fprintf(stderr, "%d", b); if ((i > 0 && i % 8 == 0) || i == state.progLength-1) diff --git a/mozilla/js/src/jsscan.c b/mozilla/js/src/jsscan.c index 8867d075779..7a00c224f78 100644 --- a/mozilla/js/src/jsscan.c +++ b/mozilla/js/src/jsscan.c @@ -263,7 +263,7 @@ SendSourceToJSDebugger(JSTokenStream *ts, jschar *str, size_t length) ts->jsdsrc = JSD_NewSourceText(ts->jsdc, filename); } else { ts->jsdsrc = JSD_FindSourceForURL(ts->jsdc, filename); - if (ts->jsdsrc && JSD_SOURCE_PARTIAL != + if (ts->jsdsrc && JSD_SOURCE_PARTIAL != JSD_GetSourceStatus(ts->jsdc, ts->jsdsrc)) { ts->jsdsrc = NULL; } @@ -535,7 +535,6 @@ js_ReportCompileError(JSContext *cx, JSTokenStream *ts, const char *format, fprintf(stderr, "%s:\n%s\n",message, js_DeflateString(cx, ts->linebuf.base, ts->linebuf.limit - ts->linebuf.base)); - #endif } if (lastc == '\n')