summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-06-09 10:00:08 +0000
committerbernard.xiong <[email protected]>2010-06-09 10:00:08 +0000
commit6254665cfeeae2030652c681f28560364372d044 (patch)
tree29df2cf4d1f59d5790122db0c1d6829f4fd9201a
parentf419a1711bb5863b9f1ef865131057e1560907f2 (diff)
reduce finsh shell memory usage.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@765 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--components/finsh/finsh.h2
-rw-r--r--components/finsh/finsh_error.c2
-rw-r--r--components/finsh/finsh_token.c2
-rw-r--r--components/finsh/shell.c6
4 files changed, 7 insertions, 5 deletions
diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h
index 575066e464..12474e841a 100644
--- a/components/finsh/finsh.h
+++ b/components/finsh/finsh.h
@@ -24,7 +24,7 @@
#define FINSH_STRING_MAX 128 /* max length of string */
#define FINSH_VARIABLE_MAX 8 /* max number of variable */
-#define FINSH_STACK_MAX 128 /* max stack size */
+#define FINSH_STACK_MAX 64 /* max stack size */
#define FINSH_TEXT_MAX 128 /* max text segment size */
#define HEAP_ALIGNMENT 4 /* heap alignment */
diff --git a/components/finsh/finsh_error.c b/components/finsh/finsh_error.c
index c10c3c0092..9a8ef631fd 100644
--- a/components/finsh/finsh_error.c
+++ b/components/finsh/finsh_error.c
@@ -15,7 +15,7 @@
u_char global_errno;
-const char* finsh_error_string_table[] =
+static const char* finsh_error_string_table[] =
{
"No error",
"Invalid token",
diff --git a/components/finsh/finsh_token.c b/components/finsh/finsh_token.c
index 11f9dc6459..49d4f8d44a 100644
--- a/components/finsh/finsh_token.c
+++ b/components/finsh/finsh_token.c
@@ -28,7 +28,7 @@ struct name_table
};
/* keyword */
-static struct name_table finsh_name_table[] =
+static const struct name_table finsh_name_table[] =
{
{"void", finsh_token_type_void},
{"char", finsh_token_type_char},
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index fc1b9acb38..a2e1b5b884 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -144,9 +144,10 @@ void finsh_auto_complete(char* prefix)
rt_kprintf("finsh>>%s", prefix);
}
-extern const char* finsh_error_string_table[];
void finsh_run_line(struct finsh_parser* parser, const char *line)
{
+ const char* err_str;
+
rt_kprintf("\n");
finsh_parser_run(parser, (unsigned char*)line);
@@ -157,7 +158,8 @@ void finsh_run_line(struct finsh_parser* parser, const char *line)
}
else
{
- rt_kprintf("%s\n", finsh_error_string(finsh_errno()));
+ err_str = finsh_error_string(finsh_errno());
+ rt_kprintf("%s\n", err_str);
}
/* run virtual machine */