]> git.sur5r.net Git - openocd/commitdiff
- Replace '){' with ') {'.
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:49:06 +0000 (22:49 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:49:06 +0000 (22:49 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2378 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/flash/str7x.c
src/flash/str9xpec.c
src/helper/command.c
src/helper/jim.c
src/helper/jim.h
src/jtag/core.c
src/jtag/interface.c
src/jtag/tcl.c
src/pld/xilinx_bit.c
src/server/gdb_server.c
src/target/target.c

index a0904182685aea2f5a1d9af52dceb40c71fb907b..902d0336e4d8da390af8ec58b9e850da9247a20c 100644 (file)
@@ -273,7 +273,7 @@ static int str7x_erase(struct flash_bank_s *bank, int first, int last)
        cmd = FLASH_SER | FLASH_WMS;
        target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd);
        
-       while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){
+       while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) {
                alive_sleep(1);
        }
        
@@ -329,7 +329,7 @@ static int str7x_protect(struct flash_bank_s *bank, int set, int first, int last
        cmd = FLASH_SPR | FLASH_WMS;
        target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd);
        
-       while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){
+       while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) {
                alive_sleep(1);
        }
        
index d74fa7d46e34212b76dd3d0079aac7c688c673c5..c1021ba026e7d7f9598cab129cd8c623292f28d6 100644 (file)
@@ -101,7 +101,7 @@ static int str9xpec_register_commands(struct command_context_s *cmd_ctx)
 
 int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state)
 {
-       if (tap == NULL){
+       if (tap == NULL) {
                return ERROR_TARGET_INVALID;
        }
 
@@ -671,11 +671,11 @@ static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o
                                check_address = sec_end;
                }
 
-               if ((offset >= sec_start) && (offset < sec_end)){
+               if ((offset >= sec_start) && (offset < sec_end)) {
                        first_sector = i;
                }
 
-               if ((offset + count >= sec_start) && (offset + count < sec_end)){
+               if ((offset + count >= sec_start) && (offset + count < sec_end)) {
                        last_sector = i;
                }
        }
index 61caf34580c7824890870247d48a6b57dad05d6d..94c3e464a0bf892cbd56b16c5644cac74066008b 100644 (file)
@@ -348,7 +348,7 @@ int unregister_command(command_context_t *context, char *name)
 
 void command_output_text(command_context_t *context, const char *data)
 {
-       if (context && context->output_handler && data){
+       if (context && context->output_handler && data) {
                context->output_handler(context, data);
        }
 }
index c4ed9332d682489aba5a29dd6d58075d9752ce4a..5d799e24cfa1b67143b30b45dfac083251ad4e05 100644 (file)
@@ -544,7 +544,7 @@ void Jim_Panic(Jim_Interp *interp, const char *fmt, ...)
 #endif
        
        /* This may actually crash... we do it last */
-       if (interp && interp->cookie_stderr){
+       if (interp && interp->cookie_stderr) {
                Jim_fprintf(interp, interp->cookie_stderr, JIM_NL "JIM INTERPRETER PANIC: ");
                Jim_vfprintf(interp, interp->cookie_stderr, fmt, ap);
                Jim_fprintf(interp, interp->cookie_stderr, JIM_NL JIM_NL);
@@ -2064,7 +2064,7 @@ void Jim_AppendString_sprintf(Jim_Interp *interp, Jim_Obj *objPtr, const char *f
        buf = jim_vasprintf(fmt, ap);
        va_end(ap);
 
-       if (buf){
+       if (buf) {
                Jim_AppendString(interp, objPtr, buf, -1);
                jim_vasprintf_done(buf);
        }
@@ -2283,10 +2283,10 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                haveprec = 0;
                prec = -1; /* not found yet */
     next_fmt:
-               if (fmtLen <= 0){
+               if (fmtLen <= 0) {
                        break;
                }
-               switch (*fmt){
+               switch (*fmt) {
                        /* terminals */
         case 'b': /* binary - not all printfs() do this */
                case 's': /* string */
@@ -2341,11 +2341,11 @@ 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--;
                        }
-                       if (inprec){
+                       if (inprec) {
                                haveprec = 1;
                                prec = accum;
                        } else {
@@ -2356,24 +2356,24 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                        /* suck up the next item as an integer */
                        fmt++;  fmtLen--;
                        objc--;
-                       if (objc <= 0){
+                       if (objc <= 0) {
                                goto not_enough_args;
                        }
-                       if (Jim_GetWide(interp,objv[0],&wideValue)== JIM_ERR){
+                       if (Jim_GetWide(interp,objv[0],&wideValue)== JIM_ERR) {
                                Jim_FreeNewObj(interp, resObjPtr);
                                return NULL;
                        }
-                       if (inprec){
+                       if (inprec) {
                                haveprec = 1;
                                prec = wideValue;
-                               if (prec < 0){
+                               if (prec < 0) {
                                        /* man 3 printf says */
                                        /* if prec is negative, it is zero */
                                        prec = 0;
                                }
                        } else {
                        width = wideValue;
-                       if (width < 0){
+                       if (width < 0) {
                                ljust = 1;
                                width = -width;
                        }
@@ -2402,32 +2402,32 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                 */
                cp = fmt_str;
                *cp++ = '%';
-               if (altfm){
+               if (altfm) {
                        *cp++ = '#';
                }
-               if (forceplus){
+               if (forceplus) {
                        *cp++ = '+';
-               } else if (spad){
+               } else if (spad) {
                        /* PLUS overrides */
                        *cp++ = ' ';
                }
-               if (ljust){
+               if (ljust) {
                        *cp++ = '-';
                }
-               if (zpad){
+               if (zpad) {
                        *cp++ = '0';
                }
-               if (width > 0){
+               if (width > 0) {
                        sprintf(cp, "%d", width);
                        /* skip ahead */
                        cp = strchr(cp,0);
                }
                /* did we find a period? */
-               if (inprec){
+               if (inprec) {
                        /* then add it */
                        *cp++ = '.';
                        /* did something occur after the period? */
-                       if (haveprec){
+                       if (haveprec) {
                                sprintf(cp, "%d", prec);
                        }
                        cp = strchr(cp,0);
@@ -2461,7 +2461,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                case 'E':
                        *cp++ = *fmt;
                        *cp   = 0;
-                       if (Jim_GetDouble(interp, objv[0], &doubleValue) == JIM_ERR){
+                       if (Jim_GetDouble(interp, objv[0], &doubleValue) == JIM_ERR) {
                                Jim_FreeNewObj(interp, resObjPtr);
                                return NULL;
                        }
@@ -2475,7 +2475,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                case 'x':
                case 'X':
                        /* jim widevaluse are 64bit */
-                       if (sizeof(jim_wide) == sizeof(long long)){
+                       if (sizeof(jim_wide) == sizeof(long long)) {
                                *cp++ = 'l'; 
                                *cp++ = 'l';
                        } else {
@@ -2627,12 +2627,12 @@ int Jim_GetNvp(Jim_Interp *interp,
        int e;
 
        e = Jim_Nvp_name2value_obj(interp, nvp_table, objPtr, &n);
-       if (e == JIM_ERR){
+       if (e == JIM_ERR) {
                return e;
        }
 
        /* Success? found? */
-       if (n->name){
+       if (n->name) {
                /* remove const */
                *result = (Jim_Nvp *)n;
                return JIM_OK;
@@ -8894,7 +8894,7 @@ int Jim_Eval_Named(Jim_Interp *interp, const char *script, const char *filename,
     Jim_IncrRefCount(scriptObjPtr);
 
 
-       if (filename){
+       if (filename) {
                JimSetSourceInfo(interp, scriptObjPtr, filename, lineno);
        }
 
@@ -12412,7 +12412,7 @@ int Jim_fprintf(Jim_Interp *interp, void *cookie, const char *fmt, ...)
 
 int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap)
 {
-       if ((interp == NULL) || (interp->cb_vfprintf == NULL)){
+       if ((interp == NULL) || (interp->cb_vfprintf == NULL)) {
                errno = ENOTSUP;
                return -1;
        }
@@ -12421,7 +12421,7 @@ int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap)
 
 size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie)
 {
-       if ((interp == NULL) || (interp->cb_fwrite == NULL)){
+       if ((interp == NULL) || (interp->cb_fwrite == NULL)) {
                errno = ENOTSUP;
                return 0;
        }
@@ -12430,7 +12430,7 @@ size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, vo
 
 size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie)
 {
-       if ((interp == NULL) || (interp->cb_fread == NULL)){
+       if ((interp == NULL) || (interp->cb_fread == NULL)) {
                errno = ENOTSUP;
                return 0;
        }
@@ -12439,7 +12439,7 @@ size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *coo
 
 int Jim_fflush(Jim_Interp *interp, void *cookie)
 {
-       if ((interp == NULL) || (interp->cb_fflush == NULL)){
+       if ((interp == NULL) || (interp->cb_fflush == NULL)) {
                /* pretend all is well */
                return 0;
        }
@@ -12448,7 +12448,7 @@ int Jim_fflush(Jim_Interp *interp, void *cookie)
 
 char* Jim_fgets(Jim_Interp *interp, char *s, int size, void *cookie)
 {
-       if ((interp == NULL) || (interp->cb_fgets == NULL)){
+       if ((interp == NULL) || (interp->cb_fgets == NULL)) {
                errno = ENOTSUP;
                return NULL;
        }
@@ -12457,8 +12457,8 @@ 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){
-               if (0 == strcmp(name, p->name)){
+       while (p->name) {
+               if (0 == strcmp(name, p->name)) {
                        break;
                }
                p++;
@@ -12469,8 +12469,8 @@ 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){
-               if (0 == strcasecmp(name, p->name)){
+       while (p->name) {
+               if (0 == strcasecmp(name, p->name)) {
                        break;
                }
                p++;
@@ -12499,12 +12499,12 @@ Jim_Nvp_name2value(Jim_Interp *interp,
        p = Jim_Nvp_name2value_simple(_p, name);
 
        /* result */
-       if (result){
+       if (result) {
                *result = (Jim_Nvp *)(p);
        }
        
        /* found? */
-       if (p->name){
+       if (p->name) {
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -12524,11 +12524,11 @@ Jim_Nvp_name2value_nocase(Jim_Interp *interp, const Jim_Nvp *_p, const char *nam
 
        p = Jim_Nvp_name2value_nocase_simple(_p, name);
 
-       if (puthere){
+       if (puthere) {
                *puthere = (Jim_Nvp *)(p);
        }
        /* found */
-       if (p->name){
+       if (p->name) {
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -12543,7 +12543,7 @@ Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp
        jim_wide w;
 
        e = Jim_GetWide(interp, o, &w);
-       if (e != JIM_OK){
+       if (e != JIM_OK) {
                return e;
        }
 
@@ -12553,8 +12553,8 @@ Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp
 Jim_Nvp *
 Jim_Nvp_value2name_simple(const Jim_Nvp *p, int value)
 {
-       while (p->name){
-               if (value == p->value){
+       while (p->name) {
+               if (value == p->value) {
                        break;
                }
                p++;
@@ -12570,11 +12570,11 @@ Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **r
 
        p = Jim_Nvp_value2name_simple(_p, value);
 
-       if (result){
+       if (result) {
                *result = (Jim_Nvp *)(p);
        }
 
-       if (p->name){
+       if (p->name) {
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -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, 
@@ -12615,16 +12615,16 @@ Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere)
        Jim_Obj *o;
        
        o = NULL; // failure 
-       if (goi->argc){
+       if (goi->argc) {
                // success 
                o = goi->argv[0];
                goi->argc -= 1;
                goi->argv += 1;
        }
-       if (puthere){
+       if (puthere) {
                *puthere = o;
        }
-       if (o != NULL){
+       if (o != NULL) {
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -12640,9 +12640,9 @@ Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len)
 
 
        r = Jim_GetOpt_Obj(goi, &o);
-       if (r == JIM_OK){
+       if (r == JIM_OK) {
                cp = Jim_GetString(o, len);
-               if (puthere){
+               if (puthere) {
                        /* remove const */
                        *puthere = (char *)(cp);
                }
@@ -12657,14 +12657,14 @@ Jim_GetOpt_Double(Jim_GetOptInfo *goi, double *puthere)
        Jim_Obj *o;
        double _safe;
        
-       if (puthere == NULL){
+       if (puthere == NULL) {
                puthere = &_safe;
        }
 
        r = Jim_GetOpt_Obj(goi, &o);
-       if (r == JIM_OK){
+       if (r == JIM_OK) {
                r = Jim_GetDouble(goi->interp, o, puthere);
-               if (r != JIM_OK){
+               if (r != JIM_OK) {
                        Jim_SetResult_sprintf(goi->interp,
                                                                   "not a number: %s", 
                                                                   Jim_GetString(o, NULL));
@@ -12680,12 +12680,12 @@ Jim_GetOpt_Wide(Jim_GetOptInfo *goi, jim_wide *puthere)
        Jim_Obj *o;
        jim_wide _safe;
 
-       if (puthere == NULL){
+       if (puthere == NULL) {
                puthere = &_safe;
        }
 
        r = Jim_GetOpt_Obj(goi, &o);
-       if (r == JIM_OK){
+       if (r == JIM_OK) {
                r = Jim_GetWide(goi->interp, o, puthere);
        }
        return r;
@@ -12699,12 +12699,12 @@ int Jim_GetOpt_Nvp(Jim_GetOptInfo *goi,
        Jim_Obj *o;
        int e;
 
-       if (puthere == NULL){
+       if (puthere == NULL) {
                puthere = &_safe;
        }
 
        e = Jim_GetOpt_Obj(goi, &o);
-       if (e == JIM_OK){
+       if (e == JIM_OK) {
                e = Jim_Nvp_name2value_obj(goi->interp,
                                                                        nvp, 
                                                                        o,
@@ -12719,7 +12719,7 @@ Jim_GetOpt_NvpUnknown(Jim_GetOptInfo *goi,
                                           const Jim_Nvp *nvptable,
                                           int hadprefix)
 {
-       if (hadprefix){
+       if (hadprefix) {
                Jim_SetResult_NvpUnknown(goi->interp,
                                                                  goi->argv[-2],
                                                                  goi->argv[-1],
@@ -12742,11 +12742,11 @@ Jim_GetOpt_Enum(Jim_GetOptInfo *goi,
        Jim_Obj *o;
        int e;
 
-       if (puthere == NULL){
+       if (puthere == NULL) {
                puthere = &_safe;
        }
        e = Jim_GetOpt_Obj(goi, &o);
-       if (e == JIM_OK){
+       if (e == JIM_OK) {
                e = Jim_GetEnum(goi->interp,
                                                 o,
                                                 lookup,
@@ -12768,7 +12768,7 @@ Jim_SetResult_sprintf(Jim_Interp *interp, const char *fmt,...)
        va_start(ap,fmt);
        buf = jim_vasprintf(fmt, ap);
        va_end(ap);
-       if (buf){
+       if (buf) {
                Jim_SetResultString(interp, buf, -1);
                jim_vasprintf_done(buf);
        }
@@ -12782,7 +12782,7 @@ Jim_SetResult_NvpUnknown(Jim_Interp *interp,
                                                  Jim_Obj *param_value,
                                                  const Jim_Nvp *nvp)
 {
-       if (param_name){
+       if (param_name) {
                Jim_SetResult_sprintf(interp,
                                                           "%s: Unknown: %s, try one of: ",
                                                           Jim_GetString(param_name, NULL),
@@ -12792,11 +12792,11 @@ 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;
 
-               if ((nvp + 1)->name){
+               if ((nvp + 1)->name) {
                        a = nvp->name;
                        b = ", ";
                } else {
@@ -12818,12 +12818,12 @@ Jim_Debug_ArgvString(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
        int x;
 
-       if (debug_string_obj){
+       if (debug_string_obj) {
                Jim_FreeObj(interp, debug_string_obj);
        }
 
        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),
index 57c1e4d7531adcac0ab047119c992a53c1c7008f..2b96c9813c435e457286c2dfc4c5ed556b5f7f54 100644 (file)
@@ -985,19 +985,19 @@ 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){
+ *         if (e != JIM_OK) {
  *               Jim_GetOpt_NvpUnknown(&goi, nvp_options, 0);
  *               return e;
  *         }
  *
- *         switch (n->value){
+ *         switch (n->value) {
  *         case ALIVE:
  *             printf("Option ALIVE specified\n");
  *             break;
  *         case FIRST:
- *             if (goi.argc < 1){
+ *             if (goi.argc < 1) {
  *                     .. not enough args error ..
  *             }
  *             Jim_GetOpt_String(&goi, &cp, NULL);
@@ -1008,7 +1008,7 @@ typedef struct jim_getopt {
  *             break;
  *         case POLITICS:
  *             e = Jim_GetOpt_Nvp(&goi, nvp_politics, &n);
- *             if (e != JIM_OK){
+ *             if (e != JIM_OK) {
  *                 Jim_GetOpt_NvpUnknown(&goi, nvp_politics, 1);
  *                 return e;
  *             }
@@ -1102,21 +1102,21 @@ JIM_STATIC int JIM_API(Jim_GetOpt_Nvp)(Jim_GetOptInfo *goi, const Jim_Nvp *looku
  * Example:
  * \code
  *
- *  while (goi.argc){
+ *  while (goi.argc) {
  *     // Get the next option 
  *     e = Jim_GetOpt_Nvp(&goi, cmd_options, &n);
- *     if (e != JIM_OK){
+ *     if (e != JIM_OK) {
  *          // option was not recognized
  *          // pass 'hadprefix = 0' because there is no prefix
  *          Jim_GetOpt_NvpUnknown(&goi, cmd_options, 0);
  *          return e;
  *     }
  *
- *     switch (n->value){
+ *     switch (n->value) {
  *     case OPT_SEX:
  *          // handle:  --sex male | female | lots | needmore
  *          e = Jim_GetOpt_Nvp(&goi, &nvp_sex, &n);
- *          if (e != JIM_OK){
+ *          if (e != JIM_OK) {
  *               Jim_GetOpt_NvpUnknown(&ogi, nvp_sex, 1);
  *               return e;
  *          }
index 330eb78346ccd234333c8b7ed4ce3c9cb18f701e..b13b48809f421a7a752c7a664690c03d24375160 100644 (file)
@@ -704,7 +704,7 @@ int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value, uint8_t *
        else
                compare_failed = buf_cmp(captured, in_check_value, num_bits);
 
-       if (compare_failed){
+       if (compare_failed) {
                /* An error handler could have caught the failing check
                 * only report a problem when there wasn't a handler, or if the handler
                 * acknowledged the error
@@ -1024,9 +1024,9 @@ int jtag_validate_chain(void)
 
        tap = NULL;
        total_ir_length = 0;
-       for (;;){
+       for (;;) {
                tap = jtag_tap_next_enabled(tap);
-               if (tap == NULL){
+               if (tap == NULL) {
                        break;
                }
                total_ir_length += tap->ir_length;
@@ -1048,9 +1048,9 @@ int jtag_validate_chain(void)
        tap = NULL;
        chain_pos = 0;
        int val;
-       for (;;){
+       for (;;) {
                tap = jtag_tap_next_enabled(tap);
-               if (tap == NULL){
+               if (tap == NULL) {
                        break;
                }
 
@@ -1151,7 +1151,7 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx)
        LOG_DEBUG("Init JTAG chain");
 
        tap = jtag_tap_next_enabled(NULL);
-       if (tap == NULL){
+       if (tap == NULL) {
                LOG_ERROR("There are no enabled taps?");
                return ERROR_JTAG_INIT_FAILED;
        }
index b78ffdeca7d4d41a31a14cd87993f3e04e0faed5..1511dfebf28674047a80e26dcfec019a63d59160 100644 (file)
@@ -359,9 +359,9 @@ tap_state_t tap_state_by_name(const char *name)
 {
        tap_state_t x;
 
-       for (x = 0 ; x < TAP_NUM_STATES ; x++){
+       for (x = 0 ; x < TAP_NUM_STATES ; x++) {
                /* be nice to the human */
-               if (0 == strcasecmp(name, tap_state_name(x))){
+               if (0 == strcasecmp(name, tap_state_name(x))) {
                        return x;
                }
        }
index aad6781118cba2fbd32a2fc2113771a8f8705ce1..2ea3868dc015261edc3f57c3c22a80a334037785 100644 (file)
@@ -340,7 +340,7 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
        /*
         * we expect CHIP + TAP + OPTIONS
         * */
-       if (goi->argc < 3){
+       if (goi->argc < 3) {
                Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ....");
                return JIM_ERR;
        }
@@ -367,14 +367,14 @@ 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){
+               if (e != JIM_OK) {
                        Jim_GetOpt_NvpUnknown(goi, opts, 0);
                        return e;
                }
                LOG_DEBUG("Processing option: %s", n->name);
-               switch (n->value){
+               switch (n->value) {
                case NTAP_OPT_ENABLED:
                        pTap->disabled_after_reset = false;
                        break;
@@ -410,11 +410,11 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
                case NTAP_OPT_IRMASK:
                case NTAP_OPT_IRCAPTURE:
                        e = Jim_GetOpt_Wide(goi, &w);
-                       if (e != JIM_OK){
+                       if (e != JIM_OK) {
                                Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name);
                                return e;
                        }
-                       switch (n->value){
+                       switch (n->value) {
                        case NTAP_OPT_IRLEN:
                                if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value)))
                                        LOG_WARNING("huge IR length %d", (int) w);
@@ -535,29 +535,29 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
 
        e = Jim_GetOpt_Nvp(&goi, jtag_cmds, &n);
-       if (e != JIM_OK){
+       if (e != JIM_OK) {
                Jim_GetOpt_NvpUnknown(&goi, jtag_cmds, 0);
                return e;
        }
                Jim_SetEmptyResult(goi.interp);
-       switch (n->value){
+       switch (n->value) {
        case JTAG_CMD_INTERFACE:
                /* return the name of the interface */
                /* TCL code might need to know the exact type... */
                /* FUTURE: we allow this as a means to "set" the interface. */
-               if (goi.argc != 0){
+               if (goi.argc != 0) {
                        Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
                        return JIM_ERR;
                }
                Jim_SetResultString(goi.interp, jtag_interface->name, -1);
                return JIM_OK;
        case JTAG_CMD_INIT_RESET:
-               if (goi.argc != 0){
+               if (goi.argc != 0) {
                        Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
                        return JIM_ERR;
                }
                e = jtag_init_reset(context);
-               if (e != ERROR_OK){
+               if (e != ERROR_OK) {
                        Jim_SetResult_sprintf(goi.interp, "error: %d", e);
                        return JIM_ERR;
                }
@@ -568,7 +568,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        case JTAG_CMD_TAPISENABLED:
        case JTAG_CMD_TAPENABLE:
        case JTAG_CMD_TAPDISABLE:
-               if (goi.argc != 1){
+               if (goi.argc != 1) {
                        Jim_SetResultString(goi.interp, "Too many parameters",-1);
                        return JIM_ERR;
                }
@@ -619,7 +619,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                break;
 
        case JTAG_CMD_CGET:
-               if (goi.argc < 2){
+               if (goi.argc < 2) {
                        Jim_WrongNumArgs(goi.interp, 0, NULL, "?tap-name? -option ...");
                        return JIM_ERR;
                }
@@ -629,7 +629,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
                        Jim_GetOpt_Obj(&goi, &o);
                        t = jtag_tap_by_jim_obj(goi.interp, o);
-                       if (t == NULL){
+                       if (t == NULL) {
                                return JIM_ERR;
                        }
 
@@ -639,7 +639,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                break;
 
        case JTAG_CMD_CONFIGURE:
-               if (goi.argc < 3){
+               if (goi.argc < 3) {
                        Jim_WrongNumArgs(goi.interp, 0, NULL, "?tap-name? -option ?VALUE? ...");
                        return JIM_ERR;
                }
@@ -649,7 +649,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
                        Jim_GetOpt_Obj(&goi, &o);
                        t = jtag_tap_by_jim_obj(goi.interp, o);
-                       if (t == NULL){
+                       if (t == NULL) {
                                return JIM_ERR;
                        }
 
@@ -806,7 +806,7 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
         * argv[ 3] = not actually used by anything but in the docs
         */
 
-       if (argc < 4){
+       if (argc < 4) {
                command_print(cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax");
                return ERROR_OK;
        }
@@ -847,7 +847,7 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
                         Jim_GetString(newargs[9], NULL));
 
        e = jim_jtag_command(interp, 10, newargs);
-       if (e != JIM_OK){
+       if (e != JIM_OK) {
                command_print(cmd_ctx, "%s", Jim_GetString(Jim_GetResult(interp), NULL));
        }
        return e;
@@ -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);
@@ -1174,20 +1174,20 @@ static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, c
         */
        endstate = TAP_IDLE;
 
-       if (argc >= 4){
+       if (argc >= 4) {
                /* have at least one pair of numbers. */
                /* is last pair the magic text? */
-               if (0 == strcmp("-endstate", args[ argc - 2 ])){
+               if (0 == strcmp("-endstate", args[ argc - 2 ])) {
                        const char *cpA;
                        const char *cpS;
                        cpA = args[ argc-1 ];
-                       for (endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++){
+                       for (endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++) {
                                cpS = tap_state_name(endstate);
-                               if (0 == strcmp(cpA, cpS)){
+                               if (0 == strcmp(cpA, cpS)) {
                                        break;
                                }
                        }
-                       if (endstate >= TAP_NUM_STATES){
+                       if (endstate >= TAP_NUM_STATES) {
                                return ERROR_COMMAND_SYNTAX_ERROR;
                        } else {
                                if (!scan_is_safe(endstate))
@@ -1281,12 +1281,12 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
 
                e = Jim_GetLong(interp, args[i], &bits);
                /* If valid - try next arg */
-               if (e == JIM_OK){
+               if (e == JIM_OK) {
                        continue;
                }
 
                /* Not valid.. are we at the end? */
-               if (((i + 2) != argc)){
+               if (((i + 2) != argc)) {
                        /* nope, then error */
                        return e;
                }
@@ -1299,13 +1299,13 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
                /* get arg as a string. */
                cp = Jim_GetString(args[i], NULL);
                /* is it the magic? */
-               if (0 == strcmp("-endstate", cp)){
+               if (0 == strcmp("-endstate", cp)) {
                        /* is the statename valid? */
                        cp = Jim_GetString(args[i + 1], NULL);
 
                        /* see if it is a valid state name */
                        endstate = tap_state_by_name(cp);
-                       if (endstate < 0){
+                       if (endstate < 0) {
                                /* update the error message */
                                Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp);
                        } else {
@@ -1321,13 +1321,13 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
                }
 
                /* Still an error? */
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        return e; /* too bad */
                }
        } /* validate args */
 
        tap = jtag_tap_by_jim_obj(interp, args[1]);
-       if (tap == NULL){
+       if (tap == NULL) {
                return JIM_ERR;
        }
 
index 73d6123762644802bf5e9bc8c75a5c143d5ca2c8..c766805fa86092b6aac38891e834e1f636ebdab2 100644 (file)
@@ -96,7 +96,7 @@ int xilinx_read_bit_file(xilinx_bit_file_t *bit_file, char *filename)
                return ERROR_PLD_FILE_LOAD_FAILED;
        }
 
-       if (input_stat.st_size == 0){
+       if (input_stat.st_size == 0) {
                LOG_ERROR("Empty file %s", filename);
                return ERROR_PLD_FILE_LOAD_FAILED;
        }
index 008971535280fbd24d44212125337305222d7011..f4fe6585a7fd7e9f877e083985928151a9c658f2 100644 (file)
@@ -319,7 +319,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                        break;
                if ((retval = gdb_get_char(connection, &reply)) != ERROR_OK)
                        return retval;
-               if (reply == '$'){
+               if (reply == '$') {
                        /* fix a problem with some IAR tools */
                        gdb_putback_char(connection, reply);
                        LOG_DEBUG("Unexpected start of new packet");
@@ -402,7 +402,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                                log_remove_callback(gdb_log_callback, connection);
                                LOG_WARNING("negative reply, retrying");
                        }
-                       else if (reply == '$'){
+                       else if (reply == '$') {
                                LOG_ERROR("GDB missing ack(1) - assumed good");
                                gdb_putback_char(connection, reply);
                                return ERROR_OK;
@@ -413,7 +413,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                                return ERROR_SERVER_REMOTE_CLOSED;
                        }
                }
-               else if (reply == '$'){
+               else if (reply == '$') {
                        LOG_ERROR("GDB missing ack(2) - assumed good");
                        gdb_putback_char(connection, reply);
                        return ERROR_OK;
@@ -2036,12 +2036,12 @@ int gdb_input_inner(connection_t *connection)
                /* terminate with zero */
                packet[packet_size] = 0;
 
-               if (LOG_LEVEL_IS(LOG_LVL_DEBUG)){
-                       if (packet[0] == 'X'){
+               if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
+                       if (packet[0] == 'X') {
                                // binary packets spew junk into the debug log stream
                                char buf[ 50 ];
                                int x;
-                               for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++){
+                               for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++) {
                                        buf[x] = packet[x];
                                }
                                buf[x] = 0;
index 097d7130c24575e66b67d82f6e9a917f6c6ef61b..67bbcfc137cdbb7ac996f630962acbd1b31e187a 100644 (file)
@@ -144,7 +144,7 @@ const char *target_strerror_safe(int err)
        const Jim_Nvp *n;
 
        n = Jim_Nvp_value2name_simple(nvp_error_target, err);
-       if (n->name == NULL){
+       if (n->name == NULL) {
                return "unknown";
        } else {
                return n->name;
@@ -244,8 +244,8 @@ static int max_target_number(void)
 
        x = -1;
        t = all_targets;
-       while (t){
-               if (x < t->target_number){
+       while (t) {
+               if (x < t->target_number) {
                        x = (t->target_number) + 1;
                }
                t = t->next;
@@ -262,8 +262,8 @@ static int new_target_number(void)
        /* number is 0 based */
        x = -1;
        t = all_targets;
-       while (t){
-               if (x < t->target_number){
+       while (t) {
+               if (x < t->target_number) {
                        x = t->target_number;
                }
                t = t->next;
@@ -352,8 +352,8 @@ static target_t *get_target_by_num(int num)
 {
        target_t *target = all_targets;
 
-       while (target){
-               if (target->target_number == num){
+       while (target) {
+               if (target->target_number == num) {
                        return target;
                }
                target = target->next;
@@ -429,7 +429,7 @@ int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mo
        int retval;
        Jim_Nvp *n;
        n = Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode);
-       if (n->name == NULL){
+       if (n->name == NULL) {
                LOG_ERROR("invalid reset mode");
                return ERROR_FAIL;
        }
@@ -1983,7 +1983,7 @@ static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, ch
        {
                const Jim_Nvp *n;
                n = Jim_Nvp_name2value_simple(nvp_reset_modes, args[0]);
-               if ((n->name == NULL) || (n->value == RESET_UNKNOWN)){
+               if ((n->name == NULL) || (n->value == RESET_UNKNOWN)) {
                        return ERROR_COMMAND_SYNTAX_ERROR;
                }
                reset_mode = n->value;
@@ -3205,12 +3205,12 @@ static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        target_t *target;
 
        context = Jim_GetAssocData(interp, "context");
-       if (context == NULL){
+       if (context == NULL) {
                LOG_ERROR("array2mem: no command context");
                return JIM_ERR;
        }
        target = get_current_target(context);
-       if (target == NULL){
+       if (target == NULL) {
                LOG_ERROR("array2mem: no current target");
                return JIM_ERR;
        }
@@ -3364,7 +3364,7 @@ void target_all_handle_event(enum target_event e)
                           Jim_Nvp_value2name_simple(nvp_target_event, e)->name);
 
        target = all_targets;
-       while (target){
+       while (target) {
                target_handle_event(target, e);
                target = target->next;
        }
@@ -3378,8 +3378,8 @@ void target_handle_event(target_t *target, enum target_event e)
        teap = target->event_action;
 
        done = 0;
-       while (teap){
-               if (teap->event == e){
+       while (teap) {
+               if (teap->event == e) {
                        done = 1;
                        LOG_DEBUG("target: (%d) %s (%s) event: %d (%s) action: %s\n",
                                           target->target_number,
@@ -3395,7 +3395,7 @@ void target_handle_event(target_t *target, enum target_event e)
                }
                teap = teap->next;
        }
-       if (!done){
+       if (!done) {
                LOG_DEBUG("event: %d %s - no action",
                                   e,
                                   Jim_Nvp_value2name_simple(nvp_target_event, e)->name);
@@ -3437,38 +3437,38 @@ 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); */
 
-               if (target->type->target_jim_configure){
+               if (target->type->target_jim_configure) {
                        /* target defines a configure function */
                        /* target gets first dibs on parameters */
                        e = (*(target->type->target_jim_configure))(target, goi);
-                       if (e == JIM_OK){
+                       if (e == JIM_OK) {
                                /* more? */
                                continue;
                        }
-                       if (e == JIM_ERR){
+                       if (e == JIM_ERR) {
                                /* An error */
                                return e;
                        }
                        /* otherwise we 'continue' below */
                }
                e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0);
                        return e;
                }
-               switch (n->value){
+               switch (n->value) {
                case TCFG_TYPE:
                        /* not setable */
-                       if (goi->isconfigure){
+                       if (goi->isconfigure) {
                                Jim_SetResult_sprintf(goi->interp, "not setable: %s", n->name);
                                return JIM_ERR;
                        } else {
                        no_params:
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO PARAMS");
                                        return JIM_ERR;
                                }
@@ -3477,24 +3477,24 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        /* loop for more */
                        break;
                case TCFG_EVENT:
-                       if (goi->argc == 0){
+                       if (goi->argc == 0) {
                                Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ...");
                                return JIM_ERR;
                        }
 
                        e = Jim_GetOpt_Nvp(goi, nvp_target_event, &n);
-                       if (e != JIM_OK){
+                       if (e != JIM_OK) {
                                Jim_GetOpt_NvpUnknown(goi, nvp_target_event, 1);
                                return e;
                        }
 
-                       if (goi->isconfigure){
-                               if (goi->argc != 1){
+                       if (goi->isconfigure) {
+                               if (goi->argc != 1) {
                                        Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
                                        return JIM_ERR;
                                }
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name?");
                                        return JIM_ERR;
                                }
@@ -3505,21 +3505,21 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
 
                                teap = target->event_action;
                                /* replace existing? */
-                               while (teap){
-                                       if (teap->event == (enum target_event)n->value){
+                               while (teap) {
+                                       if (teap->event == (enum target_event)n->value) {
                                                break;
                                        }
                                        teap = teap->next;
                                }
 
-                               if (goi->isconfigure){
-                                       if (teap == NULL){
+                               if (goi->isconfigure) {
+                                       if (teap == NULL) {
                                                /* create new */
                                                teap = calloc(1, sizeof(*teap));
                                        }
                                        teap->event = n->value;
                                        Jim_GetOpt_Obj(goi, &o);
-                                       if (teap->body){
+                                       if (teap->body) {
                                                Jim_DecrRefCount(interp, teap->body);
                                        }
                                        teap->body  = Jim_DuplicateObj(goi->interp, o);
@@ -3541,7 +3541,7 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                                        Jim_SetEmptyResult(goi->interp);
                                } else {
                                        /* get */
-                                       if (teap == NULL){
+                                       if (teap == NULL) {
                                                Jim_SetEmptyResult(goi->interp);
                                        } else {
                                                Jim_SetResult(goi->interp, Jim_DuplicateObj(goi->interp, teap->body));
@@ -3552,15 +3552,15 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        break;
 
                case TCFG_WORK_AREA_VIRT:
-                       if (goi->isconfigure){
+                       if (goi->isconfigure) {
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide(goi, &w);
-                               if (e != JIM_OK){
+                               if (e != JIM_OK) {
                                        return e;
                                }
                                target->working_area_virt = w;
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        goto no_params;
                                }
                        }
@@ -3569,15 +3569,15 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        break;
 
                case TCFG_WORK_AREA_PHYS:
-                       if (goi->isconfigure){
+                       if (goi->isconfigure) {
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide(goi, &w);
-                               if (e != JIM_OK){
+                               if (e != JIM_OK) {
                                        return e;
                                }
                                target->working_area_phys = w;
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        goto no_params;
                                }
                        }
@@ -3586,15 +3586,15 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        break;
 
                case TCFG_WORK_AREA_SIZE:
-                       if (goi->isconfigure){
+                       if (goi->isconfigure) {
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide(goi, &w);
-                               if (e != JIM_OK){
+                               if (e != JIM_OK) {
                                        return e;
                                }
                                target->working_area_size = w;
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        goto no_params;
                                }
                        }
@@ -3603,16 +3603,16 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        break;
 
                case TCFG_WORK_AREA_BACKUP:
-                       if (goi->isconfigure){
+                       if (goi->isconfigure) {
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide(goi, &w);
-                               if (e != JIM_OK){
+                               if (e != JIM_OK) {
                                        return e;
                                }
                                /* make this exactly 1 or 0 */
                                target->backup_working_area = (!!w);
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        goto no_params;
                                }
                        }
@@ -3621,20 +3621,20 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        break;
 
                case TCFG_ENDIAN:
-                       if (goi->isconfigure){
+                       if (goi->isconfigure) {
                                e = Jim_GetOpt_Nvp(goi, nvp_target_endian, &n);
-                               if (e != JIM_OK){
+                               if (e != JIM_OK) {
                                        Jim_GetOpt_NvpUnknown(goi, nvp_target_endian, 1);
                                        return e;
                                }
                                target->endianness = n->value;
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        goto no_params;
                                }
                        }
                        n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness);
-                       if (n->name == NULL){
+                       if (n->name == NULL) {
                                target->endianness = TARGET_LITTLE_ENDIAN;
                                n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness);
                        }
@@ -3643,20 +3643,20 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        break;
 
                case TCFG_VARIANT:
-                       if (goi->isconfigure){
-                               if (goi->argc < 1){
+                       if (goi->isconfigure) {
+                               if (goi->argc < 1) {
                                        Jim_SetResult_sprintf(goi->interp,
                                                                                   "%s ?STRING?",
                                                                                   n->name);
                                        return JIM_ERR;
                                }
-                               if (target->variant){
+                               if (target->variant) {
                                        free((void *)(target->variant));
                                }
                                e = Jim_GetOpt_String(goi, &cp, NULL);
                                target->variant = strdup(cp);
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        goto no_params;
                                }
                        }
@@ -3664,22 +3664,22 @@ static int target_configure(Jim_GetOptInfo *goi, target_t *target)
                        /* loop for more */
                        break;
                case TCFG_CHAIN_POSITION:
-                       if (goi->isconfigure){
+                       if (goi->isconfigure) {
                                Jim_Obj *o;
                                jtag_tap_t *tap;
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Obj(goi, &o);
-                               if (e != JIM_OK){
+                               if (e != JIM_OK) {
                                        return e;
                                }
                                tap = jtag_tap_by_jim_obj(goi->interp, o);
-                               if (tap == NULL){
+                               if (tap == NULL) {
                                        return JIM_ERR;
                                }
                                /* make this exactly 1 or 0 */
                                target->tap = tap;
                        } else {
-                               if (goi->argc != 0){
+                               if (goi->argc != 0) {
                                        goto no_params;
                                }
                        }
@@ -3756,16 +3756,16 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
        /* commands here are in an NVP table */
        e = Jim_GetOpt_Nvp(&goi, target_options, &n);
-       if (e != JIM_OK){
+       if (e != JIM_OK) {
                Jim_GetOpt_NvpUnknown(&goi, target_options, 0);
                return e;
        }
        /* Assume blank result */
        Jim_SetEmptyResult(goi.interp);
 
-       switch (n->value){
+       switch (n->value) {
        case TS_CMD_CONFIGURE:
-               if (goi.argc < 2){
+               if (goi.argc < 2) {
                        Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, "missing: -option VALUE ...");
                        return JIM_ERR;
                }
@@ -3773,7 +3773,7 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                return target_configure(&goi, target);
        case TS_CMD_CGET:
                // some things take params
-               if (goi.argc < 1){
+               if (goi.argc < 1) {
                        Jim_WrongNumArgs(goi.interp, 0, goi.argv, "missing: ?-option?");
                        return JIM_ERR;
                }
@@ -3789,7 +3789,7 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                 * argv[3] = optional count.
                 */
 
-               if ((goi.argc == 2) || (goi.argc == 3)){
+               if ((goi.argc == 2) || (goi.argc == 3)) {
                        /* all is well */
                } else {
                mwx_error:
@@ -3798,24 +3798,24 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                }
 
                e = Jim_GetOpt_Wide(&goi, &a);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        goto mwx_error;
                }
 
                e = Jim_GetOpt_Wide(&goi, &b);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        goto mwx_error;
                }
                if (goi.argc == 3) {
                        e = Jim_GetOpt_Wide(&goi, &c);
-                       if (e != JIM_OK){
+                       if (e != JIM_OK) {
                                goto mwx_error;
                        }
                } else {
                        c = 1;
                }
 
-               switch (n->value){
+               switch (n->value) {
                case TS_CMD_MWW:
                        target_buffer_set_u32(target, target_buf, b);
                        b = 4;
@@ -3829,9 +3829,9 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                        b = 1;
                        break;
                }
-               for (x = 0 ; x < c ; x++){
+               for (x = 0 ; x < c ; x++) {
                        e = target_write_memory(target, a, b, 1, target_buf);
-                       if (e != ERROR_OK){
+                       if (e != ERROR_OK) {
                                Jim_SetResult_sprintf(interp, "Error writing @ 0x%08x: %d\n", (int)(a), e);
                                return JIM_ERR;
                        }
@@ -3849,24 +3849,24 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                 * argv[1] = address
                 * argv[2] = optional count
                 */
-               if ((goi.argc == 2) || (goi.argc == 3)){
+               if ((goi.argc == 2) || (goi.argc == 3)) {
                        Jim_SetResult_sprintf(goi.interp, "expected: %s ADDR [COUNT]", n->name);
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Wide(&goi, &a);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        return JIM_ERR;
                }
-               if (goi.argc){
+               if (goi.argc) {
                        e = Jim_GetOpt_Wide(&goi, &c);
-                       if (e != JIM_OK){
+                       if (e != JIM_OK) {
                                return JIM_ERR;
                        }
                } else {
                        c = 1;
                }
                b = 1; /* shut up gcc */
-               switch (n->value){
+               switch (n->value) {
                case TS_CMD_MDW:
                        b =  4;
                        break;
@@ -3881,52 +3881,52 @@ 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){
+                       if (y > 16) {
                                y = 16;
                        }
                        e = target_read_memory(target, a, b, y / b, target_buf);
-                       if (e != ERROR_OK){
+                       if (e != ERROR_OK) {
                                Jim_SetResult_sprintf(interp, "error reading target @ 0x%08lx", (int)(a));
                                return JIM_ERR;
                        }
 
                        Jim_fprintf(interp, interp->cookie_stdout, "0x%08x ", (int)(a));
-                       switch (b){
+                       switch (b) {
                        case 4:
-                               for (x = 0 ; (x < 16) && (x < y) ; x += 4){
+                               for (x = 0 ; (x < 16) && (x < y) ; x += 4) {
                                        z = target_buffer_get_u32(target, &(target_buf[ x * 4 ]));
                                        Jim_fprintf(interp, interp->cookie_stdout, "%08x ", (int)(z));
                                }
-                               for (; (x < 16) ; x += 4){
+                               for (; (x < 16) ; x += 4) {
                                        Jim_fprintf(interp, interp->cookie_stdout, "         ");
                                }
                                break;
                        case 2:
-                               for (x = 0 ; (x < 16) && (x < y) ; x += 2){
+                               for (x = 0 ; (x < 16) && (x < y) ; x += 2) {
                                        z = target_buffer_get_u16(target, &(target_buf[ x * 2 ]));
                                        Jim_fprintf(interp, interp->cookie_stdout, "%04x ", (int)(z));
                                }
-                               for (; (x < 16) ; x += 2){
+                               for (; (x < 16) ; x += 2) {
                                        Jim_fprintf(interp, interp->cookie_stdout, "     ");
                                }
                                break;
                        case 1:
                        default:
-                               for (x = 0 ; (x < 16) && (x < y) ; x += 1){
+                               for (x = 0 ; (x < 16) && (x < y) ; x += 1) {
                                        z = target_buffer_get_u8(target, &(target_buf[ x * 4 ]));
                                        Jim_fprintf(interp, interp->cookie_stdout, "%02x ", (int)(z));
                                }
-                               for (; (x < 16) ; x += 1){
+                               for (; (x < 16) ; x += 1) {
                                        Jim_fprintf(interp, interp->cookie_stdout, "   ");
                                }
                                break;
                        }
                        /* ascii-ify the bytes */
-                       for (x = 0 ; x < y ; x++){
+                       for (x = 0 ; x < y ; x++) {
                                if ((target_buf[x] >= 0x20) &&
-                                       (target_buf[x] <= 0x7e)){
+                                       (target_buf[x] <= 0x7e)) {
                                        /* good */
                                } else {
                                        /* smack it */
@@ -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++;
                        }
@@ -3954,31 +3954,31 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                return target_array2mem(goi.interp, target, goi.argc, goi.argv);
                break;
        case TS_CMD_EXAMINE:
-               if (goi.argc){
+               if (goi.argc) {
                        Jim_WrongNumArgs(goi.interp, 2, argv, "[no parameters]");
                        return JIM_ERR;
                }
                if (!target->tap->enabled)
                        goto err_tap_disabled;
                e = target->type->examine(target);
-               if (e != ERROR_OK){
+               if (e != ERROR_OK) {
                        Jim_SetResult_sprintf(interp, "examine-fails: %d", e);
                        return JIM_ERR;
                }
                return JIM_OK;
        case TS_CMD_POLL:
-               if (goi.argc){
+               if (goi.argc) {
                        Jim_WrongNumArgs(goi.interp, 2, argv, "[no parameters]");
                        return JIM_ERR;
                }
                if (!target->tap->enabled)
                        goto err_tap_disabled;
-               if (!(target_was_examined(target))){
+               if (!(target_was_examined(target))) {
                        e = ERROR_TARGET_NOT_EXAMINED;
                } else {
                        e = target->type->poll(target);
                }
-               if (e != ERROR_OK){
+               if (e != ERROR_OK) {
                        Jim_SetResult_sprintf(interp, "poll-fails: %d", e);
                        return JIM_ERR;
                } else {
@@ -3986,18 +3986,18 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                }
                break;
        case TS_CMD_RESET:
-               if (goi.argc != 2){
+               if (goi.argc != 2) {
                        Jim_WrongNumArgs(interp, 2, argv, "t | f|assert | deassert BOOL");
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Nvp(&goi, nvp_assert, &n);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        Jim_GetOpt_NvpUnknown(&goi, nvp_assert, 1);
                        return e;
                }
                /* the halt or not param */
                e = Jim_GetOpt_Wide(&goi, &a);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        return e;
                }
                if (!target->tap->enabled)
@@ -4008,14 +4008,14 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                target_free_all_working_areas_restore(target, 0);
 
                /* do the assert */
-               if (n->value == NVP_ASSERT){
+               if (n->value == NVP_ASSERT) {
                        target->type->assert_reset(target);
                } else {
                        target->type->deassert_reset(target);
                }
                return JIM_OK;
        case TS_CMD_HALT:
-               if (goi.argc){
+               if (goi.argc) {
                        Jim_WrongNumArgs(goi.interp, 0, argv, "halt [no parameters]");
                        return JIM_ERR;
                }
@@ -4025,23 +4025,23 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                return JIM_OK;
        case TS_CMD_WAITSTATE:
                /* params:  <name>  statename timeoutmsecs */
-               if (goi.argc != 2){
+               if (goi.argc != 2) {
                        Jim_SetResult_sprintf(goi.interp, "%s STATENAME TIMEOUTMSECS", n->name);
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Nvp(&goi, nvp_target_state, &n);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        Jim_GetOpt_NvpUnknown(&goi, nvp_target_state,1);
                        return e;
                }
                e = Jim_GetOpt_Wide(&goi, &a);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        return e;
                }
                if (!target->tap->enabled)
                        goto err_tap_disabled;
                e = target_wait_state(target, n->value, a);
-               if (e != ERROR_OK){
+               if (e != ERROR_OK) {
                        Jim_SetResult_sprintf(goi.interp,
                                                                   "target: %s wait %s fails (%d) %s",
                                                                   target->cmd_name,
@@ -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,
@@ -4074,7 +4074,7 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                        return JIM_OK;
                }
        case TS_CMD_CURSTATE:
-               if (goi.argc != 0){
+               if (goi.argc != 0) {
                        Jim_WrongNumArgs(goi.interp, 0, argv, "[no parameters]");
                        return JIM_ERR;
                }
@@ -4082,12 +4082,12 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                                                         Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name,-1);
                return JIM_OK;
        case TS_CMD_INVOKE_EVENT:
-               if (goi.argc != 1){
+               if (goi.argc != 1) {
                        Jim_SetResult_sprintf(goi.interp, "%s ?EVENTNAME?",n->name);
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Nvp(&goi, nvp_target_event, &n);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        Jim_GetOpt_NvpUnknown(&goi, nvp_target_event, 1);
                        return e;
                }
@@ -4113,7 +4113,7 @@ static int target_create(Jim_GetOptInfo *goi)
        struct command_context_s *cmd_ctx;
 
        cmd_ctx = Jim_GetAssocData(goi->interp, "context");
-       if (goi->argc < 3){
+       if (goi->argc < 3) {
                Jim_WrongNumArgs(goi->interp, 1, goi->argv, "?name? ?type? ..options...");
                return JIM_ERR;
        }
@@ -4122,7 +4122,7 @@ static int target_create(Jim_GetOptInfo *goi)
        Jim_GetOpt_Obj(goi, &new_cmd);
        /* does this command exist? */
        cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
-       if (cmd){
+       if (cmd) {
                cp = Jim_GetString(new_cmd, NULL);
                Jim_SetResult_sprintf(goi->interp, "Command/target: %s Exists", cp);
                return JIM_ERR;
@@ -4132,16 +4132,16 @@ static int target_create(Jim_GetOptInfo *goi)
        e = Jim_GetOpt_String(goi, &cp2, NULL);
        cp = cp2;
        /* now does target type exist */
-       for (x = 0 ; target_types[x] ; x++){
-               if (0 == strcmp(cp, target_types[x]->name)){
+       for (x = 0 ; target_types[x] ; x++) {
+               if (0 == strcmp(cp, target_types[x]->name)) {
                        /* found */
                        break;
                }
        }
-       if (target_types[x] == NULL){
+       if (target_types[x] == NULL) {
                Jim_SetResult_sprintf(goi->interp, "Unknown target type %s, try one of ", cp);
-               for (x = 0 ; target_types[x] ; x++){
-                       if (target_types[x + 1]){
+               for (x = 0 ; target_types[x] ; x++) {
+                       if (target_types[x + 1]) {
                                Jim_AppendStrings(goi->interp,
                                                                   Jim_GetResult(goi->interp),
                                                                   target_types[x]->name,
@@ -4209,13 +4209,13 @@ static int target_create(Jim_GetOptInfo *goi)
                e = JIM_ERR;
        }
 
-       if (e != JIM_OK){
+       if (e != JIM_OK) {
                free(target->type);
                free(target);
                return e;
        }
 
-       if (target->endianness == TARGET_ENDIAN_UNKNOWN){
+       if (target->endianness == TARGET_ENDIAN_UNKNOWN) {
                /* default endian to little if not specified */
                target->endianness = TARGET_LITTLE_ENDIAN;
        }
@@ -4225,10 +4225,10 @@ static int target_create(Jim_GetOptInfo *goi)
                target->variant = strdup("");
 
        /* create the target specific commands */
-       if (target->type->register_commands){
+       if (target->type->register_commands) {
                (*(target->type->register_commands))(cmd_ctx);
        }
-       if (target->type->target_create){
+       if (target->type->target_create) {
                (*(target->type->target_create))(target, goi->interp);
        }
 
@@ -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;
@@ -4285,48 +4285,48 @@ static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
        Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
 
-       if (goi.argc == 0){
+       if (goi.argc == 0) {
                Jim_WrongNumArgs(interp, 1, argv, "missing: command ...");
                return JIM_ERR;
        }
 
        /* Jim_GetOpt_Debug(&goi); */
        r = Jim_GetOpt_Enum(&goi, target_cmds, &x);
-       if (r != JIM_OK){
+       if (r != JIM_OK) {
                return r;
        }
 
-       switch (x){
+       switch (x) {
        default:
                Jim_Panic(goi.interp,"Why am I here?");
                return JIM_ERR;
        case TG_CMD_CURRENT:
-               if (goi.argc != 0){
+               if (goi.argc != 0) {
                        Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
                        return JIM_ERR;
                }
                Jim_SetResultString(goi.interp, get_current_target(cmd_ctx)->cmd_name, -1);
                return JIM_OK;
        case TG_CMD_TYPES:
-               if (goi.argc != 0){
+               if (goi.argc != 0) {
                        Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
                        return JIM_ERR;
                }
                Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0));
-               for (x = 0 ; target_types[x] ; x++){
+               for (x = 0 ; target_types[x] ; x++) {
                        Jim_ListAppendElement(goi.interp,
                                                                   Jim_GetResult(goi.interp),
                                                                   Jim_NewStringObj(goi.interp, target_types[x]->name, -1));
                }
                return JIM_OK;
        case TG_CMD_NAMES:
-               if (goi.argc != 0){
+               if (goi.argc != 0) {
                        Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
                        return JIM_ERR;
                }
                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));
@@ -4334,25 +4334,25 @@ static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                }
                return JIM_OK;
        case TG_CMD_CREATE:
-               if (goi.argc < 3){
+               if (goi.argc < 3) {
                        Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, "?name  ... config options ...");
                        return JIM_ERR;
                }
                return target_create(&goi);
                break;
        case TG_CMD_NUMBER:
-               if (goi.argc != 1){
+               if (goi.argc != 1) {
                        Jim_SetResult_sprintf(goi.interp, "expected: target number ?NUMBER?");
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Wide(&goi, &w);
-               if (e != JIM_OK){
+               if (e != JIM_OK) {
                        return JIM_ERR;
                }
                {
                        target_t *t;
                        t = get_target_by_num(w);
-                       if (t == NULL){
+                       if (t == NULL) {
                                Jim_SetResult_sprintf(goi.interp,"Target: number %d does not exist", (int)(w));
                                return JIM_ERR;
                        }
@@ -4360,7 +4360,7 @@ static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                        return JIM_OK;
                }
        case TG_CMD_COUNT:
-               if (goi.argc != 0){
+               if (goi.argc != 0) {
                        Jim_WrongNumArgs(goi.interp, 0, goi.argv, "<no parameters>");
                        return JIM_ERR;
                }