helper/command: fix build with jimtcl 0.79 or older
authorAntonio Borneo <borneo.antonio@gmail.com>
Mon, 26 Apr 2021 07:48:25 +0000 (09:48 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 1 May 2021 12:35:33 +0000 (13:35 +0100)
Commit a7d68878e4ba ("helper/command: unregister commands through
their full-name") introduces for the first time in OpenOCD the use
of jimtcl API Jim_DeleteCommand().
The prototype of Jim_DeleteCommand() has changed with jimtcl 0.80
and the current code doesn't build with jimtcl 0.79 or older. This
is an issue for those distributions, like Debian, that provide
jimtcl as a separate package/library and have not switched yet to
the new jimtcl version.

Add a compile-time condition to cope with the jimtcl API change.

Change-Id: Ic813ab7c0ebd3c8772f27775ba3912a47d5c275c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: a7d68878e4ba ("helper/command: unregister commands through their full-name")
Reviewed-on: http://openocd.zylin.com/6191
Tested-by: jenkins
src/helper/command.c

index 80e297b1f8baea7e5dd28761a11caad74971da82..e703be400cdaaa0387ae0336884352e6a69c0127 100644 (file)
@@ -437,7 +437,11 @@ int unregister_commands_match(struct command_context *cmd_ctx, const char *forma
                        continue;
                }
                LOG_DEBUG("delete command \"%s\"", name);
+#if JIM_VERSION >= 80
                Jim_DeleteCommand(interp, elem);
+#else
+               Jim_DeleteCommand(interp, name);
+#endif
 
                help_del_command(cmd_ctx, name);