]> granicus.if.org Git - nethack/commitdiff
Remove NO_VSNPRINTF
authorPasi Kallinen <paxed@alt.org>
Fri, 6 Jan 2023 13:53:03 +0000 (15:53 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 6 Jan 2023 13:53:06 +0000 (15:53 +0200)
Affects only ancient VMS where vsnprintf wasn't available.

doc/fixes3-7-0.txt
include/vmsconf.h
src/end.c
src/hacklib.c
src/mdlib.c
src/pline.c
sys/vms/Install.vms
win/share/tilemap.c

index 7a16576ec8133a2c46b479b9548cc3fb018cbe1f..f8a3c53d0e3df8d868aefca992b021ff58ffd86d 100644 (file)
@@ -2214,4 +2214,5 @@ replace some old 'time_t' hackery in system.h and hacklib.c with something
        less obtrusive in unixconf.h
 remove the per dungeon level door limit
 remove various '#if LINT' hacks used to suppress warnings from pre-ANSI 'lint'
+VMS: removed NO_VSNPRINTF conditional code
 
index 00d6afb16e9647589f07076c5d897719622a5d54..a6a0208955a6f0f9377c5e06346b4d359151380b 100644 (file)
@@ -168,11 +168,6 @@ PANICTRACE_GDB=2  #at conclusion of panic, show a call traceback and then
 
 #define FCMASK 0660 /* file creation mask */
 
-/*
- *
- */
-#define NO_VSNPRINTF /* Avoid vsnprintf, use less-safe vsprintf instead. */
-
 /*
  * The remainder of the file should not need to be changed.
  */
index 7f61562f8bd08cb1a66f5057ab6dfaa69a0e6652..3f2f561d2e72bf6fbecfb9a20380c95ab8fb426c 100644 (file)
--- a/src/end.c
+++ b/src/end.c
@@ -656,11 +656,7 @@ panic VA_DECL(const char *, str)
     {
         char buf[BUFSZ];
 
-#if !defined(NO_VSNPRINTF)
         (void) vsnprintf(buf, sizeof buf, str, VA_ARGS);
-#else
-        Vsprintf(buf, str, VA_ARGS);
-#endif
         raw_print(buf);
         paniclog("panic", buf);
     }
index 48dca9344ed6accf61cee515c0a3bc560969db77..8ba5f917972b1de002e9034f03263655dcbf7818 100644 (file)
@@ -1337,11 +1337,7 @@ nh_snprintf(
     int n;
 
     va_start(ap, fmt);
-#ifdef NO_VSNPRINTF
-    n = vsprintf(str, fmt, ap);
-#else
     n = vsnprintf(str, size, fmt, ap);
-#endif
     va_end(ap);
     if (n < 0 || (size_t) n >= size) { /* is there a problem? */
         impossible("snprintf %s: func %s, file line %d",
index d85c0dd0ab56d9507e236bce99e0d177cd48bb82..0524d4fd4e64dd3d5f7c71dfa53eb0a0dc67fd30 100644 (file)
@@ -283,11 +283,7 @@ nh_snprintf(const char *func UNUSED, int line UNUSED, char *str, size_t size,
     int n;
 
     va_start(ap, fmt);
-#ifdef NO_VSNPRINTF
-    n = vsprintf(str, fmt, ap);
-#else
     n = vsnprintf(str, size, fmt, ap);
-#endif
     va_end(ap);
 
     if (n < 0 || (size_t)n >= size) { /* is there a problem? */
index 5eb9bb7035c1883c9d053a79229d3444ca0ce353..473d06ebbb526266d49e2ccc2031323e44d6587c 100644 (file)
@@ -99,9 +99,7 @@ vpline(const char *line, va_list the_args)
     char pbuf[BIGBUFSZ]; /* will get chopped down to BUFSZ-1 if longer */
     int ln;
     int msgtyp;
-#if !defined(NO_VSNPRINTF)
     int vlen = 0;
-#endif
     boolean no_repeat;
 
     if (!line || !*line)
@@ -114,7 +112,6 @@ vpline(const char *line, va_list the_args)
         return;
 
     if (strchr(line, '%')) {
-#if !defined(NO_VSNPRINTF)
         vlen = vsnprintf(pbuf, sizeof(pbuf), line, the_args);
 #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) && defined(DEBUG)
         if (vlen >= (int) sizeof pbuf)
@@ -122,9 +119,6 @@ vpline(const char *line, va_list the_args)
                   "pline", sizeof pbuf, vlen);
 #else
         nhUse(vlen);
-#endif
-#else
-        Vsprintf(pbuf, line, the_args);
 #endif
         line = pbuf;
     }
@@ -476,11 +470,7 @@ vraw_printf(const char *line, va_list the_args)
     char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */
 
     if (strchr(line, '%')) {
-#if !defined(NO_VSNPRINTF)
         (void) vsnprintf(pbuf, sizeof(pbuf), line, the_args);
-#else
-        Vsprintf(pbuf, line, the_args);
-#endif
         line = pbuf;
     }
     if ((int) strlen(line) > BUFSZ - 1) {
@@ -508,11 +498,7 @@ impossible(const char *s, ...)
         panic("impossible called impossible");
 
     gp.program_state.in_impossible = 1;
-#if !defined(NO_VSNPRINTF)
     (void) vsnprintf(pbuf, sizeof(pbuf), s, the_args);
-#else
-    Vsprintf(pbuf, s, the_args);
-#endif
     va_end(the_args);
     pbuf[BUFSZ - 1] = '\0'; /* sanity */
     paniclog("impossible", pbuf);
@@ -609,12 +595,9 @@ config_error_add(const char *str, ...)
 static void
 vconfig_error_add(const char *str, va_list the_args)
 {       /* start of vconf...() or of nested block in USE_OLDARG's conf...() */
-#if !defined(NO_VSNPRINTF)
     int vlen = 0;
-#endif
     char buf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */
 
-#if !defined(NO_VSNPRINTF)
     vlen = vsnprintf(buf, sizeof buf, str, the_args);
 #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) && defined(DEBUG)
     if (vlen >= (int) sizeof buf)
@@ -622,9 +605,6 @@ vconfig_error_add(const char *str, va_list the_args)
               "config_error_add", sizeof buf, vlen);
 #else
     nhUse(vlen);
-#endif
-#else
-    Vsprintf(buf, str, the_args);
 #endif
     buf[BUFSZ - 1] = '\0';
     config_erradd(buf);
index 2c16a5e18810e4130d4e2316e28e0c3ce20012a2..753c38732fafed97841f206741c5c67b1d06755e 100644 (file)
@@ -151,11 +151,7 @@ Notes:
     work with 3.7.0. The scoreboard file (RECORD) from 3.6.x or 3.4.x or
     3.3.x will work.
 
-2.  If pline.c fails to compile, edit vmsconf.h and uncomment
-    #define NO_VSNPRINTF
-    to avoid calling a C library routine that wasn't available on older
-    versions of VMS.  (Note:  in the distributed sources, this has already
-    been uncommented.)
+2.  Ancient C libs will not work; vsnprintf is required.
 
 3.  To specify user-preference options in your environment, define the
     logical name NETHACKOPTIONS to have the value of a quoted string
index eb571fac72707fa5d7e973e2b8d660f4b6031334..67eef6c99529be7c771d2e1d129ccda8f1f98f48 100644 (file)
@@ -1561,11 +1561,7 @@ nh_snprintf(
     int n;
 
     va_start(ap, fmt);
-#ifdef NO_VSNPRINTF
-    n = vsprintf(str, fmt, ap);
-#else
     n = vsnprintf(str, size, fmt, ap);
-#endif
     va_end(ap);
 
     if (n < 0 || (size_t) n >= size) { /* is there a problem? */