]> granicus.if.org Git - nethack/commitdiff
fix nhlsel.c warning
authorPatR <rankin@nethack.org>
Wed, 26 Feb 2020 00:04:41 +0000 (16:04 -0800)
committerPatR <rankin@nethack.org>
Wed, 26 Feb 2020 00:04:41 +0000 (16:04 -0800)
A recent change has resulted in complaints about 'sel' not being
used in
  struct selectionvar *sel = l_selection_check(L, 1);
  struct selectionvar *ret;
  int p = (int) luaL_checkinteger(L, 2);

  lua_pop(L, 1);
  (void) l_selection_clone(L);
  ret = l_selection_check(L, 1);
  selection_filter_percent(ret, p);

This preserves the semantics of that code while getting rid of the
warning, but I have no idea whether it makes any sense.

src/nhlsel.c

index a0ba7e6271223282c0fdf80ac5dad883f74dea81..62aa326fd4f8003121dde5fec5766f000131ee3d 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 nhlua.c $NHDT-Date: 1581562591 2020/02/13 02:56:31 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */
+/* NetHack 3.7 nhlua.c $NHDT-Date: 1582675449 2020/02/26 00:04:09 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.20 $ */
 /*      Copyright (c) 2018 by Pasi Kallinen */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -298,10 +298,11 @@ static int
 l_selection_filter_percent(L)
 lua_State *L;
 {
-    struct selectionvar *sel = l_selection_check(L, 1);
     struct selectionvar *ret;
-    int p = (int) luaL_checkinteger(L, 2);
+    int p;
 
+    (void) l_selection_check(L, 1);
+    p = (int) luaL_checkinteger(L, 2);
     lua_pop(L, 1);
     (void) l_selection_clone(L);
     ret = l_selection_check(L, 1);