target: avoid using interp global variable
authorZachary T Welch <zw@superlucidity.net>
Mon, 30 Nov 2009 02:21:59 +0000 (18:21 -0800)
committerZachary T Welch <zw@superlucidity.net>
Tue, 1 Dec 2009 00:29:34 +0000 (16:29 -0800)
Adds 'interp' to target_event_action structure to avoid using the
global variable of the same name.

src/target/target.c
src/target/target.h

index 3a84040c3bbd629c4be47f55d7b7490aa738cdb5..4297258246ec0fb103746b96be6c8ff938073b9c 100644 (file)
@@ -3524,9 +3524,9 @@ void target_handle_event(struct target *target, enum target_event e)
                                           e,
                                           Jim_Nvp_value2name_simple(nvp_target_event, e)->name,
                                           Jim_GetString(teap->body, NULL));
-                       if (Jim_EvalObj(interp, teap->body) != JIM_OK)
+                       if (Jim_EvalObj(teap->interp, teap->body) != JIM_OK)
                        {
-                               Jim_PrintErrorMessage(interp);
+                               Jim_PrintErrorMessage(teap->interp);
                        }
                }
        }
@@ -3668,9 +3668,10 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                                                replace = false;
                                        }
                                        teap->event = n->value;
+                                       teap->interp = goi->interp;
                                        Jim_GetOpt_Obj(goi, &o);
                                        if (teap->body) {
-                                               Jim_DecrRefCount(interp, teap->body);
+                                               Jim_DecrRefCount(teap->interp, teap->body);
                                        }
                                        teap->body  = Jim_DuplicateObj(goi->interp, o);
                                        /*
@@ -3718,7 +3719,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                                        goto no_params;
                                }
                        }
-                       Jim_SetResult(interp, Jim_NewIntObj(goi->interp, target->working_area_virt));
+                       Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->working_area_virt));
                        /* loop for more */
                        break;
 
@@ -3736,7 +3737,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                                        goto no_params;
                                }
                        }
-                       Jim_SetResult(interp, Jim_NewIntObj(goi->interp, target->working_area_phys));
+                       Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->working_area_phys));
                        /* loop for more */
                        break;
 
@@ -3753,7 +3754,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                                        goto no_params;
                                }
                        }
-                       Jim_SetResult(interp, Jim_NewIntObj(goi->interp, target->working_area_size));
+                       Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->working_area_size));
                        /* loop for more */
                        break;
 
@@ -3771,7 +3772,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                                        goto no_params;
                                }
                        }
-                       Jim_SetResult(interp, Jim_NewIntObj(goi->interp, target->backup_working_area));
+                       Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->backup_working_area));
                        /* loop for more e*/
                        break;
 
@@ -3838,7 +3839,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                                        goto no_params;
                                }
                        }
-                       Jim_SetResultString(interp, target->tap->dotted_name, -1);
+                       Jim_SetResultString(goi->interp, target->tap->dotted_name, -1);
                        /* loop for more e*/
                        break;
                }
@@ -4486,7 +4487,7 @@ static int target_create(Jim_GetOptInfo *goi)
 
        if (target->tap == NULL)
        {
-               Jim_SetResultString(interp, "-chain-position required when creating target", -1);
+               Jim_SetResultString(goi->interp, "-chain-position required when creating target", -1);
                e = JIM_ERR;
        }
 
index 009ec17b0d74a89f85f952d0e11ab250a81467e9..af4727ce4046a056dc4d43cd6c5a12326401ffd8 100644 (file)
@@ -222,6 +222,7 @@ enum target_event
 
 struct target_event_action {
        enum target_event event;
+       Jim_Interp *interp;
        struct Jim_Obj *body;
        int has_percent;
        struct target_event_action *next;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)