@@ -68,15 +68,15 @@ typedef struct {
6868
6969// Declare constants 
7070// (these should not be changed unless you really know what you are doing) 
71- const   int   GENERAL_STRING_BUFFER_LENGHTH   =   100 ; 
72- const   int   MAX_ERROR_ID_LENGTH  =   GENERAL_STRING_BUFFER_LENGHTH ; 
73- const   int   MAX_ERROR_MESSAGE_LENGTH  =   GENERAL_STRING_BUFFER_LENGHTH ; 
71+ #define   GENERAL_STRING_BUFFER_LENGTH   100
72+ #define   MAX_ERROR_ID_LENGTH  200 
73+ #define   MAX_ERROR_MESSAGE_LENGTH  GENERAL_STRING_BUFFER_LENGTH 
7474
7575const  char  * ERROR_ID_PREFIX  =  "mocov_line_covered:" ;
7676const  char  * MALLOC_ERROR_MESSAGE_PREFIX  =  "memory allocation failed: " ;
7777
7878#if  IS_DEBUG 
79- const  int  DEBUG_BUFFER_SIZE  =  GENERAL_STRING_BUFFER_LENGHTH ;
79+ const  int  DEBUG_BUFFER_SIZE  =  GENERAL_STRING_BUFFER_LENGTH ;
8080const  char  * DEBUG_PREFIX  =  "DEBUG: " ;
8181#endif 
8282
@@ -441,7 +441,7 @@ void return_state(const mxArray *prhs[], int nlhs, mxArray *plhs[]) {
441441                        "This function accepts at most one output." );
442442
443443    } else  if  (nlhs  ==  0 ) {
444-         // No output, nothing to do, we can exit this function 
444+         // No output, nothing to do, we can exit this function early.  
445445        return ;
446446    }
447447
@@ -622,7 +622,7 @@ void set_state(const mxArray *prhs[], int nlhs, mxArray *plhs[]) {
622622    debug_print_state ();
623623}
624624
625- // Helper function to handle nrhs == 4  case (update the state with a specific 
625+ // Helper function to handle nrhs == 3  case (update the state with a specific 
626626// line state) 
627627void  update_state (const  mxArray  * prhs [], int  nlhs , mxArray  * plhs []) {
628628
@@ -641,8 +641,6 @@ void update_state(const mxArray *prhs[], int nlhs, mxArray *plhs[]) {
641641    debug ("call 3 args" );
642642    add_line_covered (idx , prhs [1 ], line_number );
643643
644-     // free fn pointer after use 
645-     // free(fn); 
646644    debug ("updating state: done, state is now" );
647645    debug_print_state ();
648646}
@@ -659,9 +657,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
659657    }
660658
661659    if  (nrhs  ==  3 ) {
662-         // Update the state for a specific line in a file. 
663-         // Optimization: because `nrhs == 4` is the most frequently used 
664-         // use of this function, this is checked first. 
660+         // Most common case: update the state for a specific line in a file. 
665661        update_state (prhs , nlhs , plhs );
666662    } else  if  (nrhs  ==  1 ) {
667663        // Set the state from a struct s with s.keys and s.line_count 
0 commit comments