summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 04:27:15 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-11 11:53:22 -0800
commitca594adb5a71f2bf60c1380172b8e61b075d9479 (patch)
treec4702f927f5991c0075479259e0562db1c941cc4 /src/target
parent9741e126fd854815460296ad47d027129c7f17bf (diff)
downloadopenocd+libswd-ca594adb5a71f2bf60c1380172b8e61b075d9479.tar.gz
openocd+libswd-ca594adb5a71f2bf60c1380172b8e61b075d9479.tar.bz2
openocd+libswd-ca594adb5a71f2bf60c1380172b8e61b075d9479.tar.xz
openocd+libswd-ca594adb5a71f2bf60c1380172b8e61b075d9479.zip
add const keyword to some APIs
Add 'const' keyword to 'char *' parameters to allow command handlers to pass constant string arguments. These changes allow the 'args' command handler to be changed to 'const' in a subsequent patch.
Diffstat (limited to 'src/target')
-rw-r--r--src/target/image.c6
-rw-r--r--src/target/image.h2
-rw-r--r--src/target/register.c3
-rw-r--r--src/target/register.h3
-rw-r--r--src/target/target.c2
5 files changed, 9 insertions, 7 deletions
diff --git a/src/target/image.c b/src/target/image.c
index b9e641b3..cf7e11ab 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -44,7 +44,7 @@
((elf->endianness == ELFDATA2LSB)? \
le_to_h_u32((uint8_t*)&field):be_to_h_u32((uint8_t*)&field))
-static int autodetect_image_type(image_t *image, char *url)
+static int autodetect_image_type(image_t *image, const char *url)
{
int retval;
fileio_t fileio;
@@ -106,7 +106,7 @@ static int autodetect_image_type(image_t *image, char *url)
return ERROR_OK;
}
-static int identify_image_type(image_t *image, char *type_string, char *url)
+static int identify_image_type(image_t *image, const char *type_string, const char *url)
{
if (type_string)
{
@@ -669,7 +669,7 @@ static int image_mot_buffer_complete(image_t *image)
return ERROR_IMAGE_FORMAT_ERROR;
}
-int image_open(image_t *image, char *url, char *type_string)
+int image_open(image_t *image, const char *url, const char *type_string)
{
int retval = ERROR_OK;
diff --git a/src/target/image.h b/src/target/image.h
index 8b70b3b1..30240d56 100644
--- a/src/target/image.h
+++ b/src/target/image.h
@@ -100,7 +100,7 @@ typedef struct image_mot_s
uint8_t *buffer;
} image_mot_t;
-int image_open(image_t *image, char *url, char *type_string);
+int image_open(image_t *image, const char *url, const char *type_string);
int image_read_section(image_t *image, int section, uint32_t offset,
uint32_t size, uint8_t *buffer, uint32_t *size_read);
void image_close(image_t *image);
diff --git a/src/target/register.c b/src/target/register.c
index b9e7770f..58cc85e2 100644
--- a/src/target/register.c
+++ b/src/target/register.c
@@ -30,7 +30,8 @@
reg_arch_type_t *reg_arch_types = NULL;
-reg_t* register_get_by_name(reg_cache_t *first, char *name, int search_all)
+reg_t* register_get_by_name(reg_cache_t *first,
+ const char *name, bool search_all)
{
int i;
reg_cache_t *cache = first;
diff --git a/src/target/register.h b/src/target/register.h
index e7904e58..3af81cad 100644
--- a/src/target/register.h
+++ b/src/target/register.h
@@ -62,7 +62,8 @@ typedef struct reg_arch_type_s
struct reg_arch_type_s *next;
} reg_arch_type_t;
-reg_t* register_get_by_name(reg_cache_t *first, char *name, int search_all);
+reg_t* register_get_by_name(reg_cache_t *first,
+ const char *name, bool search_all);
reg_cache_t** register_get_last_cache_p(reg_cache_t **first);
int register_reg_arch_type(int (*get)(reg_t *reg),
diff --git a/src/target/target.c b/src/target/target.c
index 1bf680d1..575a99ce 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2928,7 +2928,7 @@ static void writeString(FILE *f, char *s)
}
/* Dump a gmon.out histogram file. */
-static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
+static void writeGmon(uint32_t *samples, uint32_t sampleNum, const char *filename)
{
uint32_t i;
FILE *f = fopen(filename, "w");