mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[quakefs] Clean out some excess memsets
There's no point in zeroing out memory that is only going to be overwritten by the loaded file (excess bytes beyond the end of a massaged text file shouldn't be accessed anyway, and the terminating null is still written).
This commit is contained in:
parent
2086125e0b
commit
fde47d6983
1 changed files with 4 additions and 4 deletions
|
@ -1142,11 +1142,11 @@ QFS_LoadFile (QFile *file, int usehunk)
|
||||||
//base = QFS_FileBase (path);
|
//base = QFS_FileBase (path);
|
||||||
|
|
||||||
if (usehunk == 1)
|
if (usehunk == 1)
|
||||||
buf = Hunk_AllocName (0, len + 1, base);
|
buf = Hunk_RawAllocName (qfs_hunk, len + 1, base);
|
||||||
else if (usehunk == 2)
|
else if (usehunk == 2)
|
||||||
buf = Hunk_TempAlloc (0, len + 1);
|
buf = Hunk_TempAlloc (qfs_hunk, len + 1);
|
||||||
else if (usehunk == 0)
|
else if (usehunk == 0)
|
||||||
buf = calloc (1, len + 1);
|
buf = malloc (len + 1);
|
||||||
else if (usehunk == 3)
|
else if (usehunk == 3)
|
||||||
buf = Cache_Alloc (loadcache, len + 1, base);
|
buf = Cache_Alloc (loadcache, len + 1, base);
|
||||||
else
|
else
|
||||||
|
@ -1156,8 +1156,8 @@ QFS_LoadFile (QFile *file, int usehunk)
|
||||||
Sys_Error ("QFS_LoadFile: not enough space");
|
Sys_Error ("QFS_LoadFile: not enough space");
|
||||||
//Sys_Error ("QFS_LoadFile: not enough space for %s", path);
|
//Sys_Error ("QFS_LoadFile: not enough space for %s", path);
|
||||||
|
|
||||||
|
len = Qread (file, buf, len);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
Qread (file, buf, len);
|
|
||||||
Qclose (file);
|
Qclose (file);
|
||||||
|
|
||||||
free (base);
|
free (base);
|
||||||
|
|
Loading…
Reference in a new issue