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:
Ozkan Sezer 2012-06-25 14:50:17 +00:00
parent 7b589b31a6
commit d7d9ab213b

View file

@ -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