From: Pasi Kallinen Date: Fri, 6 Jan 2023 13:53:03 +0000 (+0200) Subject: Remove NO_VSNPRINTF X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=030fc0036a90f353f35be5d4b93c00819b883529;p=nethack Remove NO_VSNPRINTF Affects only ancient VMS where vsnprintf wasn't available. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 7a16576ec..f8a3c53d0 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -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 diff --git a/include/vmsconf.h b/include/vmsconf.h index 00d6afb16..a6a020895 100644 --- a/include/vmsconf.h +++ b/include/vmsconf.h @@ -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. */ diff --git a/src/end.c b/src/end.c index 7f61562f8..3f2f561d2 100644 --- 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); } diff --git a/src/hacklib.c b/src/hacklib.c index 48dca9344..8ba5f9179 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -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", diff --git a/src/mdlib.c b/src/mdlib.c index d85c0dd0a..0524d4fd4 100644 --- a/src/mdlib.c +++ b/src/mdlib.c @@ -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? */ diff --git a/src/pline.c b/src/pline.c index 5eb9bb703..473d06ebb 100644 --- a/src/pline.c +++ b/src/pline.c @@ -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); diff --git a/sys/vms/Install.vms b/sys/vms/Install.vms index 2c16a5e18..753c38732 100644 --- a/sys/vms/Install.vms +++ b/sys/vms/Install.vms @@ -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 diff --git a/win/share/tilemap.c b/win/share/tilemap.c index eb571fac7..67eef6c99 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -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? */