target: fix build with jimtcl 0.79

In jimtcl 0.80 the prototype of Jim_DictPairs() has changed.
The only code in OpenOCD that uses Jim_DictPairs() has been merged
recently and it only uses the current jimtcl syntax.

To allow compiling OpenOCD master branch with older versions of
jimtcl, detect the version of jimtcl and use the appropriate
syntax.

Change-Id: I6fc78303b6a4db064a97f326c46119f4568e88f3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: dullfire@yahoo.com
Reviewed-on: https://review.openocd.org/c/openocd/+/6948
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2022-04-25 23:04:49 +02:00
parent ad5ca263e9
commit 7819834ace
1 changed files with 8 additions and 0 deletions

View File

@ -5222,10 +5222,18 @@ static int target_jim_set_reg(Jim_Interp *interp, int argc,
} }
int tmp; int tmp;
#if JIM_VERSION >= 80
Jim_Obj **dict = Jim_DictPairs(interp, argv[1], &tmp); Jim_Obj **dict = Jim_DictPairs(interp, argv[1], &tmp);
if (!dict) if (!dict)
return JIM_ERR; return JIM_ERR;
#else
Jim_Obj **dict;
int ret = Jim_DictPairs(interp, argv[1], &dict, &tmp);
if (ret != JIM_OK)
return ret;
#endif
const unsigned int length = tmp; const unsigned int length = tmp;
struct command_context *cmd_ctx = current_command_context(interp); struct command_context *cmd_ctx = current_command_context(interp);