]> granicus.if.org Git - nethack/commitdiff
Silence some -Wunused-but-set-variable warnings
authorMichael Meyer <me@entrez.cc>
Sat, 16 Jul 2022 04:15:29 +0000 (00:15 -0400)
committerMichael Meyer <me@entrez.cc>
Sat, 16 Jul 2022 04:15:29 +0000 (00:15 -0400)
If NH_DEVEL_STATUS was set to NH_STATUS_RELEASED or NetHack was compiled
without DEBUG defined, the 'vlen' variable in a couple pline.c functions
wasn't used.  This could trigger compiler warnings.

src/pline.c

index 24dcc49a89577ac7096a8866f65f348dc8533252..2c2f7bf624c7173d13f777fa46ddf101fa2e8db3 100644 (file)
@@ -120,6 +120,8 @@ vpline(const char *line, va_list the_args)
         if (vlen >= (int) sizeof pbuf)
             panic("%s: truncation of buffer at %zu of %d bytes",
                   "pline", sizeof pbuf, vlen);
+#else
+        nhUse(vlen);
 #endif
 #else
         Vsprintf(pbuf, line, the_args);
@@ -618,6 +620,8 @@ vconfig_error_add(const char *str, va_list the_args)
     if (vlen >= (int) sizeof buf)
         panic("%s: truncation of buffer at %zu of %d bytes",
               "config_error_add", sizeof buf, vlen);
+#else
+    nhUse(vlen);
 #endif
 #else
     Vsprintf(buf, str, the_args);