mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
zone.c: Use memcpy() instead of strcpy() in Hunk_Strdup() and Z_Strdup().
Removed dead Cache_Compact() function. Made mainzone static to zone.c. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@689 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
3e9ec5f401
commit
28eb6f0150
1 changed files with 7 additions and 15 deletions
22
Quake/zone.c
22
Quake/zone.c
|
@ -62,7 +62,7 @@ all big things are allocated on the hunk.
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
memzone_t *mainzone;
|
||||
static memzone_t *mainzone;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -246,8 +246,9 @@ void *Z_Realloc(void *ptr, int size)
|
|||
|
||||
char *Z_Strdup (const char *s)
|
||||
{
|
||||
char *ptr = (char *) Z_Malloc (strlen(s) + 1);
|
||||
strcpy (ptr, s);
|
||||
size_t sz = strlen(s) + 1;
|
||||
char *ptr = (char *) Z_Malloc (sz);
|
||||
memcpy (ptr, s, sz);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -575,8 +576,9 @@ void *Hunk_TempAlloc (int size)
|
|||
|
||||
char *Hunk_Strdup (const char *s, const char *name)
|
||||
{
|
||||
char *ptr = (char *) Hunk_AllocName (strlen(s) + 1, name);
|
||||
strcpy (ptr, s);
|
||||
size_t sz = strlen(s) + 1;
|
||||
char *ptr = (char *) Hunk_AllocName (sz, name);
|
||||
memcpy (ptr, s, sz);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -825,16 +827,6 @@ void Cache_Report (void)
|
|||
Con_DPrintf ("%4.1f megabyte data cache\n", (hunk_size - hunk_high_used - hunk_low_used) / (float)(1024*1024) );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cache_Compact
|
||||
|
||||
============
|
||||
*/
|
||||
void Cache_Compact (void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cache_Init
|
||||
|
|
Loading…
Reference in a new issue