diff options
| -rw-r--r-- | lbitlib.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbitlib.c,v 1.16 2011/06/20 16:35:23 roberto Exp roberto $ | 2 | ** $Id: lbitlib.c,v 1.17 2013/02/21 13:44:53 roberto Exp roberto $ |
| 3 | ** Standard library for bitwise operations | 3 | ** Standard library for bitwise operations |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -147,7 +147,9 @@ static int b_rrot (lua_State *L) { | |||
| 147 | 147 | ||
| 148 | /* | 148 | /* |
| 149 | ** get field and width arguments for field-manipulation functions, | 149 | ** get field and width arguments for field-manipulation functions, |
| 150 | ** checking whether they are valid | 150 | ** checking whether they are valid. |
| 151 | ** ('luaL_error' called without 'return' to avoid later warnings about | ||
| 152 | ** 'width' being used uninitialized.) | ||
| 151 | */ | 153 | */ |
| 152 | static int fieldargs (lua_State *L, int farg, int *width) { | 154 | static int fieldargs (lua_State *L, int farg, int *width) { |
| 153 | int f = luaL_checkint(L, farg); | 155 | int f = luaL_checkint(L, farg); |
| @@ -155,7 +157,7 @@ static int fieldargs (lua_State *L, int farg, int *width) { | |||
| 155 | luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); | 157 | luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); |
| 156 | luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); | 158 | luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); |
| 157 | if (f + w > LUA_NBITS) | 159 | if (f + w > LUA_NBITS) |
| 158 | return luaL_error(L, "trying to access non-existent bits"); | 160 | luaL_error(L, "trying to access non-existent bits"); |
| 159 | *width = w; | 161 | *width = w; |
| 160 | return f; | 162 | return f; |
| 161 | } | 163 | } |
