Browse Source

jim-nvp: Make Jim_GetOpt_String const-correct

Change-Id: Iae9824f6ff47a1944e674e59bfaa970904645082
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/3178
Tested-by: jenkins
tags/v0.10.0-rc1
Andreas Fritiofson 8 years ago
parent
commit
7c957b601f
8 changed files with 25 additions and 22 deletions
  1. +2
    -3
      src/helper/jim-nvp.c
  2. +1
    -1
      src/helper/jim-nvp.h
  3. +6
    -4
      src/jtag/aice/aice_transport.c
  4. +6
    -4
      src/jtag/hla/hla_tcl.c
  5. +6
    -4
      src/jtag/tcl.c
  6. +1
    -1
      src/rtos/rtos.c
  7. +2
    -2
      src/target/nds32_cmd.c
  8. +1
    -3
      src/target/target.c

+ 2
- 3
src/helper/jim-nvp.c View File

@@ -205,7 +205,7 @@ int Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere)
return JIM_ERR;
}

int Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len)
int Jim_GetOpt_String(Jim_GetOptInfo *goi, const char **puthere, int *len)
{
int r;
Jim_Obj *o;
@@ -215,8 +215,7 @@ int Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len)
if (r == JIM_OK) {
cp = Jim_GetString(o, len);
if (puthere) {
/* remove const */
*puthere = (char *)(cp);
*puthere = cp;
}
}
return r;


+ 1
- 1
src/helper/jim-nvp.h View File

@@ -245,7 +245,7 @@ int Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere);
* \param puthere - where param is put
* \param len - return its length
*/
int Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len);
int Jim_GetOpt_String(Jim_GetOptInfo *goi, const char **puthere, int *len);

/** Remove argv[0] as double.
*


+ 6
- 4
src/jtag/aice/aice_transport.c View File

@@ -90,11 +90,13 @@ static int jim_aice_newtap_cmd(Jim_GetOptInfo *goi)
free(pTap);
return JIM_ERR;
}
Jim_GetOpt_String(goi, &cp, NULL);
pTap->chip = strdup(cp);

Jim_GetOpt_String(goi, &cp, NULL);
pTap->tapname = strdup(cp);
const char *tmp;
Jim_GetOpt_String(goi, &tmp, NULL);
pTap->chip = strdup(tmp);

Jim_GetOpt_String(goi, &tmp, NULL);
pTap->tapname = strdup(tmp);

/* name + dot + name + null */
x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1;


+ 6
- 4
src/jtag/hla/hla_tcl.c View File

@@ -100,11 +100,13 @@ static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi)
free(pTap);
return JIM_ERR;
}
Jim_GetOpt_String(goi, &cp, NULL);
pTap->chip = strdup(cp);

Jim_GetOpt_String(goi, &cp, NULL);
pTap->tapname = strdup(cp);
const char *tmp;
Jim_GetOpt_String(goi, &tmp, NULL);
pTap->chip = strdup(tmp);

Jim_GetOpt_String(goi, &tmp, NULL);
pTap->tapname = strdup(tmp);

/* name + dot + name + null */
x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1;


+ 6
- 4
src/jtag/tcl.c View File

@@ -533,11 +533,13 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
free(pTap);
return JIM_ERR;
}
Jim_GetOpt_String(goi, &cp, NULL);
pTap->chip = strdup(cp);

Jim_GetOpt_String(goi, &cp, NULL);
pTap->tapname = strdup(cp);
const char *tmp;
Jim_GetOpt_String(goi, &tmp, NULL);
pTap->chip = strdup(tmp);

Jim_GetOpt_String(goi, &tmp, NULL);
pTap->tapname = strdup(tmp);

/* name + dot + name + null */
x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1;


+ 1
- 1
src/rtos/rtos.c View File

@@ -104,7 +104,7 @@ static int os_alloc_create(struct target *target, struct rtos_type *ostype)
int rtos_create(Jim_GetOptInfo *goi, struct target *target)
{
int x;
char *cp;
const char *cp;
struct Jim_Obj *res;

if (!goi->isconfigure && goi->argc != 0) {


+ 2
- 2
src/target/nds32_cmd.c View File

@@ -846,7 +846,7 @@ static int jim_nds32_read_edm_sr(Jim_Interp *interp, int argc, Jim_Obj * const *
}

int e;
char *edm_sr_name;
const char *edm_sr_name;
int edm_sr_name_len;
e = Jim_GetOpt_String(&goi, &edm_sr_name, &edm_sr_name_len);
if (e != JIM_OK)
@@ -892,7 +892,7 @@ static int jim_nds32_write_edm_sr(Jim_Interp *interp, int argc, Jim_Obj * const
}

int e;
char *edm_sr_name;
const char *edm_sr_name;
int edm_sr_name_len;
e = Jim_GetOpt_String(&goi, &edm_sr_name, &edm_sr_name_len);
if (e != JIM_OK)


+ 1
- 3
src/target/target.c View File

@@ -5186,7 +5186,6 @@ static int target_create(Jim_GetOptInfo *goi)
Jim_Obj *new_cmd;
Jim_Cmd *cmd;
const char *cp;
char *cp2;
int e;
int x;
struct target *target;
@@ -5211,10 +5210,9 @@ static int target_create(Jim_GetOptInfo *goi)
}

/* TYPE */
e = Jim_GetOpt_String(goi, &cp2, NULL);
e = Jim_GetOpt_String(goi, &cp, NULL);
if (e != JIM_OK)
return e;
cp = cp2;
struct transport *tr = get_current_transport();
if (tr->override_target) {
e = tr->override_target(&cp);


Loading…
Cancel
Save