summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lin <[email protected]>2020-02-29 16:53:44 +0800
committerGitHub <[email protected]>2020-02-29 16:53:44 +0800
commitfac95192ea241deb543c0af4421c31fce667fca2 (patch)
treecb20882f60c4aab36b590c4229539a8f1c204ae2
parent02722864d6204d1671c8409276a41b78d1d2a9e8 (diff)
[finsh]Minor optimization in finsh_compiler.c
The code just clean the first member of array 'finsh_vm_stack', but it works well in the past years, memset(&finsh_vm_stack[0], 0, sizeof(finsh_vm_stack[0])); Is it better to re-code as below, it will be more readable and robust: memset(&finsh_vm_stack[0], 0, sizeof(finsh_vm_stack));
-rw-r--r--components/finsh/finsh_compiler.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/finsh/finsh_compiler.c b/components/finsh/finsh_compiler.c
index 1b1f67cb76..8d33e0e567 100644
--- a/components/finsh/finsh_compiler.c
+++ b/components/finsh/finsh_compiler.c
@@ -890,7 +890,7 @@ int finsh_compiler_run(struct finsh_node* node)
/* clean text segment and vm stack */
memset(&text_segment[0], 0, sizeof(text_segment));
- memset(&finsh_vm_stack[0], 0, sizeof(finsh_vm_stack[0]));
+ memset(&finsh_vm_stack[0], 0, sizeof(finsh_vm_stack));
/* reset compile stack pointer and pc */
finsh_compile_sp = &finsh_vm_stack[0];