From 033c6981d8ca783c4e6039753165e8c4b448fd0f Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 20 Nov 2023 14:59:03 -0500 Subject: [PATCH] some minor files.c cleanup --- src/files.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/files.c b/src/files.c index ae759c503..fcfaceffe 100644 --- a/src/files.c +++ b/src/files.c @@ -1647,11 +1647,7 @@ docompress_file(const char *filename, boolean uncomp) void nh_compress(const char *filename UNUSED_if_not_COMPRESS) { -#if !defined(COMPRESS) && !defined(ZLIB_COMP) -#ifdef PRAGMA_UNUSED -#pragma unused(filename) -#endif -#else +#if defined(COMPRESS) || defined(ZLIB_COMP) docompress_file(filename, FALSE); #endif } @@ -1660,11 +1656,7 @@ nh_compress(const char *filename UNUSED_if_not_COMPRESS) void nh_uncompress(const char *filename UNUSED_if_not_COMPRESS) { -#if !defined(COMPRESS) && !defined(ZLIB_COMP) -#ifdef PRAGMA_UNUSED -#pragma unused(filename) -#endif -#else +#if defined(COMPRESS) || defined(ZLIB_COMP) docompress_file(filename, TRUE); #endif } @@ -1825,6 +1817,8 @@ docompress_file(const char *filename, boolean uncomp) } #endif /* RLC 09 Mar 1999: End ZLIB patch */ +#undef UNUSED_if_not_COMPRESS + /* ---------- END FILE COMPRESSION HANDLING ----------- */ /* ---------- BEGIN FILE LOCKING HANDLING ----------- */ @@ -1842,9 +1836,18 @@ struct flock sflock; /* for unlocking, same as above */ #define HUP #endif + +#if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(WIN32) \ + || defined(MSDOS) +#define UNUSED_conditional /*empty*/ +#else +#define UNUSED_conditional UNUSED +#endif + + #ifndef USE_FCNTL static char * -make_lockname(const char *filename, char *lockname) +make_lockname(const char *filename UNUSED_conditional, char *lockname) { #if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(WIN32) \ || defined(MSDOS) @@ -1867,9 +1870,6 @@ make_lockname(const char *filename, char *lockname) #endif return lockname; #else /* !(UNIX || VMS || AMIGA || WIN32 || MSDOS) */ -#ifdef PRAGMA_UNUSED -#pragma unused(filename) -#endif lockname[0] = '\0'; return (char *) 0; #endif @@ -1878,12 +1878,9 @@ make_lockname(const char *filename, char *lockname) /* lock a file */ boolean -lock_file(const char *filename, int whichprefix, int retryct) +lock_file(const char *filename, int whichprefix, + int retryct UNUSED_conditional) { -#if defined(PRAGMA_UNUSED) && !(defined(UNIX) || defined(VMS)) \ - && !(defined(AMIGA) || defined(WIN32) || defined(MSDOS)) -#pragma unused(retryct) -#endif #ifndef USE_FCNTL char locknambuf[BUFSZ]; const char *lockname; @@ -2082,6 +2079,8 @@ unlock_file(const char *filename) gn.nesting--; } +#undef UNUSED_conditional + /* ---------- END FILE LOCKING HANDLING ----------- */ /* ---------- BEGIN CONFIG FILE HANDLING ----------- */ @@ -4031,9 +4030,6 @@ read_sym_file(int which_set) void check_recordfile(const char *dir UNUSED_if_not_OS2_CODEVIEW) { -#if defined(PRAGMA_UNUSED) && !defined(OS2_CODEVIEW) -#pragma unused(dir) -#endif const char *fq_record; int fd; @@ -4136,6 +4132,8 @@ check_recordfile(const char *dir UNUSED_if_not_OS2_CODEVIEW) #endif /* MICRO || WIN32*/ } +#undef UNUSED_if_not_OS2_CODEVIEW + /* ---------- END SCOREBOARD CREATION ----------- */ /* ---------- BEGIN PANIC/IMPOSSIBLE/TESTING LOG ----------- */