From: zwelch Date: Tue, 23 Jun 2009 22:36:11 +0000 (+0000) Subject: - Replace 'while(' with 'while ('. X-Git-Tag: v0.2.0~157 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=50c086ffb94f199c088f4cc52b7887b668dddf00;p=openocd - Replace 'while(' with 'while ('. git-svn-id: svn://svn.berlios.de/openocd/trunk@2358 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- diff --git a/src/flash/avrf.c b/src/flash/avrf.c index fc67178b..e4012da7 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -156,7 +156,7 @@ static int avr_jtagprg_chiperase(avr_common_t *avr) return ERROR_FAIL; } LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value); - }while(!(poll_value & 0x0200)); + }while (!(poll_value & 0x0200)); return ERROR_OK; } @@ -203,7 +203,7 @@ static int avr_jtagprg_writeflashpage(avr_common_t *avr, uint8_t *page_buf, uint return ERROR_FAIL; } LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value); - }while(!(poll_value & 0x0200)); + }while (!(poll_value & 0x0200)); return ERROR_OK; } @@ -277,7 +277,7 @@ static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offse } cur_size = 0; - while(count > 0) + while (count > 0) { if (count > page_size) { diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index a0d6f41e..378d9b24 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -452,7 +452,7 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3 target_free_working_area(target, source); - while(count > 0) + while (count > 0) { uint32_t value; memcpy(&value, buffer, sizeof(uint32_t)); diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index 32f6433d..e8ee2fbf 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -610,7 +610,7 @@ static int stellaris_erase(struct flash_bank_s *bank, int first, int last) { target_read_u32(target, FLASH_FMC, &flash_fmc); } - while(flash_fmc & FMC_ERASE); + while (flash_fmc & FMC_ERASE); /* Check acess violations */ target_read_u32(target, FLASH_CRIS, &flash_cris); @@ -687,7 +687,7 @@ static int stellaris_protect(struct flash_bank_s *bank, int set, int first, int { target_read_u32(target, FLASH_FMC, &flash_fmc); } - while(flash_fmc & FMC_COMT); + while (flash_fmc & FMC_COMT); /* Check acess violations */ target_read_u32(target, FLASH_CRIS, &flash_cris); @@ -926,7 +926,7 @@ static int stellaris_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t uint8_t last_word[4] = {0xff, 0xff, 0xff, 0xff}; int i = 0; - while(bytes_remaining > 0) + while (bytes_remaining > 0) { last_word[i++] = *(buffer + bytes_written); bytes_remaining--; diff --git a/src/flash/str7x.c b/src/flash/str7x.c index 43139521..13b22be5 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -578,7 +578,7 @@ static int str7x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offs uint8_t last_dword[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; int i = 0; - while(bytes_remaining > 0) + while (bytes_remaining > 0) { last_dword[i++] = *(buffer + bytes_written); bytes_remaining--; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 587c145f..0a75c953 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -607,7 +607,7 @@ static int str9x_write(struct flash_bank_s *bank, uint8_t last_halfword[2] = {0xff, 0xff}; int i = 0; - while(bytes_remaining > 0) + while (bytes_remaining > 0) { last_halfword[i++] = *(buffer + bytes_written); bytes_remaining--; diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index c614d769..fc1bfbcd 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -542,7 +542,7 @@ static int str9xpec_lock_device(struct flash_bank_s *bank) jtag_add_dr_scan(1, &field, jtag_get_end_state()); jtag_execute_queue(); - } while(!(status & ISC_STATUS_BUSY)); + } while (!(status & ISC_STATUS_BUSY)); str9xpec_isc_disable(bank); @@ -722,7 +722,7 @@ static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o status = buf_get_u32(scanbuf, 0, 8); - } while(!(status & ISC_STATUS_BUSY)); + } while (!(status & ISC_STATUS_BUSY)); if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS) return ERROR_FLASH_OPERATION_FAILED; @@ -740,7 +740,7 @@ static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o uint8_t last_dword[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; int i = 0; - while(bytes_remaining > 0) + while (bytes_remaining > 0) { last_dword[i++] = *(buffer + bytes_written); bytes_remaining--; @@ -772,7 +772,7 @@ static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o status = buf_get_u32(scanbuf, 0, 8); - } while(!(status & ISC_STATUS_BUSY)); + } while (!(status & ISC_STATUS_BUSY)); if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS) return ERROR_FLASH_OPERATION_FAILED; @@ -962,7 +962,7 @@ static int str9xpec_write_options(struct flash_bank_s *bank) jtag_add_dr_scan(1, &field, jtag_get_end_state()); jtag_execute_queue(); - } while(!(status & ISC_STATUS_BUSY)); + } while (!(status & ISC_STATUS_BUSY)); str9xpec_isc_disable(bank); diff --git a/src/helper/command.c b/src/helper/command.c index ec1d637f..64056843 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -269,11 +269,11 @@ int unregister_all_commands(command_context_t *context) if (context == NULL) return ERROR_OK; - while(NULL != context->commands) + while (NULL != context->commands) { c = context->commands; - while(NULL != c->children) + while (NULL != c->children) { c2 = c->children; c->children = c->children->next; @@ -304,7 +304,7 @@ int unregister_command(command_context_t *context, char *name) /* find command */ c = context->commands; - while(NULL != c) + while (NULL != c) { if (strcmp(name, c->name) == 0) { @@ -320,7 +320,7 @@ int unregister_command(command_context_t *context, char *name) } /* unregister children */ - while(NULL != c->children) + while (NULL != c->children) { c2 = c->children; c->children = c->children->next; diff --git a/src/helper/jim-eventloop.c b/src/helper/jim-eventloop.c index 7524d39f..29402536 100644 --- a/src/helper/jim-eventloop.c +++ b/src/helper/jim-eventloop.c @@ -116,7 +116,7 @@ void Jim_DeleteFileHandler(Jim_Interp *interp, void *handle) Jim_EventLoop *eventLoop = Jim_GetAssocData(interp, "eventloop"); fe = eventLoop->fileEventHead; - while(fe) { + while (fe) { if (fe->handle == handle) { if (prev == NULL) eventLoop->fileEventHead = fe->next; @@ -194,7 +194,7 @@ jim_wide Jim_DeleteTimeHandler(Jim_Interp *interp, jim_wide id) te = eventLoop->timeEventHead; if (id >= eventLoop->timeEventNextId) return -2; /* wrong event ID */ - while(te) { + while (te) { if (te->id == id) { remain = (te->when_sec - cur_sec) * 1000; remain += (te->when_ms - cur_ms) ; @@ -224,7 +224,7 @@ static Jim_TimeEvent *JimSearchNearestTimer(Jim_EventLoop *eventLoop) Jim_TimeEvent *te = eventLoop->timeEventHead; Jim_TimeEvent *nearest = NULL; - while(te) { + while (te) { if (!nearest || te->when_sec < nearest->when_sec || (te->when_sec == nearest->when_sec && te->when_ms < nearest->when_ms)) @@ -319,7 +319,7 @@ int Jim_ProcessEvents(Jim_Interp *interp, int flags) } } else if (retval > 0) { fe = eventLoop->fileEventHead; - while(fe != NULL) { + while (fe != NULL) { int fd = fileno((FILE*)fe->handle); // fprintf(stderr,"fd: %d mask: %02x \n",fd,fe->mask); @@ -361,7 +361,7 @@ int Jim_ProcessEvents(Jim_Interp *interp, int flags) /* Check time events */ te = eventLoop->timeEventHead; maxId = eventLoop->timeEventNextId-1; - while(te) { + while (te) { long now_sec, now_ms; jim_wide id; @@ -400,7 +400,7 @@ void JimELAssocDataDeleProc(Jim_Interp *interp, void *data) Jim_EventLoop *eventLoop = data; fe = eventLoop->fileEventHead; - while(fe) { + while (fe) { next = fe->next; if (fe->finalizerProc) fe->finalizerProc(interp, fe->clientData); @@ -409,7 +409,7 @@ void JimELAssocDataDeleProc(Jim_Interp *interp, void *data) } te = eventLoop->timeEventHead; - while(te) { + while (te) { next = te->next; if (te->finalizerProc) te->finalizerProc(interp, te->clientData); diff --git a/src/helper/jim.c b/src/helper/jim.c index d62346c1..28c65123 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -245,7 +245,7 @@ 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) { + while (patternLen) { switch(pattern[0]) { case '*': while (pattern[1] == '*') { @@ -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++; } @@ -661,7 +661,7 @@ unsigned int Jim_IdentityHashFunction(unsigned int key) unsigned int Jim_GenHashFunction(const unsigned char *buf, int len) { unsigned int h = 0; - while(len--) + while (len--) h += (h<<3)+*buf++; return h; } @@ -729,7 +729,7 @@ int Jim_ExpandHashTable(Jim_HashTable *ht, unsigned int size) /* For each hash entry on this slot... */ he = ht->table[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; @@ -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) @@ -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--; } @@ -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); @@ -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 '$': @@ -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; @@ -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' || @@ -6623,7 +6623,7 @@ static void ExprMakeLazy(Jim_Interp *interp, ExprByteCode *expr) /* Search for the end of the first operator */ leftindex = index-1; arity = 1; - while(arity) { + while (arity) { switch(expr->opcode[leftindex]) { case JIM_EXPROP_NUMBER: case JIM_EXPROP_COMMAND: @@ -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; @@ -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); @@ -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; @@ -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; } @@ -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; diff --git a/src/helper/jim.h b/src/helper/jim.h index 0b7f45bd..e102eb7d 100644 --- a/src/helper/jim.h +++ b/src/helper/jim.h @@ -241,7 +241,7 @@ typedef struct Jim_HashTableIterator { entry->val = (ht)->type->valDup((ht)->privdata, _val_); \ else \ entry->val = (_val_); \ -} while(0) +} while (0) #define Jim_FreeEntryKey(ht, entry) \ if ((ht)->type->keyDestructor) \ @@ -252,7 +252,7 @@ typedef struct Jim_HashTableIterator { entry->key = (ht)->type->keyDup((ht)->privdata, _key_); \ else \ entry->key = (_key_); \ -} while(0) +} while (0) #define Jim_CompareHashKeys(ht, key1, key2) \ (((ht)->type->keyCompare) ? \ @@ -555,7 +555,7 @@ typedef struct Jim_Interp { Jim_IncrRefCount(_resultObjPtr_); \ Jim_DecrRefCount(i,(i)->result); \ (i)->result = _resultObjPtr_; \ -} while(0) +} while (0) /* Reference structure. The interpreter pointer is held within privdata member in HashTable */ #define JIM_REFERENCE_TAGLEN 7 /* The tag is fixed-length, because the reference @@ -985,7 +985,7 @@ typedef struct jim_getopt { * * Jim_GetOpt_Setup( &goi, interp, argc, argv ); * - * while( goi.argc ){ + * while ( goi.argc ){ * e = Jim_GetOpt_Nvp( &goi, nvp_options, &n ); * if ( e != JIM_OK ){ * Jim_GetOpt_NvpUnknown( &goi, nvp_options, 0 ); @@ -1102,7 +1102,7 @@ JIM_STATIC int JIM_API( Jim_GetOpt_Nvp)( Jim_GetOptInfo *goi, const Jim_Nvp *loo * Example: * \code * - * while( goi.argc ){ + * while ( goi.argc ){ * // Get the next option * e = Jim_GetOpt_Nvp( &goi, cmd_options, &n ); * if ( e != JIM_OK ){ diff --git a/src/jtag/core.c b/src/jtag/core.c index ad3fb72f..dd5c0a0e 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -142,7 +142,7 @@ unsigned jtag_tap_count_enabled(void) { jtag_tap_t *t = jtag_all_taps(); unsigned n = 0; - while(t) + while (t) { if (t->enabled) n++; @@ -157,7 +157,7 @@ void jtag_tap_add(struct jtag_tap_s *t) t->abs_chain_position = jtag_num_taps++; jtag_tap_t **tap = &__jtag_all_taps; - while(*tap != NULL) + while (*tap != NULL) tap = &(*tap)->next_tap; *tap = t; } diff --git a/src/jtag/interface.c b/src/jtag/interface.c index 9e8c4e41..be85f98e 100644 --- a/src/jtag/interface.c +++ b/src/jtag/interface.c @@ -372,7 +372,7 @@ tap_state_t tap_state_by_name(const char *name) #ifdef _DEBUG_JTAG_IO_ #define JTAG_DEBUG_STATE_APPEND(buf, len, bit) \ - do { buf[len] = bit ? '1' : '0'; } while(0) + do { buf[len] = bit ? '1' : '0'; } while (0) #define JTAG_DEBUG_STATE_PRINT(a, b, astr, bstr) \ DEBUG_JTAG_IO("TAP/SM: %9s -> %5s\tTMS: %s\tTDI: %s", \ tap_state_name(a), tap_state_name(b), astr, bstr) diff --git a/src/jtag/rlink/rlink.c b/src/jtag/rlink/rlink.c index 5ded30b0..3d735d6d 100644 --- a/src/jtag/rlink/rlink.c +++ b/src/jtag/rlink/rlink.c @@ -128,7 +128,7 @@ ep1_generic_commandl( usb_buffer_p = usb_buffer; va_start(ap, length); - while(length > 0) { + while (length > 0) { *usb_buffer_p++ = va_arg(ap, int); length--; } @@ -175,7 +175,7 @@ ep1_memory_read( remain = length; count = 0; - while(remain) { + while (remain) { if (remain > sizeof(usb_buffer)) { length = sizeof(usb_buffer); } else { @@ -236,7 +236,7 @@ ep1_memory_write( remain = length; count = 0; - while(remain) { + while (remain) { if (remain > (sizeof(usb_buffer) - 4)) { length = (sizeof(usb_buffer) - 4); } else { @@ -299,7 +299,7 @@ ep1_memory_writel( buffer_p = buffer; va_start(ap, length); - while(remain > 0) { + while (remain > 0) { *buffer_p++ = va_arg(ap, int); remain--; } @@ -348,7 +348,7 @@ dtc_load_from_buffer( ); if (usb_err < 0) return(usb_err); - while(length) { + while (length) { if (length < sizeof(*header)) { LOG_ERROR("Malformed DTC image\n"); exit(1); @@ -1169,7 +1169,7 @@ rlink_scan( x = 0; dtc_mask = 1 << (extra_bits - 1); - while(extra_bits--) { + while (extra_bits--) { if (*tdi_p & tdi_mask) { x |= dtc_mask; } @@ -1190,7 +1190,7 @@ rlink_scan( } /* Loop scheduling full bytes into the DTC command buffer */ - while(byte_bits) { + while (byte_bits) { if (type == SCAN_IN) { /* make sure there's room for stop and byte op */ x = (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1)); @@ -1260,7 +1260,7 @@ rlink_scan( x = 0; dtc_mask = 1 << (8 - 1); - while(chunk_bits--) { + while (chunk_bits--) { if (*tdi_p & tdi_mask) { x |= dtc_mask; } @@ -1315,7 +1315,7 @@ rlink_scan( x = 0; dtc_mask = 1 << (8 - 1); - while(extra_bits--) { + while (extra_bits--) { if (*tdi_p & tdi_mask) { x |= dtc_mask; } @@ -1682,7 +1682,7 @@ int rlink_init(void) LOG_DEBUG("interface claimed!\n"); break; } - } while(--retries); + } while (--retries); if (!i) { @@ -1695,7 +1695,7 @@ int rlink_init(void) success=1; } } - } while(0); + } while (0); } } } diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 13a4da65..75153636 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -367,7 +367,7 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi ) /* clear them as we find them */ reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK); - while( goi->argc ){ + while ( goi->argc ){ e = Jim_GetOpt_Nvp( goi, opts, &n ); if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( goi, opts, 0 ); @@ -441,7 +441,7 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi ) break; } } /* switch(n->value) */ - } /* while( goi->argc ) */ + } /* while ( goi->argc ) */ /* default is enabled-after-reset */ pTap->enabled = !pTap->disabled_after_reset; @@ -861,7 +861,7 @@ static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cm command_print(cmd_ctx, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr "); command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------"); - while( tap ){ + while ( tap ){ uint32_t expected, expected_mask, cur_instr, ii; expected = buf_get_u32(tap->expected, 0, tap->ir_length); expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length); diff --git a/src/server/server.c b/src/server/server.c index 0840c523..bca9774f 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -116,7 +116,7 @@ int remove_connection(service_t *service, connection_t *connection) connection_t *c; /* find connection */ - while((c = *p)) + while ((c = *p)) { if (c->fd == connection->fd) { @@ -237,7 +237,7 @@ int remove_service(unsigned short port) service_t *c; /* find service */ - while((c = *p)) + while ((c = *p)) { if (c->port == port) { @@ -264,7 +264,7 @@ int remove_services(void) service_t *c = services; /* loop service */ - while(c) + while (c) { service_t *next = c->next; @@ -310,7 +310,7 @@ int server_loop(command_context_t *command_context) tv.tv_sec = 0; tv.tv_usec = 10000; - while(!shutdown_openocd) + while (!shutdown_openocd) { /* monitor sockets for acitvity */ fd_max = 0; diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index 8788ba98..6a5b7ba2 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -30,7 +30,7 @@ #if 0 #define JTAG_DEBUG(expr ...) DEBUG(expr) #else -#define JTAG_DEBUG(expr ...) do {} while(0) +#define JTAG_DEBUG(expr ...) do {} while (0) #endif /* diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 1ffa604b..94fd6871 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -908,7 +908,7 @@ int cortex_m3_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) if (breakpoint->type == BKPT_HARD) { - while(comparator_list[fp_num].used && (fp_num < cortex_m3->fp_num_code)) + while (comparator_list[fp_num].used && (fp_num < cortex_m3->fp_num_code)) fp_num++; if (fp_num >= cortex_m3->fp_num_code) { @@ -1091,7 +1091,7 @@ int cortex_m3_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint) if (watchpoint->mask == 0xffffffffu) { - while(comparator_list[dwt_num].used && (dwt_num < cortex_m3->dwt_num_comp)) + while (comparator_list[dwt_num].used && (dwt_num < cortex_m3->dwt_num_comp)) dwt_num++; if (dwt_num >= cortex_m3->dwt_num_comp) { diff --git a/src/target/mips32_dmaacc.c b/src/target/mips32_dmaacc.c index 9727f4e8..cd73d6e2 100644 --- a/src/target/mips32_dmaacc.c +++ b/src/target/mips32_dmaacc.c @@ -61,7 +61,7 @@ begin_ejtag_dma_read: do { ejtag_ctrl = EJTAG_CTRL_DMAACC | ejtag_info->ejtag_ctrl; mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); - } while(ejtag_ctrl & EJTAG_CTRL_DSTRT); + } while (ejtag_ctrl & EJTAG_CTRL_DSTRT); /* Read Data */ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_DATA, NULL); @@ -107,7 +107,7 @@ begin_ejtag_dma_read_h: do { ejtag_ctrl = EJTAG_CTRL_DMAACC | ejtag_info->ejtag_ctrl; mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); - } while(ejtag_ctrl & EJTAG_CTRL_DSTRT); + } while (ejtag_ctrl & EJTAG_CTRL_DSTRT); /* Read Data */ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_DATA, NULL); @@ -159,7 +159,7 @@ begin_ejtag_dma_read_b: do { ejtag_ctrl = EJTAG_CTRL_DMAACC | ejtag_info->ejtag_ctrl; mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); - } while(ejtag_ctrl & EJTAG_CTRL_DSTRT); + } while (ejtag_ctrl & EJTAG_CTRL_DSTRT); /* Read Data */ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_DATA, NULL); @@ -226,7 +226,7 @@ begin_ejtag_dma_write: do { ejtag_ctrl = EJTAG_CTRL_DMAACC | ejtag_info->ejtag_ctrl; mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); - } while(ejtag_ctrl & EJTAG_CTRL_DSTRT); + } while (ejtag_ctrl & EJTAG_CTRL_DSTRT); /* Clear DMA & Check DERR */ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL, NULL); @@ -277,7 +277,7 @@ begin_ejtag_dma_write_h: do { ejtag_ctrl = EJTAG_CTRL_DMAACC | ejtag_info->ejtag_ctrl; mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); - } while(ejtag_ctrl & EJTAG_CTRL_DSTRT); + } while (ejtag_ctrl & EJTAG_CTRL_DSTRT); /* Clear DMA & Check DERR */ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL, NULL); @@ -329,7 +329,7 @@ begin_ejtag_dma_write_b: do { ejtag_ctrl = EJTAG_CTRL_DMAACC | ejtag_info->ejtag_ctrl; mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); - } while(ejtag_ctrl & EJTAG_CTRL_DSTRT); + } while (ejtag_ctrl & EJTAG_CTRL_DSTRT); /* Clear DMA & Check DERR */ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL, NULL); diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index be88df84..71dab5db 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -509,7 +509,7 @@ int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) { int bp_num = 0; - while(comparator_list[bp_num].used && (bp_num < mips32->num_inst_bpoints)) + while (comparator_list[bp_num].used && (bp_num < mips32->num_inst_bpoints)) bp_num++; if (bp_num >= mips32->num_inst_bpoints) { diff --git a/src/target/target.c b/src/target/target.c index 3505f9c2..10e8660f 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -244,7 +244,7 @@ static int max_target_number(void) x = -1; t = all_targets; - while( t ){ + while ( t ){ if ( x < t->target_number ){ x = (t->target_number)+1; } @@ -262,7 +262,7 @@ static int new_target_number(void) /* number is 0 based */ x = -1; t = all_targets; - while(t){ + while (t){ if ( x < t->target_number ){ x = t->target_number; } @@ -1728,7 +1728,7 @@ static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char reg_cache_t *cache = target->reg_cache; count = 0; - while(cache) + while (cache) { int i; for (i = 0; i < cache->num_regs; i++) @@ -1759,7 +1759,7 @@ static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char reg_cache_t *cache = target->reg_cache; count = 0; - while(cache) + while (cache) { int i; for (i = 0; i < cache->num_regs; i++) @@ -3378,7 +3378,7 @@ void target_handle_event( target_t *target, enum target_event e ) teap = target->event_action; done = 0; - while( teap ){ + while ( teap ){ if ( teap->event == e ){ done = 1; LOG_DEBUG( "target: (%d) %s (%s) event: %d (%s) action: %s\n", @@ -3437,7 +3437,7 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) int e; /* parse config or cget options ... */ - while( goi->argc > 0 ){ + while ( goi->argc > 0 ){ Jim_SetEmptyResult( goi->interp ); /* Jim_GetOpt_Debug( goi ); */ @@ -3505,7 +3505,7 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) teap = target->event_action; /* replace existing? */ - while( teap ){ + while ( teap ){ if ( teap->event == (enum target_event)n->value ){ break; } @@ -3687,7 +3687,7 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) /* loop for more e*/ break; } - } /* while( goi->argc ) */ + } /* while ( goi->argc ) */ /* done - we return */ @@ -3881,7 +3881,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) /* convert to "bytes" */ c = c * b; /* count is now in 'BYTES' */ - while( c > 0 ){ + while ( c > 0 ){ y = c; if ( y > 16 ){ y = 16; @@ -3934,7 +3934,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } } /* space pad */ - while( x < 16 ){ + while ( x < 16 ){ target_buf[x] = ' '; x++; } @@ -4063,7 +4063,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) target->cmd_name ); command_print( cmd_ctx, "%-25s | Body", "Event"); command_print( cmd_ctx, "------------------------- | ----------------------------------------"); - while( teap ){ + while ( teap ){ command_print( cmd_ctx, "%-25s | %s", Jim_Nvp_value2name_simple( nvp_target_event, teap->event )->name, @@ -4236,7 +4236,7 @@ static int target_create( Jim_GetOptInfo *goi ) { target_t **tpp; tpp = &(all_targets); - while( *tpp ){ + while ( *tpp ){ tpp = &( (*tpp)->next ); } *tpp = target; @@ -4326,7 +4326,7 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } Jim_SetResult( goi.interp, Jim_NewListObj( goi.interp, NULL, 0 ) ); target = all_targets; - while( target ){ + while ( target ){ Jim_ListAppendElement( goi.interp, Jim_GetResult(goi.interp), Jim_NewStringObj( goi.interp, target->cmd_name, -1 ) ); diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index 63568439..1c21e929 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -261,7 +261,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha LOG_USER("xsvf processing file: \"%s\"", filename); - while( read(xsvf_fd, &opcode, 1) > 0 ) + while ( read(xsvf_fd, &opcode, 1) > 0 ) { /* record the position of the just read opcode within the file */ file_offset = lseek(xsvf_fd, 0, SEEK_CUR) - 1; diff --git a/testing/examples/PIC32/BlinkingLeds.c b/testing/examples/PIC32/BlinkingLeds.c index 027f59ac..dc7f8cfd 100644 --- a/testing/examples/PIC32/BlinkingLeds.c +++ b/testing/examples/PIC32/BlinkingLeds.c @@ -9,7 +9,7 @@ int main(void) mPORTDClearBits(BIT_2); mPORTDSetPinsDigitalOut(BIT_2); - while(1) + while (1) { for(i = 0; i < 500000; i++) mPORTDToggleBits(BIT_0); diff --git a/testing/examples/ledtest-imx27ads/test.c b/testing/examples/ledtest-imx27ads/test.c index abb3bd15..467571dc 100644 --- a/testing/examples/ledtest-imx27ads/test.c +++ b/testing/examples/ledtest-imx27ads/test.c @@ -48,13 +48,13 @@ __gccmain() void exit(int exit_code) { - while(1); + while (1); } /* EXIT */ atexit() { - while(1); + while (1); } /* ATEXIT */ diff --git a/testing/examples/ledtest-imx31pdk/test.c b/testing/examples/ledtest-imx31pdk/test.c index 446bc909..9f3855df 100644 --- a/testing/examples/ledtest-imx31pdk/test.c +++ b/testing/examples/ledtest-imx31pdk/test.c @@ -29,7 +29,7 @@ int main (void) { volatile unsigned char *led = ((volatile unsigned char *)0xB6020000); - while(1) + while (1) { *led = 0xFF; delay(); @@ -46,13 +46,13 @@ __gccmain() void exit(int exit_code) { - while(1); + while (1); } /* EXIT */ atexit() { - while(1); + while (1); } /* ATEXIT */