Add target_get_name wrapper:
[fw/openocd] / src / target / target.h
index 3d9d8e9f90c348afcd0efde88b4788026be0c0b3..91dd1b15422f4a7dfe1ca9ba8838147bfeb6fb03 100644 (file)
@@ -107,6 +107,10 @@ typedef struct working_area_s
 
 typedef struct target_type_s
 {
+       /**
+        * Name of the target.  Do @b not access this field directly, use
+        * target_get_name() instead.
+        */
        char *name;
 
        /**
@@ -395,6 +399,13 @@ extern target_t* get_current_target(struct command_context_s *cmd_ctx);
 extern int get_num_by_target(target_t *query_target);
 extern target_t *get_target(const char *id);
 
+/**
+ * Get the target name.
+ *
+ * This routine is a wrapper for the target->type->name field.
+ */
+extern const char *target_get_name(struct target_s *target);
+
 /// @returns @c true if the target has been examined.
 extern bool target_was_examined(struct target_s *target);
 /// Sets the @c examined flag for the given target.