]> granicus.if.org Git - nethack/commitdiff
lua 'index'
authorPatR <rankin@nethack.org>
Thu, 19 May 2022 21:40:27 +0000 (14:40 -0700)
committerPatR <rankin@nethack.org>
Thu, 19 May 2022 21:40:27 +0000 (14:40 -0700)
Having the preprocessor rename a variable called 'index' to one
called 'strchr' is not the source of any bugs (in execution; it can
cause pain when trying to ask a debugger to display the value and
then be told no such thing exists).  Change the name to 'indx' to
avoid any confusion.

If we switch to strchr() we should still avoid using 'index' as a
variable name.

src/nhlobj.c

index fa574ea2d21b589c0ab655dc295acdda7a40ef85..cb539060680a03970df497f6ac3cb6012d6fdb17 100644 (file)
@@ -31,12 +31,12 @@ static int l_obj_bury(lua_State *);
 #define lobj_is_ok(lo) ((lo) && (lo)->obj && (lo)->obj->where != OBJ_LUAFREE)
 
 static struct _lua_obj *
-l_obj_check(lua_State *L, int index)
+l_obj_check(lua_State *L, int indx)
 {
     struct _lua_obj *lo;
 
-    luaL_checktype(L, index, LUA_TUSERDATA);
-    lo = (struct _lua_obj *)luaL_checkudata(L, index, "obj");
+    luaL_checktype(L, indx, LUA_TUSERDATA);
+    lo = (struct _lua_obj *) luaL_checkudata(L, indx, "obj");
     if (!lo)
         nhl_error(L, "Obj error");
     return lo;