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[] = {
47
47
/* External API */
48
48
49
49
void 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 );
53
55
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 ;
57
59
58
- laco_dispatch (line_commands , laco , command , arguments );
60
+ laco_dispatch (line_commands , laco , command , arguments );
59
61
60
- free (command_line );
61
- free (command_words );
62
+ free (command_line );
63
+ free (command_words );
62
64
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' ;
66
67
}
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ int laco_get_laco_status(LacoState* laco) {
76
76
}
77
77
78
78
void 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 ;
82
82
}
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) {
47
47
48
48
char * * laco_split_by (const char split_with , char * string ,
49
49
int ignore_repeats ) {
50
- if (string == NULL ) return NULL ;
50
+ assert (string != NULL );
51
51
52
52
char * * result = calloc (16 , sizeof (char * ));
53
53
size_t i = 0 ;
You can’t perform that action at this time.
0 commit comments