detail (avoiding warnings)

This commit is contained in:
Roberto Ierusalimschy 2013-03-19 10:19:12 -03:00
parent 76492b4bb2
commit e3a7104b40
1 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lbitlib.c,v 1.16 2011/06/20 16:35:23 roberto Exp roberto $ ** $Id: lbitlib.c,v 1.17 2013/02/21 13:44:53 roberto Exp roberto $
** Standard library for bitwise operations ** Standard library for bitwise operations
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -147,7 +147,9 @@ static int b_rrot (lua_State *L) {
/* /*
** get field and width arguments for field-manipulation functions, ** get field and width arguments for field-manipulation functions,
** checking whether they are valid ** checking whether they are valid.
** ('luaL_error' called without 'return' to avoid later warnings about
** 'width' being used uninitialized.)
*/ */
static int fieldargs (lua_State *L, int farg, int *width) { static int fieldargs (lua_State *L, int farg, int *width) {
int f = luaL_checkint(L, farg); int f = luaL_checkint(L, farg);
@ -155,7 +157,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 <= f, farg, "field cannot be negative");
luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
if (f + w > LUA_NBITS) if (f + w > LUA_NBITS)
return luaL_error(L, "trying to access non-existent bits"); luaL_error(L, "trying to access non-existent bits");
*width = w; *width = w;
return f; return f;
} }