diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-03-14 09:40:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-03-14 09:40:44 -0300 |
commit | 1a1b2f3d7f321dd6f28118c985986940b189c635 (patch) | |
tree | 14cffeb82724b5673ded4e9a3c5bde7f53e065d3 | |
parent | f5f3df3bd17fb3489bbd26ab39fe1580a8dbf9c9 (diff) | |
download | lua-1a1b2f3d7f321dd6f28118c985986940b189c635.tar.gz lua-1a1b2f3d7f321dd6f28118c985986940b189c635.tar.bz2 lua-1a1b2f3d7f321dd6f28118c985986940b189c635.zip |
added 'return' to calls to 'luaL_error' (to signal to the compiler
that the function cannot continue past that call)
-rw-r--r-- | loslib.c | 8 | ||||
-rw-r--r-- | lstrlib.c | 8 | ||||
-rw-r--r-- | lutf8lib.c | 4 |
3 files changed, 11 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.64 2016/04/18 13:06:55 roberto Exp $ | 2 | ** $Id: loslib.c,v 1.65 2016/07/18 17:58:58 roberto Exp roberto $ |
3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -293,7 +293,8 @@ static int os_date (lua_State *L) { | |||
293 | else | 293 | else |
294 | stm = l_localtime(&t, &tmr); | 294 | stm = l_localtime(&t, &tmr); |
295 | if (stm == NULL) /* invalid date? */ | 295 | if (stm == NULL) /* invalid date? */ |
296 | luaL_error(L, "time result cannot be represented in this installation"); | 296 | return luaL_error(L, |
297 | "time result cannot be represented in this installation"); | ||
297 | if (strcmp(s, "*t") == 0) { | 298 | if (strcmp(s, "*t") == 0) { |
298 | lua_createtable(L, 0, 9); /* 9 = number of fields */ | 299 | lua_createtable(L, 0, 9); /* 9 = number of fields */ |
299 | setallfields(L, stm); | 300 | setallfields(L, stm); |
@@ -340,7 +341,8 @@ static int os_time (lua_State *L) { | |||
340 | setallfields(L, &ts); /* update fields with normalized values */ | 341 | setallfields(L, &ts); /* update fields with normalized values */ |
341 | } | 342 | } |
342 | if (t != (time_t)(l_timet)t || t == (time_t)(-1)) | 343 | if (t != (time_t)(l_timet)t || t == (time_t)(-1)) |
343 | luaL_error(L, "time result cannot be represented in this installation"); | 344 | return luaL_error(L, |
345 | "time result cannot be represented in this installation"); | ||
344 | l_pushtime(L, t); | 346 | l_pushtime(L, t); |
345 | return 1; | 347 | return 1; |
346 | } | 348 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.253 2016/12/20 18:37:00 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.254 2016/12/22 13:08:50 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -879,7 +879,7 @@ static int lua_number2strx (lua_State *L, char *buff, int sz, | |||
879 | buff[i] = toupper(uchar(buff[i])); | 879 | buff[i] = toupper(uchar(buff[i])); |
880 | } | 880 | } |
881 | else if (fmt[SIZELENMOD] != 'a') | 881 | else if (fmt[SIZELENMOD] != 'a') |
882 | luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); | 882 | return luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); |
883 | return n; | 883 | return n; |
884 | } | 884 | } |
885 | 885 | ||
@@ -1199,8 +1199,8 @@ static int getnum (const char **fmt, int df) { | |||
1199 | static int getnumlimit (Header *h, const char **fmt, int df) { | 1199 | static int getnumlimit (Header *h, const char **fmt, int df) { |
1200 | int sz = getnum(fmt, df); | 1200 | int sz = getnum(fmt, df); |
1201 | if (sz > MAXINTSIZE || sz <= 0) | 1201 | if (sz > MAXINTSIZE || sz <= 0) |
1202 | luaL_error(h->L, "integral size (%d) out of limits [1,%d]", | 1202 | return luaL_error(h->L, "integral size (%d) out of limits [1,%d]", |
1203 | sz, MAXINTSIZE); | 1203 | sz, MAXINTSIZE); |
1204 | return sz; | 1204 | return sz; |
1205 | } | 1205 | } |
1206 | 1206 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lutf8lib.c,v 1.15 2015/03/28 19:16:55 roberto Exp roberto $ | 2 | ** $Id: lutf8lib.c,v 1.16 2016/12/22 13:08:50 roberto Exp roberto $ |
3 | ** Standard library for UTF-8 manipulation | 3 | ** Standard library for UTF-8 manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -171,7 +171,7 @@ static int byteoffset (lua_State *L) { | |||
171 | } | 171 | } |
172 | else { | 172 | else { |
173 | if (iscont(s + posi)) | 173 | if (iscont(s + posi)) |
174 | luaL_error(L, "initial position is a continuation byte"); | 174 | return luaL_error(L, "initial position is a continuation byte"); |
175 | if (n < 0) { | 175 | if (n < 0) { |
176 | while (n < 0 && posi > 0) { /* move back */ | 176 | while (n < 0 && posi > 0) { /* move back */ |
177 | do { /* find beginning of previous character */ | 177 | do { /* find beginning of previous character */ |