浏览代码

added 'return' (when possible) to calls to error functions

Roberto Ierusalimschy 12 年之前
父节点
当前提交
a83ed55f1e
共有 3 个文件被更改,包括 7 次插入6 次删除
  1. 3 2
      lbaselib.c
  2. 2 2
      lbitlib.c
  3. 2 2
      lcorolib.c

+ 3 - 2
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.274 2012/04/27 14:13:19 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.275 2012/12/03 20:18:02 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -336,7 +336,8 @@ static int dofilecont (lua_State *L) {
 static int luaB_dofile (lua_State *L) {
   const char *fname = luaL_optstring(L, 1, NULL);
   lua_settop(L, 1);
-  if (luaL_loadfile(L, fname) != LUA_OK) lua_error(L);
+  if (luaL_loadfile(L, fname) != LUA_OK)
+    return lua_error(L);
   lua_callk(L, 0, LUA_MULTRET, 0, dofilecont);
   return dofilecont(L);
 }

+ 2 - 2
lbitlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbitlib.c,v 1.15 2010/12/17 13:26:38 roberto Exp roberto $
+** $Id: lbitlib.c,v 1.16 2011/06/20 16:35:23 roberto Exp roberto $
 ** Standard library for bitwise operations
 ** See Copyright Notice in lua.h
 */
@@ -155,7 +155,7 @@ static int fieldargs (lua_State *L, int farg, int *width) {
   luaL_argcheck(L, 0 <= f, farg, "field cannot be negative");
   luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
   if (f + w > LUA_NBITS)
-    luaL_error(L, "trying to access non-existent bits");
+    return luaL_error(L, "trying to access non-existent bits");
   *width = w;
   return f;
 }

+ 2 - 2
lcorolib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lcorolib.c,v 1.3 2011/08/23 17:24:34 roberto Exp roberto $
+** $Id: lcorolib.c,v 1.4 2012/04/27 18:59:04 roberto Exp roberto $
 ** Coroutine Library
 ** See Copyright Notice in lua.h
 */
@@ -73,7 +73,7 @@ static int luaB_auxwrap (lua_State *L) {
       lua_insert(L, -2);
       lua_concat(L, 2);
     }
-    lua_error(L);  /* propagate error */
+    return lua_error(L);  /* propagate error */
   }
   return r;
 }