]> git.sur5r.net Git - openocd/commitdiff
transport: Constify the transports vector
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sat, 10 May 2014 09:31:35 +0000 (11:31 +0200)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sat, 28 Jun 2014 09:33:31 +0000 (09:33 +0000)
Change-Id: I0c874b5d4c97cf781d83bd381d701f770e069f72
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2135
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
src/jtag/adapter.c
src/jtag/interface.h
src/transport/transport.c
src/transport/transport.h

index 494d39e9a65dbaec33c32af484e6e49efbb3f3c6..2f5f6b436262a657590dfdc10514224654eed64f 100644 (file)
@@ -48,7 +48,7 @@
  */
 
 extern struct jtag_interface *jtag_interface;
-const char *jtag_only[] = { "jtag", NULL };
+const char * const jtag_only[] = { "jtag", NULL };
 
 static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
 {
index 8dacd22348e4a858c91f65d1041e2db32a1cb2c6..275c49555d26e59ba6f5664a5118c808bfd036ec 100644 (file)
@@ -207,7 +207,7 @@ struct jtag_interface {
 #define DEBUG_CAP_TMS_SEQ      (1 << 0)
 
        /** transports supported in C code (NULL terminated vector) */
-       const char **transports;
+       const char * const *transports;
 
        const struct swd_driver *swd;
 
@@ -300,7 +300,7 @@ struct jtag_interface {
        int (*srst_asserted)(int *srst_asserted);
 };
 
-extern const char *jtag_only[];
+extern const char * const jtag_only[];
 
 void adapter_assert_reset(void);
 void adapter_deassert_reset(void);
index 35194b51c142ae6daee92eb7deeac095d262d063..072a0d38544d59b0c18f0748efe3d10b266753d1 100644 (file)
@@ -61,7 +61,7 @@ static struct transport *transport_list;
  * currently selected debug adapter supports.  This is declared
  * by the time that adapter is fully set up.
  */
-static const char **allowed_transports;
+static const char * const *allowed_transports;
 
 /** * The transport being used for the current OpenOCD session.  */
 static struct transport *session;
@@ -94,7 +94,7 @@ static int transport_select(struct command_context *ctx, const char *name)
  * to declare the set of transports supported by an adapter.  When
  * there is only one member of that set, it is automatically selected.
  */
-int allow_transports(struct command_context *ctx, const char **vector)
+int allow_transports(struct command_context *ctx, const char * const *vector)
 {
        /* NOTE:  caller is required to provide only a list
         * of *valid* transport names
@@ -242,7 +242,7 @@ COMMAND_HANDLER(handle_transport_init)
                LOG_ERROR("session's transport is not selected.");
 
                /* no session transport configured, print transports then fail */
-               const char **vector = allowed_transports;
+               const char * const *vector = allowed_transports;
                while (*vector) {
                        LOG_ERROR("allow transport '%s'", *vector);
                        vector++;
index a7a73d10f5f15aa7acd7cc95d1f5c4b58ca53fa6..afb7b1251291db55870051564b5bad9cb56a3b3a 100644 (file)
@@ -79,7 +79,7 @@ int transport_register_commands(struct command_context *ctx);
 
 COMMAND_HELPER(transport_list_parse, char ***vector);
 
-int allow_transports(struct command_context *ctx, const char **vector);
+int allow_transports(struct command_context *ctx, const char * const *vector);
 
 bool transports_are_declared(void);