helper/command: always pass struct command as jim private data
[fw/openocd] / src / helper / command.h
index b0c84bb43d629a3226e1c4495d1fdadb543b392e..cb088d74388aefa2194bc23ca9dffacdf5fde4ef 100644 (file)
@@ -195,6 +195,15 @@ struct command {
        struct command *next;
 };
 
+/*
+ * Return the struct command pointer kept in private data
+ * Used to enforce check on data type
+ */
+static inline struct command *jim_to_command(Jim_Interp *interp)
+{
+       return Jim_CmdPrivData(interp);
+}
+
 /*
  * Commands should be registered by filling in one or more of these
  * structures and passing them to [un]register_commands().