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: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@689 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
7b589b31a6
commit
d7d9ab213b
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 *Z_Strdup (const char *s)
|
||||||
{
|
{
|
||||||
char *ptr = (char *) Z_Malloc (strlen(s) + 1);
|
size_t sz = strlen(s) + 1;
|
||||||
strcpy (ptr, s);
|
char *ptr = (char *) Z_Malloc (sz);
|
||||||
|
memcpy (ptr, s, sz);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,8 +576,9 @@ void *Hunk_TempAlloc (int size)
|
||||||
|
|
||||||
char *Hunk_Strdup (const char *s, const char *name)
|
char *Hunk_Strdup (const char *s, const char *name)
|
||||||
{
|
{
|
||||||
char *ptr = (char *) Hunk_AllocName (strlen(s) + 1, name);
|
size_t sz = strlen(s) + 1;
|
||||||
strcpy (ptr, s);
|
char *ptr = (char *) Hunk_AllocName (sz, name);
|
||||||
|
memcpy (ptr, s, sz);
|
||||||
return ptr;
|
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) );
|
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
|
Cache_Init
|
||||||
|
|
Loading…
Reference in a new issue