[U-Boot] [PATCH] command: constify _do_help input tables
Mike Frysinger
vapier at gentoo.org
Sun Apr 24 11:43:26 CEST 2011
The _do_help func does not need to write to the command tables passed
to it, so constify the input args.
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
common/command.c | 8 ++++----
include/command.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/common/command.c b/common/command.c
index ddaed68..6ed12e5 100644
--- a/common/command.c
+++ b/common/command.c
@@ -33,14 +33,14 @@
* for long help messages
*/
-int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
- flag, int argc, char * const argv[])
+int _do_help(const cmd_tbl_t *cmd_start, int cmd_items, const cmd_tbl_t *cmdtp,
+ int flag, int argc, char * const argv[])
{
int i;
int rcode = 0;
if (argc == 1) { /*show list of commands */
- cmd_tbl_t *cmd_array[cmd_items];
+ const cmd_tbl_t *cmd_array[cmd_items];
int i, j, swaps;
/* Make array of commands from .uboot_cmd section */
@@ -55,7 +55,7 @@ int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
for (j = 0; j < i; ++j) {
if (strcmp (cmd_array[j]->name,
cmd_array[j + 1]->name) > 0) {
- cmd_tbl_t *tmp;
+ const cmd_tbl_t *tmp;
tmp = cmd_array[j];
cmd_array[j] = cmd_array[j + 1];
cmd_array[j + 1] = tmp;
diff --git a/include/command.h b/include/command.h
index cab9651..54b1996 100644
--- a/include/command.h
+++ b/include/command.h
@@ -66,8 +66,8 @@ extern cmd_tbl_t __u_boot_cmd_end;
/* common/command.c */
-int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
- flag, int argc, char * const argv[]);
+int _do_help(const cmd_tbl_t *cmd_start, int cmd_items, const cmd_tbl_t *cmdtp,
+ int flag, int argc, char * const argv[]);
cmd_tbl_t *find_cmd(const char *cmd);
cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len);
--
1.7.5.rc1
More information about the U-Boot
mailing list