[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:
parent
293efefa26
commit
2dfd647656
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue