From fac95192ea241deb543c0af4421c31fce667fca2 Mon Sep 17 00:00:00 2001 From: David Lin Date: Sat, 29 Feb 2020 16:53:44 +0800 Subject: [PATCH] [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)); --- components/finsh/finsh_compiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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];