[PATCH 5/9] qbsp: Replace new/delete with malloc/free

There's a couple of usages outside of the AllocMem/FreeMem functions. Flag
these as something to look at later.

Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
Tyrann 2006-09-10 17:38:32 +09:30
parent 293efefa26
commit 2dfd647656
3 changed files with 7 additions and 10 deletions

View File

@ -550,8 +550,7 @@ SetKeyValue(int iEntity, char *key, char *value)
for (ep = map.rgEntities[iEntity].epairs; ep; ep = ep->next)
if (!strcmp(ep->key, key)) {
delete ep->value;
free(ep->value); /* FIXME */
ep->value = copystring(value);
return;
}

View File

@ -18,7 +18,8 @@
See file, 'COPYING', for details.
*/
// solidbsp.c
#include <malloc.h>
#include "qbsp.h"
@ -492,7 +493,7 @@ LinkConvexFaces(surface_t *planelist, node_t *leafnode)
// write the list of faces, and free the originals
leaffaces += count;
leafnode->markfaces = (face_t **)new char[sizeof(face_t *) * (count + 1)];
leafnode->markfaces = (face_t **)malloc(sizeof(face_t *) * (count + 1)); /* FIXME */
i = 0;
for (surf = planelist; surf; surf = pnext) {

View File

@ -30,7 +30,7 @@
#endif
#include <stdarg.h>
//#include <malloc.h>
#include <malloc.h>
#include "qbsp.h"
@ -68,7 +68,7 @@ AllocMem(int Type, int cElements, bool fZero)
cSize = cElements * rgcMemSize[Type];
Retry:
pTemp = (void *)new char[cSize];
pTemp = malloc(cSize);
if (pTemp == NULL) {
char ch;
@ -116,13 +116,10 @@ FreeMem
void
FreeMem(void *pMem, int Type, int cElements)
{
char *mem;
rgMemActive[Type] -= cElements;
rgMemActive[GLOBAL] -= cElements * rgcMemSize[Type];
mem = (char *)pMem;
delete [] mem;
free(pMem);
}