1313
1414/* Check if line is incomplete */
1515static bool incomplete (lua_State * L , int status ) {
16+ assert (L != NULL );
17+
1618 size_t lmess ;
1719 size_t eof_size ;
1820 const char * mess ;
@@ -38,6 +40,8 @@ static bool incomplete(lua_State* L, int status) {
3840
3941/* Check if line can be printed */
4042static bool is_printable (lua_State * L , int status ) {
43+ assert (L != NULL );
44+
4145 const char * mess ;
4246 const char * literal ;
4347 const char * func ;
@@ -82,6 +86,9 @@ static bool is_printable(lua_State* L, int status) {
8286}
8387
8488static char * get_line (LacoState * laco , const char * prompt ) {
89+ assert (laco != NULL );
90+ assert (prompt != NULL );
91+
8592 char * line = linenoise (prompt );
8693
8794 if (line != NULL ) {
@@ -97,6 +104,8 @@ static char* get_line(LacoState* laco, const char* prompt) {
97104
98105/* Push a line to the stack and store in history */
99106static bool pushline (LacoState * laco , bool isFirstLine ) {
107+ assert (laco != NULL );
108+
100109 const char * prompt = (isFirstLine ) ? "> " : "... " ;
101110 char * line = get_line (laco , prompt );
102111 lua_State * L = laco_get_laco_lua_state (laco );
@@ -115,6 +124,8 @@ static bool pushline(LacoState* laco, bool isFirstLine) {
115124/* External API */
116125
117126bool laco_load_line (LacoState * laco ) {
127+ assert (laco != NULL );
128+
118129 int status = laco_get_laco_status (laco );
119130 lua_State * L = laco_get_laco_lua_state (laco );
120131
@@ -145,6 +156,8 @@ bool laco_load_line(LacoState* laco) {
145156}
146157
147158void laco_handle_line (LacoState * laco ) {
159+ assert (laco != NULL );
160+
148161 int status = laco_get_laco_status (laco );
149162 lua_State * L = laco_get_laco_lua_state (laco );
150163
0 commit comments