Patchwork [U-Boot] cmd_usage: constify

login
register
mail settings
Submitter Mike Frysinger
Date April 24, 2011, 9:43 a.m.
Message ID <1303638204-3262-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/92648/
State Accepted
Commit e84ffddbced7620aa9fe4b9e8bfffb6a994c7b4e
Delegated to: Wolfgang Denk
Headers show

Comments

Mike Frysinger - April 24, 2011, 9:43 a.m.
The usage helper doesn't modify the command, so constify its input arg.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 common/command.c  |    2 +-
 include/command.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Wolfgang Denk - July 26, 2011, 2:34 p.m.
Dear Mike Frysinger,

In message <1303638204-3262-1-git-send-email-vapier@gentoo.org> you wrote:
> The usage helper doesn't modify the command, so constify its input arg.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  common/command.c  |    2 +-
>  include/command.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/common/command.c b/common/command.c
index b3ec510..ddaed68 100644
--- a/common/command.c
+++ b/common/command.c
@@ -140,7 +140,7 @@  cmd_tbl_t *find_cmd (const char *cmd)
 	return find_cmd_tbl(cmd, &__u_boot_cmd_start, len);
 }
 
-int cmd_usage(cmd_tbl_t *cmdtp)
+int cmd_usage(const cmd_tbl_t *cmdtp)
 {
 	printf("%s - %s\n\n", cmdtp->name, cmdtp->usage);
 
diff --git a/include/command.h b/include/command.h
index 8310fe5..cab9651 100644
--- a/include/command.h
+++ b/include/command.h
@@ -71,7 +71,7 @@  int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
 cmd_tbl_t *find_cmd(const char *cmd);
 cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len);
 
-extern int cmd_usage(cmd_tbl_t *cmdtp);
+extern int cmd_usage(const cmd_tbl_t *cmdtp);
 
 #ifdef CONFIG_AUTO_COMPLETE
 extern int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]);