From 3c06396c8ee9d660b0bc70f526acef1b7218cbad Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sat, 22 Apr 2017 13:50:04 -0700 Subject: [PATCH] Constify strings and constant structs --- src/target/cortexa.c | 2 +- src/target/cortexm.c | 2 +- src/target/jtag_scan.c | 10 +++++----- src/target/jtag_scan.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/target/cortexa.c b/src/target/cortexa.c index ba27375..9ef239c 100644 --- a/src/target/cortexa.c +++ b/src/target/cortexa.c @@ -33,7 +33,7 @@ #include "target.h" #include "target_internal.h" -static char cortexa_driver_str[] = "ARM Cortex-A"; +static const char cortexa_driver_str[] = "ARM Cortex-A"; static bool cortexa_attach(target *t); static void cortexa_detach(target *t); diff --git a/src/target/cortexm.c b/src/target/cortexm.c index 80e1caf..4e94106 100644 --- a/src/target/cortexm.c +++ b/src/target/cortexm.c @@ -34,7 +34,7 @@ #include -static char cortexm_driver_str[] = "ARM Cortex-M"; +static const char cortexm_driver_str[] = "ARM Cortex-M"; static bool cortexm_vector_catch(target *t, int argc, char *argv[]); diff --git a/src/target/jtag_scan.c b/src/target/jtag_scan.c index 4546be5..a30a805 100644 --- a/src/target/jtag_scan.c +++ b/src/target/jtag_scan.c @@ -32,11 +32,11 @@ struct jtag_dev_s jtag_devs[JTAG_MAX_DEVS+1]; int jtag_dev_count; -static struct jtag_dev_descr_s { - uint32_t idcode; - uint32_t idmask; - char *descr; - void (*handler)(jtag_dev_t *dev); +static const struct jtag_dev_descr_s { + const uint32_t idcode; + const uint32_t idmask; + const char * const descr; + void (*const handler)(jtag_dev_t *dev); } dev_descr[] = { {.idcode = 0x0BA00477, .idmask = 0x0FFF0FFF, .descr = "ARM Limited: ADIv5 JTAG-DP port.", diff --git a/src/target/jtag_scan.h b/src/target/jtag_scan.h index e96f6e7..3c723f4 100644 --- a/src/target/jtag_scan.h +++ b/src/target/jtag_scan.h @@ -36,7 +36,7 @@ typedef struct jtag_dev_s { uint8_t ir_postscan; uint32_t idcode; - char *descr; + const char *descr; uint32_t current_ir;