@@ -12,6 +12,8 @@ static const char* help_matches[] = {"help", "?", NULL};
1212static const char * debug_info_matches [] = {"info" , NULL };
1313
1414static void handle_quit (struct LacoState * laco , const char * * arguments ) {
15+ assert (laco != NULL );
16+
1517 laco_kill (laco , 0 , "Exiting laco..." );
1618}
1719
@@ -26,6 +28,9 @@ static void handle_help(struct LacoState* laco, const char** arguments) {
2628
2729static void handle_debug_info (struct LacoState * laco ,
2830 const char * * arguments ) {
31+ assert (laco != NULL );
32+ assert (arguments != NULL );
33+
2934 laco_print_debug_info (laco , arguments [0 ]);
3035}
3136
@@ -42,20 +47,21 @@ static const LacoCommand line_commands[] = {
4247/* External API */
4348
4449void laco_handle_command (struct LacoState * laco , char * line ) {
45- if (laco != NULL && line != NULL ) {
46- char * command_line = strdup (line + 1 );
47- char * * command_words = laco_line_to_words (command_line );
50+ assert (laco != NULL );
51+ assert (line != NULL );
52+
53+ char * command_line = strdup (line + 1 );
54+ char * * command_words = laco_line_to_words (command_line );
4855
49- /* Alias for parsed out words within the line */
50- const char * command = command_words [0 ];
51- const char * * arguments = (const char * * ) command_words + 1 ;
56+ /* Alias for parsed out words within the line */
57+ const char * command = command_words [0 ];
58+ const char * * arguments = (const char * * ) command_words + 1 ;
5259
53- laco_dispatch (line_commands , laco , command , arguments );
60+ laco_dispatch (line_commands , laco , command , arguments );
5461
55- free (command_line );
56- free (command_words );
62+ free (command_line );
63+ free (command_words );
5764
58- /* Make it seems like this was an empty line */
59- line [0 ] = '\0' ;
60- }
65+ /* Make it seems like this was an empty line */
66+ line [0 ] = '\0' ;
6167}
0 commit comments