X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fhelper%2Fjim.c;h=c0425b98870dca06f445444ab69ad66c051c7689;hb=0e2c2fe1d1eec5482078147d551215a58604cc3a;hp=d62346c1a3e5968fa9659bd5876373d0d573fefc;hpb=e43979e7020ea9d05a3c0a2af444f292eacb6c53;p=openocd.git diff --git a/src/helper/jim.c b/src/helper/jim.c index d62346c1a3..c0425b9887 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -245,8 +245,8 @@ static jim_wide JimStrtoll(const char *nptr, char **endptr, register int base) static int JimStringMatch(const char *pattern, int patternLen, const char *string, int stringLen, int nocase) { - while(patternLen) { - switch(pattern[0]) { + while (patternLen) { + switch (pattern[0]) { case '*': while (pattern[1] == '*') { pattern++; @@ -254,7 +254,7 @@ static int JimStringMatch(const char *pattern, int patternLen, } if (patternLen == 1) return 1; /* match */ - while(stringLen) { + while (stringLen) { if (JimStringMatch(pattern+1, patternLen-1, string, stringLen, nocase)) return 1; /* match */ @@ -281,7 +281,7 @@ static int JimStringMatch(const char *pattern, int patternLen, patternLen--; } match = 0; - while(1) { + while (1) { if (pattern[0] == '\\') { pattern++; patternLen--; @@ -352,7 +352,7 @@ static int JimStringMatch(const char *pattern, int patternLen, pattern++; patternLen--; if (stringLen == 0) { - while(*pattern == '*') { + while (*pattern == '*') { pattern++; patternLen--; } @@ -370,7 +370,7 @@ int JimStringCompare(const char *s1, int l1, const char *s2, int l2, unsigned char *u1 = (unsigned char*) s1, *u2 = (unsigned char*) s2; if (nocase == 0) { - while(l1 && l2) { + while (l1 && l2) { if (*u1 != *u2) return (int)*u1-*u2; u1++; u2++; l1--; l2--; @@ -378,7 +378,7 @@ int JimStringCompare(const char *s1, int l1, const char *s2, int l2, if (!l1 && !l2) return 0; return l1-l2; } else { - while(l1 && l2) { + while (l1 && l2) { if (tolower((int)*u1) != tolower((int)*u2)) return tolower((int)*u1)-tolower((int)*u2); u1++; u2++; l1--; l2--; @@ -424,7 +424,7 @@ int Jim_StringToWide(const char *str, jim_wide *widePtr, int base) if ((str[0] == '\0') || (str == endptr) ) return JIM_ERR; if (endptr[0] != '\0') { - while(*endptr) { + while (*endptr) { if (!isspace((int)*endptr)) return JIM_ERR; endptr++; @@ -441,7 +441,7 @@ int Jim_StringToIndex(const char *str, int *intPtr) if ( (str[0] == '\0') || (str == endptr) ) return JIM_ERR; if (endptr[0] != '\0') { - while(*endptr) { + while (*endptr) { if (!isspace((int)*endptr)) return JIM_ERR; endptr++; @@ -473,7 +473,7 @@ int Jim_DoubleToString(char *buf, double doubleValue) len = sprintf(buf, "%.17g", doubleValue); s = buf; - while(*s) { + while (*s) { if (*s == '.') return len; s++; } @@ -503,8 +503,8 @@ int Jim_StringToDouble(const char *str, double *doublePtr) static jim_wide JimPowWide(jim_wide b, jim_wide e) { jim_wide i, res = 1; - if ((b==0 && e!=0) || (e<0)) return 0; - for(i=0; itable[i]; - while(he) { + while (he) { unsigned int h; nextHe = he->next; @@ -802,7 +802,7 @@ int Jim_DeleteHashEntry(Jim_HashTable *ht, const void *key) he = ht->table[h]; prevHe = NULL; - while(he) { + while (he) { if (Jim_CompareHashKeys(ht, key, he->key)) { /* Unlink the element from the list */ if (prevHe) @@ -831,7 +831,7 @@ int Jim_FreeHashTable(Jim_HashTable *ht) Jim_HashEntry *he, *nextHe; if ((he = ht->table[i]) == NULL) continue; - while(he) { + while (he) { nextHe = he->next; Jim_FreeEntryKey(ht, he); Jim_FreeEntryVal(ht, he); @@ -855,7 +855,7 @@ Jim_HashEntry *Jim_FindHashEntry(Jim_HashTable *ht, const void *key) if (ht->size == 0) return NULL; h = Jim_HashKey(ht, key) & ht->sizemask; he = ht->table[h]; - while(he) { + while (he) { if (Jim_CompareHashKeys(ht, key, he->key)) return he; he = he->next; @@ -916,7 +916,7 @@ static unsigned int JimHashTableNextPower(unsigned int size) if (size >= 2147483648U) return 2147483648U; - while(1) { + while (1) { if (i >= size) return i; i *= 2; @@ -938,7 +938,7 @@ static int JimInsertHashEntry(Jim_HashTable *ht, const void *key) h = Jim_HashKey(ht, key) & ht->sizemask; /* Search if this slot does not already contain the given key */ he = ht->table[h]; - while(he) { + while (he) { if (Jim_CompareHashKeys(ht, key, he->key)) return -1; he = he->next; @@ -1180,7 +1180,7 @@ void JimParserInit(struct JimParserCtx *pc, const char *prg, int JimParseScript(struct JimParserCtx *pc) { - while(1) { /* the while is used to reiterate with continue if needed */ + while (1) { /* the while is used to reiterate with continue if needed */ if (!pc->len) { pc->tstart = pc->p; pc->tend = pc->p-1; @@ -1189,7 +1189,7 @@ int JimParseScript(struct JimParserCtx *pc) pc->eof = 1; return JIM_OK; } - switch(*(pc->p)) { + switch (*(pc->p)) { case '\\': if (*(pc->p+1) == '\n') return JimParseSep(pc); @@ -1427,7 +1427,7 @@ int JimParseStr(struct JimParserCtx *pc) pc->tt = JIM_TT_ESC; return JIM_OK; } - switch(*pc->p) { + switch (*pc->p) { case '\\': if (pc->state == JIM_PS_DEF && *(pc->p+1) == '\n') { @@ -1518,9 +1518,9 @@ static int JimEscape(char *dest, const char *s, int slen) slen = strlen(s); for (i = 0; i < slen; i++) { - switch(s[i]) { + switch (s[i]) { case '\\': - switch(s[i+1]) { + switch (s[i+1]) { case 'a': *p++ = 0x7; i++; break; case 'b': *p++ = 0x8; i++; break; case 'f': *p++ = 0xc; i++; break; @@ -1657,7 +1657,7 @@ int Jim_ScriptIsComplete(const char *s, int len, char *stateCharPtr) int level = 0; int state = ' '; - while(len) { + while (len) { switch (*s) { case '\\': if (len > 1) @@ -1709,7 +1709,7 @@ int JimParseList(struct JimParserCtx *pc) pc->eof = 1; return JIM_OK; } - switch(*pc->p) { + switch (*pc->p) { case ' ': case '\n': case '\t': @@ -1757,7 +1757,7 @@ int JimParseListStr(struct JimParserCtx *pc) pc->tt = JIM_TT_ESC; return JIM_OK; } - switch(*pc->p) { + switch (*pc->p) { case '\\': pc->p++; pc->len--; break; @@ -2286,7 +2286,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr, if ( fmtLen <= 0 ){ break; } - switch( *fmt ){ + switch ( *fmt ){ /* terminals */ case 'b': /* binary - not all printfs() do this */ case 's': /* string */ @@ -2341,7 +2341,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr, case '8': case '9': accum = 0; - while( isdigit(*fmt) && (fmtLen > 0) ){ + while ( isdigit(*fmt) && (fmtLen > 0) ){ accum = (accum * 10) + (*fmt - '0'); fmt++; fmtLen--; } @@ -2436,7 +2436,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr, /* here we do the work */ /* actually - we make sprintf() do it for us */ - switch(*fmt) { + switch (*fmt) { case 's': *cp++ = 's'; *cp = 0; @@ -3029,7 +3029,7 @@ int SetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) } JimParserInit(&parser, scriptText, scriptTextLen, initialLineNumber); - while(!JimParserEof(&parser)) { + while (!JimParserEof(&parser)) { char *token; int len, type, linenr; @@ -3621,7 +3621,7 @@ int Jim_SetVariableLink(Jim_Interp *interp, Jim_Obj *nameObjPtr, Jim_Obj *objPtr = targetNameObjPtr; Jim_Var *varPtr; /* Cycles are only possible with 'uplevel 0' */ - while(1) { + while (1) { if (Jim_StringEqObj(objPtr, nameObjPtr, 0)) { Jim_SetResultString(interp, "can't upvar from variable to itself", -1); @@ -4262,7 +4262,7 @@ int Jim_Collect(Jim_Interp *interp) * is of a type that can contain references. */ Jim_InitHashTable(&marks, &JimRefMarkHashTableType, NULL); objPtr = interp->liveList; - while(objPtr) { + while (objPtr) { if (objPtr->typePtr == NULL || objPtr->typePtr->flags & JIM_TYPE_REFERENCES) { const char *str, *p; @@ -4291,7 +4291,7 @@ int Jim_Collect(Jim_Interp *interp) continue; } /* Extract references from the object string repr. */ - while(1) { + while (1) { int i; jim_wide id; char buf[21]; @@ -4488,7 +4488,7 @@ void Jim_FreeInterp(Jim_Interp *i) Jim_FreeHashTable(&i->packages); Jim_Free(i->prngState); /* Free the call frames list */ - while(cf) { + while (cf) { prevcf = cf->parentCallFrame; JimFreeCallFrame(i, cf, JIM_FCF_NONE); cf = prevcf; @@ -4500,7 +4500,7 @@ void Jim_FreeInterp(Jim_Interp *i) Jim_fprintf( i, i->cookie_stdout,JIM_NL "-------------------------------------" JIM_NL); Jim_fprintf( i, i->cookie_stdout,"Objects still in the free list:" JIM_NL); - while(objPtr) { + while (objPtr) { const char *type = objPtr->typePtr ? objPtr->typePtr->name : ""; Jim_fprintf( i, i->cookie_stdout,"%p \"%-10s\": '%.20s' (refCount: %d)" JIM_NL, @@ -4526,7 +4526,7 @@ void Jim_FreeInterp(Jim_Interp *i) } /* Free cached CallFrame structures */ cf = i->freeFramesList; - while(cf) { + while (cf) { nextcf = cf->nextFramePtr; if (cf->vars.table != NULL) Jim_Free(cf->vars.table); @@ -5030,7 +5030,7 @@ static int ListElementQuotingType(const char *s, int len) goto testbrace; } for (i = 0; i < len; i++) { - switch(s[i]) { + switch (s[i]) { case ' ': case '$': case '"': @@ -5057,7 +5057,7 @@ testbrace: s[len-1] == ']') return JIM_ELESTR_QUOTE; level = 0; for (i = 0; i < len; i++) { - switch(s[i]) { + switch (s[i]) { case '{': level++; break; case '}': level--; if (level < 0) return JIM_ELESTR_QUOTE; @@ -5073,7 +5073,7 @@ testbrace: if (level == 0) { if (!trySimple) return JIM_ELESTR_BRACE; for (i = 0; i < len; i++) { - switch(s[i]) { + switch (s[i]) { case ' ': case '$': case '"': @@ -5102,7 +5102,7 @@ char *BackslashQuoteString(const char *s, int len, int *qlenPtr) char *q = Jim_Alloc(len*2+1), *p; p = q; - while(*s) { + while (*s) { switch (*s) { case ' ': case '$': @@ -5164,7 +5164,7 @@ void UpdateStringOfList(struct Jim_Obj *objPtr) const char *strRep = Jim_GetString(ele[i], &len); char *q; - switch(quotingType[i]) { + switch (quotingType[i]) { case JIM_ELESTR_SIMPLE: memcpy(p, strRep, len); p += len; @@ -5215,7 +5215,7 @@ int SetListFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) /* Convert into a list */ JimParserInit(&parser, str, strLen, 1); - while(!JimParserEof(&parser)) { + while (!JimParserEof(&parser)) { char *token; int tokenLen, type; Jim_Obj *elementPtr; @@ -5739,7 +5739,7 @@ void UpdateStringOfDict(struct Jim_Obj *objPtr) const char *strRep = Jim_GetString(objv[i], &len); char *q; - switch(quotingType[i]) { + switch (quotingType[i]) { case JIM_ELESTR_SIMPLE: memcpy(p, strRep, len); p += len; @@ -5794,7 +5794,7 @@ int SetDictFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) /* Convert into a dict */ JimParserInit(&parser, str, strLen, 1); i = 0; - while(!JimParserEof(&parser)) { + while (!JimParserEof(&parser)) { char *token; int tokenLen, type; @@ -6276,7 +6276,7 @@ static struct Jim_ExprOperator Jim_ExprOperators[] = { int JimParseExpression(struct JimParserCtx *pc) { /* Discard spaces and quoted newline */ - while(*(pc->p) == ' ' || + while (*(pc->p) == ' ' || *(pc->p) == '\t' || *(pc->p) == '\r' || *(pc->p) == '\n' || @@ -6291,7 +6291,7 @@ int JimParseExpression(struct JimParserCtx *pc) pc->eof = 1; return JIM_OK; } - switch(*(pc->p)) { + switch (*(pc->p)) { case '(': pc->tstart = pc->tend = pc->p; pc->tline = pc->linenr; @@ -6508,7 +6508,7 @@ static int ExprCheckCorrectness(ExprByteCode *expr) * and make sure at the end of the program there is * a single result on the stack. */ for (i = 0; i < expr->len; i++) { - switch(expr->opcode[i]) { + switch (expr->opcode[i]) { case JIM_EXPROP_NUMBER: case JIM_EXPROP_STRING: case JIM_EXPROP_SUBST: @@ -6623,8 +6623,8 @@ static void ExprMakeLazy(Jim_Interp *interp, ExprByteCode *expr) /* Search for the end of the first operator */ leftindex = index-1; arity = 1; - while(arity) { - switch(expr->opcode[leftindex]) { + while (arity) { + switch (expr->opcode[leftindex]) { case JIM_EXPROP_NUMBER: case JIM_EXPROP_COMMAND: case JIM_EXPROP_VARIABLE: @@ -6697,7 +6697,7 @@ int SetExprFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) Jim_InitStack(&stack); JimParserInit(&parser, exprText, exprTextLen, 1); - while(!JimParserEof(&parser)) { + while (!JimParserEof(&parser)) { char *token; int len, type; @@ -6710,7 +6710,7 @@ int SetExprFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) Jim_Free(token); break; } - switch(type) { + switch (type) { case JIM_TT_STR: ExprObjAddInstr(interp, expr, JIM_EXPROP_STRING, token, len); break; @@ -6731,7 +6731,7 @@ int SetExprFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) break; case JIM_TT_EXPR_OPERATOR: op = JimExprOperatorInfo(token); - while(1) { + while (1) { Jim_ExprOperator *stackTopOp; if (Jim_StackPeek(&stack) != NULL) { @@ -6758,7 +6758,7 @@ int SetExprFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) case JIM_TT_SUBEXPR_END: { int found = 0; - while(Jim_StackLen(&stack)) { + while (Jim_StackLen(&stack)) { char *opstr = Jim_StackPop(&stack); if (!strcmp(opstr, "(")) { Jim_Free(opstr); @@ -6949,18 +6949,18 @@ int Jim_EvalExpression(Jim_Interp *interp, Jim_Obj *exprObjPtr, } Jim_DecrRefCount(interp, A); Jim_DecrRefCount(interp, B); - switch(expr->opcode[i]) { + switch (expr->opcode[i]) { case JIM_EXPROP_ADD: wC = wA+wB; break; case JIM_EXPROP_SUB: wC = wA-wB; break; case JIM_EXPROP_MUL: wC = wA*wB; break; case JIM_EXPROP_LT: wC = wAwB; break; - case JIM_EXPROP_LTE: wC = wA<=wB; break; - case JIM_EXPROP_GTE: wC = wA>=wB; break; + case JIM_EXPROP_LTE: wC = wA <= wB; break; + case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_LSHIFT: wC = wA<>wB; break; + case JIM_EXPROP_RSHIFT: wC = wA >> wB; break; case JIM_EXPROP_NUMEQ: wC = wA==wB; break; - case JIM_EXPROP_NUMNE: wC = wA!=wB; break; + case JIM_EXPROP_NUMNE: wC = wA != wB; break; case JIM_EXPROP_BITAND: wC = wA&wB; break; case JIM_EXPROP_BITXOR: wC = wA^wB; break; case JIM_EXPROP_BITOR: wC = wA|wB; break; @@ -6996,7 +6996,7 @@ int Jim_EvalExpression(Jim_Interp *interp, Jim_Obj *exprObjPtr, wC = _rotl(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA<>(S-wB))); + wC = (unsigned long)((uA<> (S-wB))); #endif break; } @@ -7006,7 +7006,7 @@ int Jim_EvalExpression(Jim_Interp *interp, Jim_Obj *exprObjPtr, wC = _rotr(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA>>wB)|(uA<<(S-wB))); + wC = (unsigned long)((uA >> wB)|(uA<<(S-wB))); #endif break; } @@ -7040,7 +7040,7 @@ trydouble: } Jim_DecrRefCount(interp, A); Jim_DecrRefCount(interp, B); - switch(expr->opcode[i]) { + switch (expr->opcode[i]) { case JIM_EXPROP_ROTL: case JIM_EXPROP_ROTR: case JIM_EXPROP_LSHIFT: @@ -7060,10 +7060,10 @@ trydouble: case JIM_EXPROP_MUL: dC = dA*dB; break; case JIM_EXPROP_LT: dC = dAdB; break; - case JIM_EXPROP_LTE: dC = dA<=dB; break; - case JIM_EXPROP_GTE: dC = dA>=dB; break; + case JIM_EXPROP_LTE: dC = dA <= dB; break; + case JIM_EXPROP_GTE: dC = dA >= dB; break; case JIM_EXPROP_NUMEQ: dC = dA==dB; break; - case JIM_EXPROP_NUMNE: dC = dA!=dB; break; + case JIM_EXPROP_NUMNE: dC = dA != dB; break; case JIM_EXPROP_LOGICAND_LEFT: if (dA == 0) { i += (int)dB; @@ -7097,7 +7097,7 @@ trydouble: retry_as_string: sA = Jim_GetString(A, &Alen); sB = Jim_GetString(B, &Blen); - switch(opcode) { + switch (opcode) { case JIM_EXPROP_STREQ: if (Alen == Blen && memcmp(sA, sB, Alen) ==0) wC = 1; @@ -7134,7 +7134,7 @@ retry_as_string: goto trydouble_unary; } Jim_DecrRefCount(interp, A); - switch(expr->opcode[i]) { + switch (expr->opcode[i]) { case JIM_EXPROP_NOT: wC = !wA; break; case JIM_EXPROP_BITNOT: wC = ~wA; break; case JIM_EXPROP_LOGICAND_RIGHT: @@ -7155,7 +7155,7 @@ trydouble_unary: goto err; } Jim_DecrRefCount(interp, A); - switch(expr->opcode[i]) { + switch (expr->opcode[i]) { case JIM_EXPROP_NOT: dC = !dA; break; case JIM_EXPROP_LOGICAND_RIGHT: case JIM_EXPROP_LOGICOR_RIGHT: dC = (dA != 0); break; @@ -8454,7 +8454,7 @@ int Jim_InterpolateTokens(Jim_Interp *interp, ScriptToken *token, /* Compute every token forming the argument * in the intv objects vector. */ for (i = 0; i < tokens; i++) { - switch(token[i].type) { + switch (token[i].type) { case JIM_TT_ESC: case JIM_TT_STR: intv[i] = token[i].objPtr; @@ -8628,7 +8628,7 @@ int Jim_EvalObj(Jim_Interp *interp, Jim_Obj *scriptObjPtr) if (tokens == 1) { /* Fast path if the token does not * need interpolation */ - switch(token[i].type) { + switch (token[i].type) { case JIM_TT_ESC: case JIM_TT_STR: argv[j] = token[i].objPtr; @@ -9020,7 +9020,7 @@ static int JimParseSubst(struct JimParserCtx *pc, int flags) pc->eof = 1; return JIM_OK; } - switch(*pc->p) { + switch (*pc->p) { case '[': retval = JimParseCmd(pc); if (flags & JIM_SUBST_NOCMD) { @@ -9094,7 +9094,7 @@ int SetSubstFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr, int flags) script->fileName = NULL; JimParserInit(&parser, scriptText, scriptTextLen, 1); - while(1) { + while (1) { char *token; int len, type, linenr; @@ -9170,7 +9170,7 @@ int Jim_SubstObj(Jim_Interp *interp, Jim_Obj *substObjPtr, for (i = 0; i < len; i++) { Jim_Obj *objPtr; - switch(token[i].type) { + switch (token[i].type) { case JIM_TT_STR: case JIM_TT_ESC: Jim_AppendObj(interp, resObjPtr, token[i].objPtr); @@ -9773,7 +9773,7 @@ static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, if ((expr = Jim_GetExpression(interp, argv[1])) == NULL) goto noopt; if (expr->len <= 0 || expr->len > 3) goto noopt; - switch(expr->len) { + switch (expr->len) { case 1: if (expr->opcode[0] != JIM_EXPROP_VARIABLE && expr->opcode[0] != JIM_EXPROP_NUMBER) @@ -9789,7 +9789,7 @@ static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, (expr->opcode[1] != JIM_EXPROP_NUMBER && expr->opcode[1] != JIM_EXPROP_VARIABLE)) goto noopt; - switch(expr->opcode[2]) { + switch (expr->opcode[2]) { case JIM_EXPROP_LT: case JIM_EXPROP_LTE: case JIM_EXPROP_GT: @@ -9834,7 +9834,7 @@ static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, } if (!wideValue) break; if ((retval = Jim_EvalObj(interp, argv[2])) != JIM_OK) { - switch(retval) { + switch (retval) { case JIM_BREAK: if (varAObjPtr) Jim_DecrRefCount(interp, varAObjPtr); @@ -9885,7 +9885,7 @@ static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, goto noopt; } } - switch(cmpType) { + switch (cmpType) { case JIM_EXPROP_LT: cmpRes = wideValueA < wideValueB; break; case JIM_EXPROP_LTE: @@ -9901,7 +9901,7 @@ static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, } if (!cmpRes) break; if ((retval = Jim_EvalObj(interp, argv[2])) != JIM_OK) { - switch(retval) { + switch (retval) { case JIM_BREAK: Jim_DecrRefCount(interp, varAObjPtr); if (varBObjPtr) @@ -9941,7 +9941,7 @@ noopt: return retval; if (!boolean) break; if ((retval = Jim_EvalObj(interp, argv[2])) != JIM_OK) { - switch(retval) { + switch (retval) { case JIM_BREAK: goto out; break; @@ -10078,7 +10078,7 @@ static int Jim_ForCoreCommand(Jim_Interp *interp, int argc, } /* Eval body */ if ((retval = Jim_EvalObj(interp, argv[4])) != JIM_OK) { - switch(retval) { + switch (retval) { case JIM_BREAK: if (stopVarNamePtr) Jim_DecrRefCount(interp, stopVarNamePtr); @@ -10147,7 +10147,7 @@ testcond: if (!boolean) break; /* Eval body */ if ((retval = Jim_EvalObj(interp, argv[4])) != JIM_OK) { - switch(retval) { + switch (retval) { case JIM_BREAK: goto out; break; @@ -10161,7 +10161,7 @@ testcond: evalnext: /* Eval next */ if ((retval = Jim_EvalObj(interp, argv[3])) != JIM_OK) { - switch(retval) { + switch (retval) { case JIM_BREAK: goto out; break; @@ -10425,7 +10425,7 @@ static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc, script = caseList[i+1]; } } - for(; i < patCount && Jim_CompareStringImmediate(interp, script, "-"); + for (; i < patCount && Jim_CompareStringImmediate(interp, script, "-"); i += 2) script = caseList[i+1]; if (script && Jim_CompareStringImmediate(interp, script, "-")) { @@ -10615,7 +10615,7 @@ static int Jim_LsortCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const arg if (Jim_GetEnum(interp, argv[i], options, &option, "option", JIM_ERRMSG) != JIM_OK) return JIM_ERR; - switch(option) { + switch (option) { case OPT_ASCII: lsortType = JIM_LSORT_ASCII; break; case OPT_NOCASE: lsortType = JIM_LSORT_NOCASE; break; case OPT_INCREASING: decreasing = 0; break; @@ -10623,7 +10623,7 @@ static int Jim_LsortCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const arg } } if (decreasing) { - switch(lsortType) { + switch (lsortType) { case JIM_LSORT_ASCII: lsortType = JIM_LSORT_ASCII_DECR; break; case JIM_LSORT_NOCASE: lsortType = JIM_LSORT_NOCASE_DECR; break; } @@ -10800,7 +10800,7 @@ static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, const char *type; Jim_ExprOperator *op; - switch(expr->opcode[i]) { + switch (expr->opcode[i]) { case JIM_EXPROP_NUMBER: type = "number"; break; case JIM_EXPROP_COMMAND: type = "command"; break; case JIM_EXPROP_VARIABLE: type = "variable"; break; @@ -11138,7 +11138,7 @@ static Jim_Obj *JimStringMap(Jim_Interp *interp, Jim_Obj *mapListObjPtr, } str = Jim_GetString(objPtr, &strLen); /* Map it */ - while(strLen) { + while (strLen) { for (i = 0; i < numMaps; i++) { if (strLen >= keyLen[i] && keyLen[i]) { if (!JimStringCompare(str, keyLen[i], key[i], keyLen[i], @@ -11630,7 +11630,7 @@ static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, return JIM_ERR; } i = argc-2; - while(i--) { + while (i--) { if (Jim_CompareStringImmediate(interp, argv[i+1], "-nobackslashes")) flags |= JIM_SUBST_NOESC; @@ -12283,7 +12283,7 @@ void Jim_RegisterCoreCommands(Jim_Interp *interp) { int i = 0; - while(Jim_CoreCommandsTable[i].name != NULL) { + while (Jim_CoreCommandsTable[i].name != NULL) { Jim_CreateCommand(interp, Jim_CoreCommandsTable[i].name, Jim_CoreCommandsTable[i].cmdProc, @@ -12361,7 +12361,7 @@ int Jim_InteractivePrompt(Jim_Interp *interp) Jim_fflush( interp, interp->cookie_stdout); scriptObjPtr = Jim_NewStringObj(interp, "", 0); Jim_IncrRefCount(scriptObjPtr); - while(1) { + while (1) { const char *str; char state; int len; @@ -12457,7 +12457,7 @@ char* Jim_fgets( Jim_Interp *interp, char *s, int size, void *cookie ) Jim_Nvp * Jim_Nvp_name2value_simple( const Jim_Nvp *p, const char *name ) { - while( p->name ){ + while ( p->name ){ if ( 0 == strcmp( name, p->name ) ){ break; } @@ -12469,7 +12469,7 @@ Jim_Nvp_name2value_simple( const Jim_Nvp *p, const char *name ) Jim_Nvp * Jim_Nvp_name2value_nocase_simple( const Jim_Nvp *p, const char *name ) { - while( p->name ){ + while ( p->name ){ if ( 0 == strcasecmp( name, p->name ) ){ break; } @@ -12553,7 +12553,7 @@ Jim_Nvp_value2name_obj( Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nv Jim_Nvp * Jim_Nvp_value2name_simple( const Jim_Nvp *p, int value ) { - while( p->name ){ + while ( p->name ){ if ( value == p->value ){ break; } @@ -12599,7 +12599,7 @@ Jim_GetOpt_Debug( Jim_GetOptInfo *p ) int x; Jim_fprintf( p->interp, p->interp->cookie_stderr, "---args---\n"); - for( x = 0 ; x < p->argc ; x++ ){ + for ( x = 0 ; x < p->argc ; x++ ){ Jim_fprintf( p->interp, p->interp->cookie_stderr, "%2d) %s\n", x, @@ -12792,7 +12792,7 @@ Jim_SetResult_NvpUnknown( Jim_Interp *interp, "Unknown param: %s, try one of: ", Jim_GetString( param_value, NULL ) ); } - while( nvp->name ){ + while ( nvp->name ){ const char *a; const char *b; @@ -12823,7 +12823,7 @@ Jim_Debug_ArgvString( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } debug_string_obj = Jim_NewEmptyStringObj( interp ); - for( x = 0 ; x < argc ; x++ ){ + for ( x = 0 ; x < argc ; x++ ){ Jim_AppendStrings( interp, debug_string_obj, Jim_GetString( argv[x], NULL ),