From 4f9a9b8ebae8425eda3a71ccb782789cd3b8f6b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Harboe?= Date: Wed, 29 Dec 2010 22:07:21 +0100 Subject: [PATCH] warnings: use more 'const' for char * MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- src/flash/mflash.h | 2 +- src/flash/nand/core.h | 6 +++--- src/flash/nand/driver.h | 2 +- src/flash/nor/at91sam7.c | 2 +- src/flash/nor/core.h | 2 +- src/flash/nor/driver.h | 2 +- src/flash/nor/lpc288x.c | 2 +- src/flash/nor/pic32mx.c | 2 +- src/flash/nor/stellaris.c | 4 ++-- src/flash/nor/tms470.c | 4 ++-- src/helper/bin2char.c | 2 +- src/helper/command.c | 2 +- src/helper/command.h | 2 +- src/pld/pld.h | 2 +- src/server/server.c | 2 +- src/server/server.h | 2 +- src/target/algorithm.h | 2 +- src/target/arm9tdmi.c | 2 +- src/target/arm_disassembler.c | 2 +- src/target/armv7m.c | 2 +- src/target/dsp563xx.c | 2 +- src/target/dsp563xx.h | 2 +- src/target/etm.h | 2 +- src/target/register.h | 4 ++-- src/target/target_type.h | 2 +- 25 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/flash/mflash.h b/src/flash/mflash.h index bb3cd05b..0520c5fa 100644 --- a/src/flash/mflash.h +++ b/src/flash/mflash.h @@ -34,7 +34,7 @@ struct mflash_gpio_num struct mflash_gpio_drv { - char *name; + const char *name; int (*set_gpio_to_output) (struct mflash_gpio_num gpio); int (*set_gpio_output_val) (struct mflash_gpio_num gpio, uint8_t val); }; diff --git a/src/flash/nand/core.h b/src/flash/nand/core.h index a8e7466a..709c37b3 100644 --- a/src/flash/nand/core.h +++ b/src/flash/nand/core.h @@ -59,7 +59,7 @@ struct nand_ecclayout { struct nand_device { - char *name; + const char *name; struct nand_flash_controller *controller; void *controller_priv; struct nand_manufacturer *manufacturer; @@ -91,12 +91,12 @@ enum struct nand_manufacturer { int id; - char *name; + const char *name; }; struct nand_info { - char *name; + const char *name; int id; int page_size; int chip_size; diff --git a/src/flash/nand/driver.h b/src/flash/nand/driver.h index fe73e906..deb41b2a 100644 --- a/src/flash/nand/driver.h +++ b/src/flash/nand/driver.h @@ -35,7 +35,7 @@ struct nand_device; struct nand_flash_controller { /** Driver name that is used to select it from configuration files. */ - char *name; + const char *name; const struct command_registration *commands; diff --git a/src/flash/nor/at91sam7.c b/src/flash/nor/at91sam7.c index 3fabe478..ad6ee6c3 100644 --- a/src/flash/nor/at91sam7.c +++ b/src/flash/nor/at91sam7.c @@ -125,7 +125,7 @@ struct at91sam7_flash_bank uint16_t cidr_nvpsiz2; uint16_t cidr_eproc; uint16_t cidr_version; - char *target_name; + const char *target_name; /* flash auto-detection */ uint8_t flash_autodetection; diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index ff14df0a..8f7dce88 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -74,7 +74,7 @@ struct flash_sector */ struct flash_bank { - char *name; + const char *name; struct target *target; /**< Target to which this bank belongs. */ diff --git a/src/flash/nor/driver.h b/src/flash/nor/driver.h index cbf9c528..afd05285 100644 --- a/src/flash/nor/driver.h +++ b/src/flash/nor/driver.h @@ -54,7 +54,7 @@ struct flash_driver * Gives a human-readable name of this flash driver, * This field is used to select and initialize the driver. */ - char *name; + const char *name; /** * An array of driver-specific commands to register. When called diff --git a/src/flash/nor/lpc288x.c b/src/flash/nor/lpc288x.c index d8cecc0b..589527f7 100644 --- a/src/flash/nor/lpc288x.c +++ b/src/flash/nor/lpc288x.c @@ -91,7 +91,7 @@ struct lpc288x_flash_bank /* chip id register */ uint32_t cidr; - char * target_name; + const char * target_name; uint32_t cclk; uint32_t sector_size_break; diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 4b8d0272..6a277021 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -99,7 +99,7 @@ struct pic32mx_flash_bank static const struct pic32mx_devs_s { uint8_t devid; - char *name; + const char *name; } pic32mx_devs[] = { {0x38, "360F512L"}, {0x34, "360F256L"}, diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index 12ea15b2..851cab33 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -100,7 +100,7 @@ struct stellaris_flash_bank uint32_t dc0; uint32_t dc1; - char * target_name; + const char * target_name; uint32_t sramsiz; uint32_t flshsz; @@ -125,7 +125,7 @@ struct stellaris_flash_bank static struct { uint32_t partno; - char *partname; + const char *partname; } StellarisParts[] = { {0x0001,"LM3S101"}, diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c index 4ca6cd8d..dd9ff5b4 100644 --- a/src/flash/nor/tms470.c +++ b/src/flash/nor/tms470.c @@ -38,7 +38,7 @@ struct tms470_flash_bank uint32_t technology_family; uint32_t rom_flash; uint32_t part_number; - char * part_name; + const char * part_name; }; @@ -129,7 +129,7 @@ static int tms470_read_part_info(struct flash_bank *bank) uint32_t technology_family; uint32_t rom_flash; uint32_t part_number; - char *part_name; + const char *part_name; /* we shall not rely on the caller in this test, this function allocates memory, thus and executing the code more than once may cause memory leak */ diff --git a/src/helper/bin2char.c b/src/helper/bin2char.c index 5bb4a6de..a214b63e 100644 --- a/src/helper/bin2char.c +++ b/src/helper/bin2char.c @@ -29,7 +29,7 @@ int main(int argc, char **argv) { int c; unsigned int n; - char *name; + const char *name; if (argc == 1) { fprintf(stderr, "bin2char \n"); diff --git a/src/helper/command.c b/src/helper/command.c index fd5e5f94..d5ac34b4 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -310,7 +310,7 @@ static void command_free(struct command *c) } if (c->name) - free(c->name); + free((void *)c->name); if (c->help) free((void*)c->help); if (c->usage) diff --git a/src/helper/command.h b/src/helper/command.h index 0ee66b09..3d1cdec8 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -173,7 +173,7 @@ typedef __COMMAND_HANDLER((*command_handler_t)); struct command { - char *name; + const char *name; const char *help; const char *usage; struct command *parent; diff --git a/src/pld/pld.h b/src/pld/pld.h index d306246b..3c7e4ffb 100644 --- a/src/pld/pld.h +++ b/src/pld/pld.h @@ -29,7 +29,7 @@ struct pld_device; struct pld_driver { - char *name; + const char *name; __PLD_DEVICE_COMMAND((*pld_device_command)); const struct command_registration *commands; int (*load)(struct pld_device *pld_device, const char *filename); diff --git a/src/server/server.c b/src/server/server.c index 70d9566a..c70a5222 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -306,7 +306,7 @@ static int remove_services(void) struct service *next = c->next; if (c->name) - free(c->name); + free((void *)c->name); if (c->type == CONNECTION_PIPE) { diff --git a/src/server/server.h b/src/server/server.h index 2afd7125..34cf1cf0 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -57,7 +57,7 @@ typedef int (*connection_closed_handler_t)(struct connection *connection); struct service { - char *name; + const char *name; enum connection_type type; const char *port; unsigned short portnumber; diff --git a/src/target/algorithm.h b/src/target/algorithm.h index abb8ecfc..af1fd917 100644 --- a/src/target/algorithm.h +++ b/src/target/algorithm.h @@ -37,7 +37,7 @@ struct mem_param struct reg_param { - char *reg_name; + const char *reg_name; uint32_t size; uint8_t *value; enum param_direction direction; diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index fd507031..5c2fd9d1 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -60,7 +60,7 @@ enum arm9tdmi_vector_bit }; static const struct arm9tdmi_vector { - char *name; + const char *name; uint32_t value; } arm9tdmi_vectors[] = { {"reset", ARM9TDMI_RESET_VECTOR}, diff --git a/src/target/arm_disassembler.c b/src/target/arm_disassembler.c index f02053fb..10720f45 100644 --- a/src/target/arm_disassembler.c +++ b/src/target/arm_disassembler.c @@ -2354,7 +2354,7 @@ static int evaluate_add_sp_pc_thumb(uint16_t opcode, uint8_t Rd = (opcode >> 8) & 0x7; uint8_t Rn; uint32_t SP = opcode & (1 << 11); - char *reg_name; + const char *reg_name; instruction->type = ARM_ADD; diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 03c9c7ac..4fcde16f 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -82,7 +82,7 @@ struct reg armv7m_gdb_dummy_cpsr_reg = */ static const struct { unsigned id; - char *name; + const char *name; unsigned bits; } armv7m_regs[] = { { ARMV7M_R0, "r0", 32 }, diff --git a/src/target/dsp563xx.c b/src/target/dsp563xx.c index 9563eea9..10fd014d 100644 --- a/src/target/dsp563xx.c +++ b/src/target/dsp563xx.c @@ -173,7 +173,7 @@ static int dsp563xx_jtag_sendinstr(struct jtag_tap *tap, uint8_t * ir_in, uint8_ static const struct { unsigned id; - char *name; + const char *name; unsigned bits; uint32_t r_cmd; uint32_t w_cmd; diff --git a/src/target/dsp563xx.h b/src/target/dsp563xx.h index f8070fa7..475e5165 100644 --- a/src/target/dsp563xx.h +++ b/src/target/dsp563xx.h @@ -53,7 +53,7 @@ struct dsp563xx_common struct dsp563xx_core_reg { uint32_t num; - char *name; + const char *name; uint32_t size; uint32_t r_cmd; uint32_t w_cmd; diff --git a/src/target/etm.h b/src/target/etm.h index 8a482c1e..4224de67 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -139,7 +139,7 @@ struct etm_context; struct etm_capture_driver { - char *name; + const char *name; const struct command_registration *commands; int (*init)(struct etm_context *etm_ctx); trace_status_t (*status)(struct etm_context *etm_ctx); diff --git a/src/target/register.h b/src/target/register.h index 0cd0ddfe..4b45fd3c 100644 --- a/src/target/register.h +++ b/src/target/register.h @@ -27,7 +27,7 @@ struct target; struct reg { - char *name; + const char *name; void *value; bool dirty; bool valid; @@ -38,7 +38,7 @@ struct reg struct reg_cache { - char *name; + const char *name; struct reg_cache *next; struct reg *reg_list; unsigned num_regs; diff --git a/src/target/target_type.h b/src/target/target_type.h index 7a8ac9c4..bfa7f937 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -42,7 +42,7 @@ struct target_type * Name of this type of target. Do @b not access this * field directly, use target_type_name() instead. */ - char *name; + const char *name; /* poll current target status */ int (*poll)(struct target *target); -- 2.39.5