diff mbox series

[v2,3/8] cmd/command.c: constify "arg" argument of cmd_get_data_size()

Message ID 20240103104710.4185383-4-rasmus.villemoes@prevas.dk
State Accepted
Commit 48f31ee7427f7e2b87b5b9cf9b86e3b411acf8f0
Delegated to: Tom Rini
Headers show
Series cmd/mem.c fixups | expand

Commit Message

Rasmus Villemoes Jan. 3, 2024, 10:47 a.m. UTC
This function obviously does not and must not modify "arg". Change the
prototype to allow passing an argument of type "const char*" without
requiring a cast.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 common/command.c  | 2 +-
 include/command.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/common/command.c b/common/command.c
index 846e16e2ada..474ac98bc38 100644
--- a/common/command.c
+++ b/common/command.c
@@ -466,7 +466,7 @@  int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
 #endif
 
 #ifdef CMD_DATA_SIZE
-int cmd_get_data_size(char* arg, int default_size)
+int cmd_get_data_size(const char *arg, int default_size)
 {
 	/* Check for a size specification .b, .w or .l.
 	 */
diff --git a/include/command.h b/include/command.h
index 6262365e128..6ea678fbbe6 100644
--- a/include/command.h
+++ b/include/command.h
@@ -153,7 +153,7 @@  int cmd_process_error(struct cmd_tbl *cmdtp, int err);
  * Return: data size in bytes (1, 2, 4, 8) or CMD_DATA_SIZE_ERR for an invalid
  *	character, or CMD_DATA_SIZE_STR for a string
  */
-int cmd_get_data_size(char *arg, int default_size);
+int cmd_get_data_size(const char *arg, int default_size);
 #endif
 
 #ifdef CONFIG_CMD_BOOTD