From 2c3df78de06ee2adc3bd4b04be3c8baf178a121e Mon Sep 17 00:00:00 2001 From: Takahiro Ueda Date: Sat, 10 Jan 2026 14:31:50 +0900 Subject: [PATCH] refactor: remove legacy pre-C89 code --- sources/evaluate.c | 1 - sources/form3.h | 3 --- sources/ftypes.h | 13 ------------- sources/message.c | 13 +------------ sources/sch.c | 18 ------------------ sources/structs.h | 5 ----- sources/tools.c | 13 ++----------- 7 files changed, 3 insertions(+), 63 deletions(-) diff --git a/sources/evaluate.c b/sources/evaluate.c index 936a4f40..ad4583a5 100644 --- a/sources/evaluate.c +++ b/sources/evaluate.c @@ -3,7 +3,6 @@ */ #include "form3.h" -#include #include #include diff --git a/sources/form3.h b/sources/form3.h index 224c6cc0..4209261b 100644 --- a/sources/form3.h +++ b/sources/form3.h @@ -292,16 +292,13 @@ template struct calc { #include #include #include -#ifdef ANSI #include #include -#endif #ifdef WINDOWS #include "fwin.h" #endif #ifdef UNIX #include -#include #include #include #include "unix.h" diff --git a/sources/ftypes.h b/sources/ftypes.h index b3b354a4..56814126 100644 --- a/sources/ftypes.h +++ b/sources/ftypes.h @@ -168,24 +168,11 @@ The typedefs are to allow the compilers to do better error checking. */ -#ifdef ANSI typedef void (*PVFUNWP)(WORD *); -#ifdef INTELCOMPILER -typedef void (*PVFUNV)(); -typedef int (*CFUN)(); -#else typedef void (*PVFUNV)(void); typedef int (*CFUN)(void); -#endif typedef int (*TFUN)(UBYTE *); typedef int (*TFUN1)(UBYTE *,int); -#else -typedef void (*PVFUNWP)(); -typedef void (*PVFUNV)(); -typedef int (*CFUN)(); -typedef int (*TFUN)(); -typedef int (*TFUN1)(); -#endif #define NOAUTO 0 diff --git a/sources/message.c b/sources/message.c index bb28e44b..982335c3 100644 --- a/sources/message.c +++ b/sources/message.c @@ -133,13 +133,7 @@ int MesWork(void) the tabulator in the print "" statement. */ -int -#ifdef ANSI -MesPrint(const char *fmt, ... ) -#else -MesPrint(va_alist) -va_dcl -#endif +int MesPrint(const char *fmt, ... ) { GETIDENTITY char Out[MAXLINELENGTH+14], *stopper, *t, *s, *u, c, *carray; @@ -152,13 +146,8 @@ va_dcl LONG (*OldWrite)(int handle, UBYTE *buffer, LONG size) = WriteFile; /*:[19apr2004 mt]*/ va_list ap; -#ifdef ANSI va_start(ap,fmt); s = (char *)fmt; -#else - va_start(ap); - s = va_arg(ap,char *); -#endif #ifdef WITHMPI /* * On slaves, if AS.printflag is diff --git a/sources/sch.c b/sources/sch.c index 7a66fe69..1bfcc953 100644 --- a/sources/sch.c +++ b/sources/sch.c @@ -35,24 +35,6 @@ #include "form3.h" -#ifdef ANSI -#include -#else -#ifdef mBSD -#include -#else -#ifdef VMS -#include -#else -typedef UBYTE *va_list; -#define va_dcl int va_alist; -#define va_start(list) list = (UBYTE *) &va_alist -#define va_end(list) -#define va_arg(list,mode) (((mode *)(list += sizeof(mode)))[-1]) -#endif -#endif -#endif - static int startinline = 0; static char fcontchar = '&'; static int noextralinefeed = 0; diff --git a/sources/structs.h b/sources/structs.h index 32ad3416..abf16256 100644 --- a/sources/structs.h +++ b/sources/structs.h @@ -2497,13 +2497,8 @@ typedef struct AllGlobals { #define BHEAD0 #endif -#ifdef ANSI typedef int (*WCN)(PHEAD WORD *,WORD *,WORD,WORD); typedef int (*WCN2)(PHEAD WORD *,WORD *); -#else -typedef int (*WCN)(); -typedef int (*WCN2)(); -#endif typedef WORD (*COMPARE)(PHEAD WORD *,WORD *,WORD); diff --git a/sources/tools.c b/sources/tools.c index 3af8b1e5..6cc4b6ca 100644 --- a/sources/tools.c +++ b/sources/tools.c @@ -2081,29 +2081,20 @@ char *LongLongCopy(off_t *y, char *to) Routine produces a string with the date and time of the run */ -#ifdef ANSI -#else -#ifdef mBSD +#if defined(ANSI) || defined(mBSD) #else static char notime[] = ""; #endif -#endif UBYTE *MakeDate(void) { -#ifdef ANSI - time_t tp; - time(&tp); - return((UBYTE *)ctime(&tp)); -#else -#ifdef mBSD +#if defined(ANSI) || defined(mBSD) time_t tp; time(&tp); return((UBYTE *)ctime(&tp)); #else return((UBYTE *)notime); #endif -#endif } /*