Skip to content

Commit 50ce00d

Browse files
committed
Minor cleanup of system files
1 parent def40f4 commit 50ce00d

File tree

6 files changed

+12
-178
lines changed

6 files changed

+12
-178
lines changed

Xbox/i_xbox.cpp

+12-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Emacs style mode select -*- C++ -*-
1+
// Emacs style mode select -*- C++ -*-
22
//-----------------------------------------------------------------------------
33
//
44
// $Id$
@@ -83,7 +83,7 @@ typedef struct {
8383

8484
#define INVALID_FILE_ATTRIBUTES -1
8585

86-
typedef struct _STRING
86+
typedef struct _STRING
8787
{
8888
USHORT Length;
8989
USHORT MaximumLength;
@@ -108,7 +108,7 @@ static char *LauncherXBE = NULL;
108108
static bool Xbox_RROD = false; // Novelty - Red Ring of DOOM!
109109

110110
//
111-
// xbox_Getenv
111+
// xbox_Getenv
112112
// Environment variables don't exist on Xbox. Return NULL.
113113
//
114114
char *xbox_Getenv(const char *)
@@ -117,7 +117,7 @@ char *xbox_Getenv(const char *)
117117
}
118118

119119
//
120-
// xbox_Putenv
120+
// xbox_Putenv
121121
//
122122
// Environment variables don't exist on Xbox. Just return success.
123123
//
@@ -127,7 +127,7 @@ int xbox_Putenv(const char *)
127127
}
128128

129129
//
130-
// xbox_GetCWD
130+
// xbox_GetCWD
131131
//
132132
// Return working directory which is always D:\
133133
//
@@ -177,7 +177,7 @@ struct hostent *xbox_GetHostByName(const char *name)
177177
WSAEVENT hEvent;
178178
XNDNS *pDns = NULL;
179179
INT err;
180-
180+
181181
if(!name)
182182
return NULL;
183183

@@ -243,7 +243,7 @@ int xbox_GetHostname(char *name, int namelen)
243243
}
244244
else
245245
errno = EFAULT;
246-
246+
247247
return -1;
248248
}
249249

@@ -252,7 +252,6 @@ int xbox_GetHostname(char *name, int namelen)
252252
//
253253
void xbox_PrintMemoryDebug()
254254
{
255-
extern size_t got_heapsize;
256255
MEMORYSTATUS stat;
257256
static DWORD lastmem = 0;
258257
char buf[100];
@@ -265,14 +264,10 @@ void xbox_PrintMemoryDebug()
265264
sprintf(buf, "\nMemory Debug:\n");
266265
OutputDebugString( buf );
267266

268-
sprintf(buf, "Heap Size: \t%4d MB\n", got_heapsize);
269-
OutputDebugString( buf );
270-
271-
272267
sprintf(buf, "Total Physical Memory: \t%4d bytes / %4d MB\n", stat.dwTotalPhys, I_BytesToMegabytes(stat.dwTotalPhys));
273268
OutputDebugString( buf );
274269

275-
sprintf(buf, "Used Physical Memory : \t%4d bytes / %4d MB\n", stat.dwTotalPhys - stat.dwAvailPhys,
270+
sprintf(buf, "Used Physical Memory : \t%4d bytes / %4d MB\n", stat.dwTotalPhys - stat.dwAvailPhys,
276271
I_BytesToMegabytes(stat.dwTotalPhys - stat.dwAvailPhys));
277272
OutputDebugString( buf );
278273

@@ -321,7 +316,7 @@ LONG xbox_UnMountDevice(LPSTR sSymbolicLinkName)
321316
//
322317
// xbox_MountPartitions
323318
//
324-
// Some of these partitions are automatically mounted but just
319+
// Some of these partitions are automatically mounted but just
325320
// to be on the safe side the mount will be attempted anyway
326321
//
327322
// Some of these partitions are only found on some modded consoles.
@@ -486,7 +481,7 @@ void xbox_RecordLauncherXBE(char *szLauncherXBE, DWORD dwID)
486481
}
487482

488483
//
489-
// xbox_reboot
484+
// xbox_reboot
490485
//
491486
// Exit Odamex and perform a warm reboot (no startup logo) to a launcher or dashboard
492487
//
@@ -520,7 +515,7 @@ void xbox_Reboot()
520515
}
521516

522517
//
523-
// xbox_AtExit
518+
// xbox_AtExit
524519
//
525520
// Custom atexit function for Xbox
526521
//
@@ -603,7 +598,7 @@ void __cdecl main()
603598
if(XGetLaunchInfo (&launchDataType, &launchData) == ERROR_SUCCESS)
604599
{
605600
// Command line from debugger
606-
if(launchDataType == LDT_FROM_DEBUGGER_CMDLINE)
601+
if(launchDataType == LDT_FROM_DEBUGGER_CMDLINE)
607602
xbox_PrepareArgs((char*)((PLD_FROM_DEBUGGER_CMDLINE)&launchData)->szCmdLine, xargv, xargc);
608603
// Command line from homebrew dashboards (XBMC, etc.)
609604
else if(launchDataType == LDT_TITLE && ((PCUSTOM_LAUNCH_DATA)&launchData)->magic == CUSTOM_LAUNCH_MAGIC)

client/sdl/i_system.cpp

-57
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,6 @@ ticcmd_t *I_BaseTiccmd(void)
120120
return &emptycmd;
121121
}
122122

123-
/* [Russell] - Modified to accomodate a minimal allowable heap size */
124-
// These values are in megabytes
125-
#if defined(GCONSOLE) && !defined(__SWITCH__)
126-
size_t def_heapsize = 16;
127-
#else
128-
size_t def_heapsize = 128;
129-
#endif
130-
constexpr size_t min_heapsize = 8;
131-
132-
// The size we got back from I_ZoneBase in megabytes
133-
size_t got_heapsize = 0;
134-
135123
DWORD LanguageIDs[4];
136124

137125
// Endoom screen is showing
@@ -158,51 +146,6 @@ size_t I_BytesToMegabytes (size_t Bytes)
158146
return (Bytes/1024/1024);
159147
}
160148

161-
//
162-
// I_ZoneBase
163-
//
164-
// Allocates a portion of system memory for the Zone Memory Allocator, returns
165-
// the 'size' of what it could allocate in its parameter
166-
void *I_ZoneBase (size_t *size)
167-
{
168-
void *zone = NULL;
169-
170-
// User wanted a different default size
171-
const char *p = Args.CheckValue ("-heapsize");
172-
173-
if (p)
174-
def_heapsize = atoi(p);
175-
176-
if (def_heapsize < min_heapsize)
177-
def_heapsize = min_heapsize;
178-
179-
// Set the size
180-
*size = I_MegabytesToBytes(def_heapsize);
181-
182-
// Allocate the def_heapsize, otherwise try to allocate a smaller amount
183-
while ((zone == NULL) && (*size >= I_MegabytesToBytes(min_heapsize)))
184-
{
185-
zone = malloc (*size);
186-
187-
if (zone != NULL)
188-
break;
189-
190-
*size -= I_MegabytesToBytes(1);
191-
}
192-
193-
// Our heap size we received
194-
got_heapsize = I_BytesToMegabytes(*size);
195-
196-
// Die if the system has insufficient memory
197-
if (got_heapsize < min_heapsize)
198-
I_FatalError("I_ZoneBase: Insufficient memory available! Minimum size "
199-
"is %lu MB but got %lu MB instead",
200-
min_heapsize,
201-
got_heapsize);
202-
203-
return zone;
204-
}
205-
206149
void I_BeginRead()
207150
{
208151
if (r_loadicon)

client/src/d_main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@
9494
#include "i_xbox.h"
9595
#endif
9696

97-
extern size_t got_heapsize;
98-
9997
void D_CheckNetGame();
10098
void D_ProcessEvents();
10199
void D_DoAdvanceDemo();

server/src/d_main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ EXTERN_CVAR (sv_nomonsters)
7575
EXTERN_CVAR (sv_monstersrespawn)
7676
EXTERN_CVAR (sv_fastmonsters)
7777

78-
extern size_t got_heapsize;
79-
8078
void C_DoCommand(const char *cmd, uint32_t key = 0);
8179

8280
#ifdef UNIX

server/src/i_system.cpp

-53
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ ticcmd_t *I_BaseTiccmd(void)
7575
return &emptycmd;
7676
}
7777

78-
/* [Russell] - Modified to accomodate a minimal allowable heap size */
79-
// These values are in megabytes
80-
size_t def_heapsize = 64;
81-
const size_t min_heapsize = 8;
82-
83-
// The size we got back from I_ZoneBase in megabytes
84-
size_t got_heapsize = 0;
85-
8678
DWORD LanguageIDs[4];
8779

8880
//
@@ -106,51 +98,6 @@ size_t I_BytesToMegabytes (size_t Bytes)
10698
return (Bytes/1024/1024);
10799
}
108100

109-
//
110-
// I_ZoneBase
111-
//
112-
// Allocates a portion of system memory for the Zone Memory Allocator, returns
113-
// the 'size' of what it could allocate in its parameter
114-
void *I_ZoneBase (size_t *size)
115-
{
116-
void *zone = NULL;
117-
118-
// User wanted a different default size
119-
const char *p = Args.CheckValue ("-heapsize");
120-
121-
if (p)
122-
def_heapsize = atoi(p);
123-
124-
if (def_heapsize < min_heapsize)
125-
def_heapsize = min_heapsize;
126-
127-
// Set the size
128-
*size = I_MegabytesToBytes(def_heapsize);
129-
130-
// Allocate the def_heapsize, otherwise try to allocate a smaller amount
131-
while ((zone == NULL) && (*size >= I_MegabytesToBytes(min_heapsize)))
132-
{
133-
zone = malloc (*size);
134-
135-
if (zone != NULL)
136-
break;
137-
138-
*size -= I_MegabytesToBytes(1);
139-
}
140-
141-
// Our heap size we received
142-
got_heapsize = I_BytesToMegabytes(*size);
143-
144-
// Die if the system has insufficient memory
145-
if (got_heapsize < min_heapsize)
146-
I_FatalError("I_ZoneBase: Insufficient memory available! Minimum size "
147-
"is %lu MB but got %lu MB instead",
148-
min_heapsize,
149-
got_heapsize);
150-
151-
return zone;
152-
}
153-
154101
void I_BeginRead(void)
155102
{
156103
}

tests/unit-tests/src/i_system.cpp

-47
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ ticcmd_t *I_BaseTiccmd(void)
7474
return &emptycmd;
7575
}
7676

77-
/* [Russell] - Modified to accomodate a minimal allowable heap size */
78-
// These values are in megabytes
79-
size_t def_heapsize = 64;
80-
const size_t min_heapsize = 8;
81-
82-
// The size we got back from I_ZoneBase in megabytes
83-
size_t got_heapsize = 0;
84-
8577
DWORD LanguageIDs[4];
8678

8779
//
@@ -105,45 +97,6 @@ size_t I_BytesToMegabytes (size_t Bytes)
10597
return (Bytes/1024/1024);
10698
}
10799

108-
//
109-
// I_ZoneBase
110-
//
111-
// Allocates a portion of system memory for the Zone Memory Allocator, returns
112-
// the 'size' of what it could allocate in its parameter
113-
void *I_ZoneBase (size_t *size)
114-
{
115-
void *zone = NULL;
116-
117-
if (def_heapsize < min_heapsize)
118-
def_heapsize = min_heapsize;
119-
120-
// Set the size
121-
*size = I_MegabytesToBytes(def_heapsize);
122-
123-
// Allocate the def_heapsize, otherwise try to allocate a smaller amount
124-
while ((zone == NULL) && (*size >= I_MegabytesToBytes(min_heapsize)))
125-
{
126-
zone = malloc (*size);
127-
128-
if (zone != NULL)
129-
break;
130-
131-
*size -= I_MegabytesToBytes(1);
132-
}
133-
134-
// Our heap size we received
135-
got_heapsize = I_BytesToMegabytes(*size);
136-
137-
// Die if the system has insufficient memory
138-
if (got_heapsize < min_heapsize)
139-
I_FatalError("I_ZoneBase: Insufficient memory available! Minimum size "
140-
"is %lu MB but got %lu MB instead",
141-
min_heapsize,
142-
got_heapsize);
143-
144-
return zone;
145-
}
146-
147100
void I_BeginRead(void)
148101
{
149102
}

0 commit comments

Comments
 (0)