Procházet zdrojové kódy

[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));
David Lin před 5 roky
rodič
revize
fac95192ea
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      components/finsh/finsh_compiler.c

+ 1 - 1
components/finsh/finsh_compiler.c

@@ -890,7 +890,7 @@ int finsh_compiler_run(struct finsh_node* node)
 
 
     /* clean text segment and vm stack */
     /* clean text segment and vm stack */
     memset(&text_segment[0], 0, sizeof(text_segment));
     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 */
     /* reset compile stack pointer and pc */
     finsh_compile_sp = &finsh_vm_stack[0];
     finsh_compile_sp = &finsh_vm_stack[0];