From 38548e5ac6ed55ff021d128d7844654f12121309 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 23 Oct 2024 20:09:26 -0400 Subject: [PATCH] Eliminate a few more typedefs --- src/swasynio.c | 2 +- src/swasynio.h | 7 +++++-- src/swconf.c | 15 +++++++-------- src/swconf.h | 5 ++--- src/swsplat.c | 14 +++++++------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/swasynio.c b/src/swasynio.c index ac143f8..e4d315e 100644 --- a/src/swasynio.c +++ b/src/swasynio.c @@ -27,7 +27,7 @@ #define ABORTMSG "\n\n (Ctrl-C to abort)" int asynport = DEFAULT_PORT; -asynmode_t asynmode; +enum asyn_mode asynmode; char asynhost[128]; #define SYNC_IM_PLAYER0 '?' diff --git a/src/swasynio.h b/src/swasynio.h index dc23073..50c025e 100644 --- a/src/swasynio.h +++ b/src/swasynio.h @@ -12,9 +12,12 @@ #ifndef __SWASYNIO_H__ #define __SWASYNIO_H__ -typedef enum { ASYN_LISTEN, ASYN_CONNECT } asynmode_t; +enum asyn_mode { + ASYN_LISTEN, + ASYN_CONNECT, +}; -extern asynmode_t asynmode; +extern enum asyn_mode asynmode; extern char asynhost[128]; extern int asynport; diff --git a/src/swconf.c b/src/swconf.c index bfa50bf..dc07954 100644 --- a/src/swconf.c +++ b/src/swconf.c @@ -58,7 +58,7 @@ static char *GetConfigFilename(void) return result; } -static confoption_t confoptions[] = { +static const struct conf_option confoptions[] = { {"conf_missiles", CONF_BOOL, {&conf_missiles}}, {"conf_solidground", CONF_BOOL, {&conf_solidground}}, {"conf_hudsplats", CONF_BOOL, {&conf_hudsplats}}, @@ -69,8 +69,7 @@ static confoption_t confoptions[] = { {"conf_medals", CONF_BOOL, {&conf_medals}}, {"vid_fullscreen", CONF_BOOL, {&vid_fullscreen}}, {"snd_tinnyfilter", CONF_BOOL, {&snd_tinnyfilter}}, - - {"conf_video_palette", CONF_INT, {&conf_video_palette}}, + {"conf_video_palette", CONF_INT, {&conf_video_palette}}, {"key_accelerate", CONF_KEY, {&keybindings[KEY_ACCEL]}}, {"key_decelerate", CONF_KEY, {&keybindings[KEY_DECEL]}}, @@ -92,7 +91,7 @@ static void Chomp(char *s) } } -static confoption_t *ConfOptionByName(char *name) +static const struct conf_option *ConfOptionByName(char *name) { int i; @@ -109,7 +108,7 @@ static void ParseConfigLine(char *config_file, int lineno, char *line) { char *name, *value, *p; int key; - confoption_t *opt; + const struct conf_option *opt; p = line; Chomp(p); @@ -267,7 +266,7 @@ static const char menukeys[] = "1234567890ABCDEFGHIJKL"; static void ChangeKeyBinding(struct menuitem *item) { - confoption_t *opt; + const struct conf_option *opt; int key; Vid_ClearBuf(); @@ -327,7 +326,7 @@ static void DrawMenu(char *title, struct menuitem *menu) swcolor(3); for (i=0, y=0, keynum=0; menu[i].config_name != NULL; ++i, ++y) { - confoption_t *opt; + const struct conf_option *opt; char *suffix; char buf[40]; int key; @@ -420,7 +419,7 @@ static struct menuitem *MenuItemForKey(struct menuitem *menu, int key) static int RunMenu(char *title, struct menuitem *menu) { struct menuitem *pressed; - confoption_t *opt; + const struct conf_option *opt; int key; for (;;) { diff --git a/src/swconf.h b/src/swconf.h index 17fd061..3abcd87 100644 --- a/src/swconf.h +++ b/src/swconf.h @@ -17,8 +17,7 @@ #ifndef __SWCONF_H__ #define __SWCONF_H__ -typedef struct -{ +struct conf_option { char *name; enum { CONF_BOOL, @@ -30,7 +29,7 @@ typedef struct bool *b; int *i; } value; -} confoption_t; +}; extern void swloadconf(void); extern void swsaveconf(void); diff --git a/src/swsplat.c b/src/swsplat.c index fb4cffc..a5d3557 100644 --- a/src/swsplat.c +++ b/src/swsplat.c @@ -18,16 +18,16 @@ #include "swsplat.h" #include "swsymbol.h" -typedef struct { +struct splat { int x, y; int clr; sopsym_t *sym; -} splat_t; +}; #define MAX_SPLATS 64 static bool oxsplatted = false; -static splat_t splats[MAX_SPLATS]; +static struct splat splats[MAX_SPLATS]; static int num_splats = 0; void swclearsplats(void) @@ -71,10 +71,10 @@ static unsigned long randsd(void) return 0; } -static void AddSplat(splat_t *splat) +static void AddSplat(struct splat *splat) { if (num_splats < MAX_SPLATS) { - memcpy(&splats[num_splats], splat, sizeof(splat_t)); + memcpy(&splats[num_splats], splat, sizeof(struct splat)); ++num_splats; } } @@ -82,7 +82,7 @@ static void AddSplat(splat_t *splat) void swsplatbird(void) { - splat_t splat; + struct splat splat; randsd(); @@ -96,7 +96,7 @@ void swsplatbird(void) void swwindshot(void) { - splat_t splat; + struct splat splat; randsd();