File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -47,20 +47,21 @@ static const LacoCommand line_commands[] = {
4747/* External API */
4848
4949void laco_handle_command (struct LacoState * laco , char * line ) {
50- if (laco != NULL && line != NULL ) {
51- char * command_line = strdup (line + 1 );
52- 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 );
5355
54- /* Alias for parsed out words within the line */
55- const char * command = command_words [0 ];
56- 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 ;
5759
58- laco_dispatch (line_commands , laco , command , arguments );
60+ laco_dispatch (line_commands , laco , command , arguments );
5961
60- free (command_line );
61- free (command_words );
62+ free (command_line );
63+ free (command_words );
6264
63- /* Make it seems like this was an empty line */
64- line [0 ] = '\0' ;
65- }
65+ /* Make it seems like this was an empty line */
66+ line [0 ] = '\0' ;
6667}
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ int laco_get_laco_status(LacoState* laco) {
7676}
7777
7878void laco_set_laco_status (LacoState * laco , int status ) {
79- if (laco != NULL ) {
80- laco -> status = status ;
81- }
79+ assert (laco != NULL );
80+
81+ laco -> status = status ;
8282}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ bool laco_is_match(const char** matches, const char* test_string) {
4747
4848char * * laco_split_by (const char split_with , char * string ,
4949 int ignore_repeats ) {
50- if (string == NULL ) return NULL ;
50+ assert (string != NULL );
5151
5252 char * * result = calloc (16 , sizeof (char * ));
5353 size_t i = 0 ;
You can’t perform that action at this time.
0 commit comments