ref: 400f9d1930205d350af857cdd1a70f9b0d9ad484
parent: 82257467cbaabfce4db1b4a9f3f349214d3985c6
author: Fabian Greffrath <[email protected]>
date: Mon Jan 20 17:18:07 EST 2020
pass wbstartstruct_t * as const to all the functions which don't change it Thanks @turol for the suggestion.
--- a/src/doom/statdump.c
+++ b/src/doom/statdump.c
@@ -60,7 +60,7 @@
* how to format the level name. Unfortunately, in some cases it is
* impossible to determine whether this is Doom 1 or Doom 2. */
-static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)
+static void DiscoverGamemode(const wbstartstruct_t *stats, int num_stats)
{
int partime;
int level;
@@ -115,7 +115,7 @@
/* Returns the number of players active in the given stats buffer. */
-static int GetNumPlayers(wbstartstruct_t *stats)
+static int GetNumPlayers(const wbstartstruct_t *stats)
{
int i;
int num_players = 0;
@@ -157,10 +157,10 @@
/* Display statistics for a single player. */
-static void PrintPlayerStats(FILE *stream, wbstartstruct_t *stats,
+static void PrintPlayerStats(FILE *stream, const wbstartstruct_t *stats,
int player_num)
{
- wbplayerstruct_t *player = &stats->plyr[player_num];
+ const wbplayerstruct_t *player = &stats->plyr[player_num];
fprintf(stream, "Player %i (%s):\n", player_num + 1,
player_colors[player_num]);
@@ -186,7 +186,7 @@
/* Frags table for multiplayer games. */
-static void PrintFragsTable(FILE *stream, wbstartstruct_t *stats)
+static void PrintFragsTable(FILE *stream, const wbstartstruct_t *stats)
{
int x, y;
@@ -266,7 +266,7 @@
/* Print details of a statistics buffer to the given file. */
-static void PrintStats(FILE *stream, wbstartstruct_t *stats)
+static void PrintStats(FILE *stream, const wbstartstruct_t *stats)
{
short leveltime, partime;
int i;
@@ -296,7 +296,7 @@
fprintf(stream, "\n");
}
-void StatCopy(wbstartstruct_t *stats)
+void StatCopy(const wbstartstruct_t *stats)
{
if (M_ParmExists("-statdump") && num_captured_stats < MAX_CAPTURES)
{
--- a/src/doom/statdump.h
+++ b/src/doom/statdump.h
@@ -17,7 +17,7 @@
#ifndef DOOM_STATDUMP_H
#define DOOM_STATDUMP_H
-void StatCopy(wbstartstruct_t *stats);
+void StatCopy(const wbstartstruct_t *stats);
void StatDump(void);
#endif /* #ifndef DOOM_STATDUMP_H */