transport: Constify the transports vector

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>
__archive__
Andreas Fritiofson 2014-05-10 11:31:35 +02:00
parent ae3bcd05f8
commit cc99e57b0e
4 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@
*/ */
extern struct jtag_interface *jtag_interface; 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) static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {

View File

@ -207,7 +207,7 @@ struct jtag_interface {
#define DEBUG_CAP_TMS_SEQ (1 << 0) #define DEBUG_CAP_TMS_SEQ (1 << 0)
/** transports supported in C code (NULL terminated vector) */ /** transports supported in C code (NULL terminated vector) */
const char **transports; const char * const *transports;
const struct swd_driver *swd; const struct swd_driver *swd;
@ -300,7 +300,7 @@ struct jtag_interface {
int (*srst_asserted)(int *srst_asserted); int (*srst_asserted)(int *srst_asserted);
}; };
extern const char *jtag_only[]; extern const char * const jtag_only[];
void adapter_assert_reset(void); void adapter_assert_reset(void);
void adapter_deassert_reset(void); void adapter_deassert_reset(void);

View File

@ -61,7 +61,7 @@ static struct transport *transport_list;
* currently selected debug adapter supports. This is declared * currently selected debug adapter supports. This is declared
* by the time that adapter is fully set up. * 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. */ /** * The transport being used for the current OpenOCD session. */
static struct transport *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 * to declare the set of transports supported by an adapter. When
* there is only one member of that set, it is automatically selected. * 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 /* NOTE: caller is required to provide only a list
* of *valid* transport names * of *valid* transport names
@ -242,7 +242,7 @@ COMMAND_HANDLER(handle_transport_init)
LOG_ERROR("session's transport is not selected."); LOG_ERROR("session's transport is not selected.");
/* no session transport configured, print transports then fail */ /* no session transport configured, print transports then fail */
const char **vector = allowed_transports; const char * const *vector = allowed_transports;
while (*vector) { while (*vector) {
LOG_ERROR("allow transport '%s'", *vector); LOG_ERROR("allow transport '%s'", *vector);
vector++; vector++;

View File

@ -79,7 +79,7 @@ int transport_register_commands(struct command_context *ctx);
COMMAND_HELPER(transport_list_parse, char ***vector); 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); bool transports_are_declared(void);