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.
This commit is contained in:
Zachary T Welch
2009-11-10 04:27:15 -08:00
parent 9741e126fd
commit ca594adb5a
15 changed files with 22 additions and 20 deletions
+1 -1
View File
@@ -199,7 +199,7 @@ flash_bank_t *get_flash_bank_by_num(int num)
}
int flash_command_get_bank_by_num(
struct command_context_s *cmd_ctx, char *str, flash_bank_t **bank)
struct command_context_s *cmd_ctx, const char *str, flash_bank_t **bank)
{
unsigned bank_num;
COMMAND_PARSE_NUMBER(uint, str, bank_num);
+1 -1
View File
@@ -326,7 +326,7 @@ flash_bank_t *get_flash_bank_by_num(int num);
* @returns ERROR_OK on success, or an error indicating the problem.
*/
int flash_command_get_bank_by_num(struct command_context_s *cmd_ctx,
char *str, flash_bank_t **bank);
const char *str, flash_bank_t **bank);
/**
* Returns the flash bank like get_flash_bank_by_num(), without probing.
* @param num The flash bank number.
+3 -3
View File
@@ -635,7 +635,7 @@ static int lpc2900_handle_read_custom_command( struct command_context_s *cmd_ctx
/* Try and open the file */
fileio_t fileio;
char *filename = args[1];
const char *filename = args[1];
int ret = fileio_open( &fileio, filename, FILEIO_WRITE, FILEIO_BINARY );
if( ret != ERROR_OK )
{
@@ -747,8 +747,8 @@ static int lpc2900_handle_write_custom_command( struct command_context_s *cmd_ct
image.base_address = 0;
image.start_address_set = 0;
char *filename = args[1];
char *type = (argc >= 3) ? args[2] : NULL;
const char *filename = args[1];
const char *type = (argc >= 3) ? args[2] : NULL;
retval = image_open(&image, filename, type);
if (retval != ERROR_OK)
{
+1 -1
View File
@@ -304,7 +304,7 @@ nand_device_t *get_nand_device_by_num(int num)
}
int nand_command_get_device_by_num(struct command_context_s *cmd_ctx,
char *str, nand_device_t **device)
const char *str, nand_device_t **device)
{
unsigned num;
COMMAND_PARSE_NUMBER(uint, str, num);
+1 -1
View File
@@ -226,7 +226,7 @@ int nand_init(struct command_context_s *cmd_ctx);
/// helper for parsing a nand device command argument string
int nand_command_get_device_by_num(struct command_context_s *cmd_ctx,
char *str, nand_device_t **device);
const char *str, nand_device_t **device);
#define ERROR_NAND_DEVICE_INVALID (-1100)