From cc99e57b0e8ed3672afce1925142863cceb809f2 Mon Sep 17 00:00:00 2001 From: Andreas Fritiofson Date: Sat, 10 May 2014 11:31:35 +0200 Subject: [PATCH] transport: Constify the transports vector Change-Id: I0c874b5d4c97cf781d83bd381d701f770e069f72 Signed-off-by: Andreas Fritiofson Reviewed-on: http://openocd.zylin.com/2135 Tested-by: jenkins Reviewed-by: Paul Fertser --- src/jtag/adapter.c | 2 +- src/jtag/interface.h | 4 ++-- src/transport/transport.c | 6 +++--- src/transport/transport.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c index 494d39e9..2f5f6b43 100644 --- a/src/jtag/adapter.c +++ b/src/jtag/adapter.c @@ -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) { diff --git a/src/jtag/interface.h b/src/jtag/interface.h index 8dacd223..275c4955 100644 --- a/src/jtag/interface.h +++ b/src/jtag/interface.h @@ -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); diff --git a/src/transport/transport.c b/src/transport/transport.c index 35194b51..072a0d38 100644 --- a/src/transport/transport.c +++ b/src/transport/transport.c @@ -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++; diff --git a/src/transport/transport.h b/src/transport/transport.h index a7a73d10..afb7b125 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -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); -- 2.39.5