From 7819834ace37ca7f5d1b834c761dfcb9964ef845 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Mon, 25 Apr 2022 23:04:49 +0200 Subject: 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 Reported-by: dullfire@yahoo.com Reviewed-on: https://review.openocd.org/c/openocd/+/6948 Tested-by: jenkins --- src/target/target.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/target/target.c b/src/target/target.c index 690526e..d2dff11 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -5222,10 +5222,18 @@ static int target_jim_set_reg(Jim_Interp *interp, int argc, } int tmp; +#if JIM_VERSION >= 80 Jim_Obj **dict = Jim_DictPairs(interp, argv[1], &tmp); if (!dict) 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; struct command_context *cmd_ctx = current_command_context(interp); -- cgit v1.1