summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-04-04 11:46:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2008-04-04 14:45:04 +0200
commit50cc8c5412e804480a10ecdd9546c7b6ad21760e (patch)
tree86d3a04fd004996fc91839b9a7cad705090bcdc0 /common
parenta9912f68c65850d2bed12111aabe8b779c95e365 (diff)
downloadbarebox-50cc8c5412e804480a10ecdd9546c7b6ad21760e.tar.gz
Subject: [PATCH] [general] Fixed constant strings in data section issue
For practical reasons I changed all string literals assumed to be constant to reside in .rodata subsection at end of .text section. Signed-off-by: Carsten Schlote <schlote@vahanus.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/command.c12
-rw-r--r--common/hush.c11
-rw-r--r--common/module.c2
3 files changed, 14 insertions, 11 deletions
diff --git a/common/command.c b/common/command.c
index 94a8f28..d1b19c0 100644
--- a/common/command.c
+++ b/common/command.c
@@ -142,14 +142,14 @@ static int do_help (cmd_tbl_t * cmdtp, int argc, char *argv[])
}
}
-static __maybe_unused char cmd_help_help[] =
+static const __maybe_unused char cmd_help_help[] =
"Show help information (for 'command')\n"
"'help' prints online help for the monitor commands.\n\n"
"Without arguments, it prints a short usage message for all commands.\n\n"
"To get detailed help information for specific commands you can type\n"
"'help' with one or more command names as arguments.\n";
-static char *help_aliases[] = { "?", NULL};
+static const char *help_aliases[] = { "?", NULL};
U_BOOT_CMD_START(help)
.maxargs = 2,
@@ -161,8 +161,8 @@ U_BOOT_CMD_END
static int compare(struct list_head *a, struct list_head *b)
{
- char *na = list_entry(a, cmd_tbl_t, list)->name;
- char *nb = list_entry(b, cmd_tbl_t, list)->name;
+ char *na = (char*)list_entry(a, cmd_tbl_t, list)->name;
+ char *nb = (char*)list_entry(b, cmd_tbl_t, list)->name;
return strcmp(na, nb);
}
@@ -180,7 +180,7 @@ int register_command(cmd_tbl_t *cmd)
list_add_sort(&cmd->list, &command_list, compare);
if (cmd->aliases) {
- char **aliases = cmd->aliases;
+ char **aliases = (char**)cmd->aliases;
while(*aliases) {
char *usage = "alias for ";
cmd_tbl_t *c = xzalloc(sizeof(cmd_tbl_t));
@@ -189,7 +189,7 @@ int register_command(cmd_tbl_t *cmd)
c->name = *aliases;
c->usage = xmalloc(strlen(usage) + strlen(cmd->name) + 1);
- sprintf(c->usage, "%s%s", usage, cmd->name);
+ sprintf((char*)c->usage, "%s%s", usage, cmd->name);
c->aliases = NULL;
diff --git a/common/hush.c b/common/hush.c
index 878312f..245dede 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1596,7 +1596,7 @@ static int do_sh(cmd_tbl_t *cmdtp, int argc, char *argv[])
return execute_script(argv[1], argc - 1, argv + 1);
}
-static __maybe_unused char cmd_sh_help[] =
+static const __maybe_unused char cmd_sh_help[] =
"Usage: sh filename [arguments]\n"
"\n"
"Execute a shell script\n";
@@ -1618,9 +1618,9 @@ static int do_source(cmd_tbl_t *cmdtp, int argc, char *argv[])
return source_script(argv[1], argc - 1, argv + 1);
}
-static char *source_aliases[] = { ".", NULL};
+static const char *source_aliases[] = { ".", NULL};
-static __maybe_unused char cmd_source_help[] =
+static const __maybe_unused char cmd_source_help[] =
"Usage: . filename [arguments]\n"
"or source filename [arguments]\n"
"\n"
@@ -1628,11 +1628,14 @@ static __maybe_unused char cmd_source_help[] =
"environment and return the exit status of the last command exe-\n"
"cuted from filename\n";
+static const __maybe_unused char cmd_source_usage[] =
+"execute shell script in current shell environment";
+
U_BOOT_CMD_START(source)
.maxargs = CONFIG_MAXARGS,
.aliases = source_aliases,
.cmd = do_source,
- .usage = "execute shell script in current shell environment",
+ .usage = cmd_source_usage,
U_BOOT_CMD_HELP(cmd_source_help)
U_BOOT_CMD_END
diff --git a/common/module.c b/common/module.c
index 8b91ddd..54c40dd 100644
--- a/common/module.c
+++ b/common/module.c
@@ -368,7 +368,7 @@ static int do_insmod (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_insmod_help[] =
+static const __maybe_unused char cmd_insmod_help[] =
"Usage: insmod <module>\n";
U_BOOT_CMD_START(insmod)