mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Added Xfree() function to accompany the Xmalloc() family of functions and change all uses of Bfree() to Xfree()
This was necessary because everything is already allocated with the Xmalloc() functions, but a future commit will make blocks allocated with those functions no longer compatible with the system implementation of free(), which Bfree() wraps. git-svn-id: https://svn.eduke32.com/eduke32@7705 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/build.cpp # source/build/src/mdsprite.cpp # source/build/src/polymer.cpp # source/build/src/polymost.cpp # source/build/src/texcache.cpp # source/build/src/voxmodel.cpp
This commit is contained in:
parent
dc62b986e8
commit
ccdba037b5
47 changed files with 343 additions and 338 deletions
|
@ -246,7 +246,7 @@ FLAC__StreamDecoderWriteStatus write_flac_stream(const FLAC__StreamDecoder *deco
|
|||
|
||||
if (size > fd->blocksize)
|
||||
{
|
||||
block = (char *)malloc(size);
|
||||
block = (char *)Xmalloc(size);
|
||||
|
||||
if (block == nullptr)
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||
|
@ -279,7 +279,7 @@ FLAC__StreamDecoderWriteStatus write_flac_stream(const FLAC__StreamDecoder *deco
|
|||
char * oldblock = fd->block;
|
||||
fd->block = block;
|
||||
fd->blocksize = size;
|
||||
free(oldblock);
|
||||
Xfree(oldblock);
|
||||
}
|
||||
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
||||
|
@ -436,7 +436,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t length, int32_t loopstart, int32_t loope
|
|||
return MV_Error;
|
||||
}
|
||||
|
||||
fd = (flac_data *)calloc(1, sizeof(flac_data));
|
||||
fd = (flac_data *)Xcalloc(1, sizeof(flac_data));
|
||||
if (!fd)
|
||||
{
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
|
@ -460,7 +460,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t length, int32_t loopstart, int32_t loope
|
|||
/*metadata_flac_stream*/ NULL, error_flac_stream,
|
||||
(void *)fd) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
|
||||
{
|
||||
free(fd);
|
||||
Xfree(fd);
|
||||
MV_Printf("MV_PlayFLAC: %s\n", FLAC__stream_decoder_get_resolved_state_string(fd->stream));
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
return MV_Error;
|
||||
|
@ -472,7 +472,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t length, int32_t loopstart, int32_t loope
|
|||
{
|
||||
FLAC__stream_decoder_finish(fd->stream);
|
||||
FLAC__stream_decoder_delete(fd->stream);
|
||||
free(fd);
|
||||
Xfree(fd);
|
||||
MV_SetErrorCode(MV_NoVoices);
|
||||
return MV_Error;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t length, int32_t loopstart, int32_t loope
|
|||
// FLAC__metadata_chain_delete(metadata_chain);
|
||||
FLAC__stream_decoder_finish(fd->stream);
|
||||
FLAC__stream_decoder_delete(fd->stream);
|
||||
free(fd);
|
||||
Xfree(fd);
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
return MV_Error;
|
||||
}
|
||||
|
@ -654,8 +654,8 @@ void MV_ReleaseFLACVoice(VoiceNode *voice)
|
|||
voice->rawdataptr = 0;
|
||||
if (fd->stream != NULL)
|
||||
{
|
||||
auto stream = fd->stream;
|
||||
fd->stream = nullptr;
|
||||
auto stream = fd->stream;
|
||||
fd->stream = nullptr;
|
||||
FLAC__stream_decoder_finish(stream);
|
||||
FLAC__stream_decoder_delete(stream);
|
||||
}
|
||||
|
@ -663,8 +663,8 @@ void MV_ReleaseFLACVoice(VoiceNode *voice)
|
|||
voice->length = 0;
|
||||
voice->sound = nullptr;
|
||||
fd->block = nullptr;
|
||||
free(block);
|
||||
free(fd);
|
||||
Xfree(block);
|
||||
Xfree(fd);
|
||||
}
|
||||
#else
|
||||
#include "_multivc.h"
|
||||
|
|
|
@ -94,7 +94,7 @@ extern "C" {
|
|||
|
||||
#define LL_Empty(list, next, prev) (((list)->next == (list)) && ((list)->prev == (list)))
|
||||
|
||||
#define LL_Free(list) Bfree(list)
|
||||
#define LL_Free(list) Xfree(list)
|
||||
#define LL_Reset(list, next, prev) (list)->next = (list)->prev = (list)
|
||||
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loo
|
|||
return MV_Error;
|
||||
}
|
||||
|
||||
auto vd = (vorbis_data *)calloc(1, sizeof(vorbis_data));
|
||||
auto vd = (vorbis_data *)Xcalloc(1, sizeof(vorbis_data));
|
||||
|
||||
if (!vd)
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loo
|
|||
|
||||
if (status < 0)
|
||||
{
|
||||
free(vd);
|
||||
Xfree(vd);
|
||||
MV_Printf("MV_PlayVorbis: err %d\n", status);
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
return MV_Error;
|
||||
|
@ -397,7 +397,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loo
|
|||
if (!vi)
|
||||
{
|
||||
ov_clear(&vd->vf);
|
||||
free(vd);
|
||||
Xfree(vd);
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
return MV_Error;
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loo
|
|||
if (vi->channels != 1 && vi->channels != 2)
|
||||
{
|
||||
ov_clear(&vd->vf);
|
||||
free(vd);
|
||||
Xfree(vd);
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
return MV_Error;
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loo
|
|||
if (voice == NULL)
|
||||
{
|
||||
ov_clear(&vd->vf);
|
||||
free(vd);
|
||||
Xfree(vd);
|
||||
MV_SetErrorCode(MV_NoVoices);
|
||||
return MV_Error;
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ void MV_ReleaseVorbisVoice( VoiceNode * voice )
|
|||
voice->length = 0;
|
||||
voice->sound = nullptr;
|
||||
ov_clear(&vd->vf);
|
||||
free(vd);
|
||||
Xfree(vd);
|
||||
}
|
||||
#else
|
||||
#include "_multivc.h"
|
||||
|
|
|
@ -441,7 +441,7 @@ int32_t MV_PlayXA(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend
|
|||
if ( voice == NULL )
|
||||
{
|
||||
|
||||
free(xad);
|
||||
Xfree(xad);
|
||||
MV_SetErrorCode( MV_NoVoices );
|
||||
return MV_Error;
|
||||
}
|
||||
|
@ -486,5 +486,5 @@ void MV_ReleaseXAVoice( VoiceNode * voice )
|
|||
voice->rawdataptr = 0;
|
||||
voice->length = 0;
|
||||
voice->sound = nullptr;
|
||||
free(xad);
|
||||
Xfree(xad);
|
||||
}
|
||||
|
|
|
@ -124,14 +124,14 @@ int32_t MV_PlayXMP(char *ptr, uint32_t length, int32_t loopstart, int32_t loopen
|
|||
|
||||
if ((xmpd->context = xmp_create_context()) == NULL)
|
||||
{
|
||||
free(xmpd);
|
||||
Xfree(xmpd);
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
return MV_Error;
|
||||
}
|
||||
|
||||
if ((retval = xmp_load_module_from_memory(xmpd->context, ptr, length)) != 0)
|
||||
{
|
||||
free(xmpd);
|
||||
Xfree(xmpd);
|
||||
MV_Printf("MV_PlayXMP: xmp_load_module_from_memory failed (%i)\n", retval);
|
||||
MV_SetErrorCode(MV_InvalidFile);
|
||||
return MV_Error;
|
||||
|
@ -143,7 +143,7 @@ int32_t MV_PlayXMP(char *ptr, uint32_t length, int32_t loopstart, int32_t loopen
|
|||
{
|
||||
xmp_release_module(xmpd->context);
|
||||
xmp_free_context(xmpd->context);
|
||||
free(xmpd);
|
||||
Xfree(xmpd);
|
||||
MV_SetErrorCode(MV_NoVoices);
|
||||
return MV_Error;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ void MV_ReleaseXMPVoice(VoiceNode * voice)
|
|||
xmp_end_player(xmpd->context);
|
||||
xmp_release_module(xmpd->context);
|
||||
xmp_free_context(xmpd->context);
|
||||
free(xmpd);
|
||||
Xfree(xmpd);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -915,18 +915,18 @@ static FORCE_INLINE void *Baligned_alloc(const size_t alignment, const size_t si
|
|||
#if defined _WIN32 && !defined NO_ALIGNED_MALLOC
|
||||
# define Baligned_free _aligned_free
|
||||
#else
|
||||
# define Baligned_free Bfree
|
||||
# define Baligned_free Xfree
|
||||
#endif
|
||||
|
||||
|
||||
////////// Pointer management //////////
|
||||
|
||||
#define DO_FREE_AND_NULL(var) do { \
|
||||
Bfree(var); (var) = NULL; \
|
||||
Xfree(var); (var) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define ALIGNED_FREE_AND_NULL(var) do { \
|
||||
Baligned_free(var); (var) = NULL; \
|
||||
Xaligned_free(var); (var) = NULL; \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -1302,6 +1302,10 @@ static FORCE_INLINE void *xrealloc(void * const ptr, const bsize_t size)
|
|||
return (EDUKE32_PREDICT_TRUE(newptr != NULL || size == 0)) ? newptr: handle_memerr(ptr);
|
||||
}
|
||||
|
||||
static FORCE_INLINE void xfree(void *const ptr) { Bfree(ptr); }
|
||||
|
||||
static FORCE_INLINE void xaligned_free(void *const ptr) { Baligned_free(ptr); }
|
||||
|
||||
#if !defined NO_ALIGNED_MALLOC
|
||||
static FORCE_INLINE void *xaligned_alloc(const bsize_t alignment, const bsize_t size)
|
||||
{
|
||||
|
@ -1323,7 +1327,8 @@ static FORCE_INLINE void *xaligned_alloc(const bsize_t alignment, const bsize_t
|
|||
#define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLOC xcalloc(nmemb, size))
|
||||
#define Xrealloc(ptr, size) (EDUKE32_PRE_XALLOC xrealloc(ptr, size))
|
||||
#define Xaligned_alloc(alignment, size) (EDUKE32_PRE_XALLOC xaligned_alloc(alignment, size))
|
||||
|
||||
#define Xfree(ptr) (EDUKE32_PRE_XALLOC xfree(ptr))
|
||||
#define Xaligned_free(ptr) (EDUKE32_PRE_XALLOC xaligned_free(ptr))
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -220,7 +220,7 @@ void calc_ylookup(int32_t bpl, int32_t lastyidx)
|
|||
|
||||
if (lastyidx > ylookupsiz)
|
||||
{
|
||||
Baligned_free(ylookup);
|
||||
Xaligned_free(ylookup);
|
||||
|
||||
ylookup = (intptr_t *)Xaligned_alloc(16, lastyidx * sizeof(intptr_t));
|
||||
ylookupsiz = lastyidx;
|
||||
|
|
|
@ -382,13 +382,13 @@ int32_t addsearchpath_user(const char *p, int32_t user)
|
|||
|
||||
if (Bstat(path, &st) < 0)
|
||||
{
|
||||
Bfree(path);
|
||||
Xfree(path);
|
||||
if (errno == ENOENT) return -2;
|
||||
return -1;
|
||||
}
|
||||
if (!(st.st_mode & BS_IFDIR))
|
||||
{
|
||||
Bfree(path);
|
||||
Xfree(path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ int32_t addsearchpath_user(const char *p, int32_t user)
|
|||
|
||||
initprintf("Using %s for game data\n", srch->path);
|
||||
|
||||
Bfree(path);
|
||||
Xfree(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -461,13 +461,13 @@ int32_t removesearchpath(const char *p)
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(srch->path);
|
||||
Bfree(srch);
|
||||
Xfree(srch->path);
|
||||
Xfree(srch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Bfree(path);
|
||||
Xfree(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -498,8 +498,8 @@ void removesearchpaths_withuser(int32_t usermask)
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(srch->path);
|
||||
Bfree(srch);
|
||||
Xfree(srch->path);
|
||||
Xfree(srch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
return 0;
|
||||
}
|
||||
|
||||
Bfree(tfn);
|
||||
Xfree(tfn);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
if (buildvfs_exists(pfn))
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Xfree(ffn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -573,8 +573,8 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
if (buildvfs_exists(pfn))
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
Xfree(ffn);
|
||||
Xfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -586,8 +586,8 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
if (buildvfs_exists(pfn))
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
Xfree(ffn);
|
||||
Xfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -598,15 +598,15 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
if (buildvfs_exists(pfn))
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
Xfree(ffn);
|
||||
Xfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
Bfree(tfn);
|
||||
Xfree(tfn);
|
||||
}
|
||||
|
||||
Bfree(pfn); Bfree(ffn);
|
||||
Xfree(pfn); Xfree(ffn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ buildvfs_kfd openfrompath(const char *fn, int32_t flags, int32_t mode)
|
|||
|
||||
buildvfs_kfd h = openfrompath_internal(fn, &pfn, flags, mode);
|
||||
|
||||
Bfree(pfn);
|
||||
Xfree(pfn);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
@ -737,15 +737,15 @@ int initgroupfile(const char *filename)
|
|||
kclose_grp(numgroupfiles);
|
||||
|
||||
kzaddstack(zfn);
|
||||
Bfree(zfn);
|
||||
Xfree(zfn);
|
||||
return MAXGROUPFILES;
|
||||
}
|
||||
klseek_grp(numgroupfiles,0,BSEEK_SET);
|
||||
|
||||
Bfree(zfn);
|
||||
Xfree(zfn);
|
||||
}
|
||||
#else
|
||||
Bfree(zfn);
|
||||
Xfree(zfn);
|
||||
#endif
|
||||
|
||||
// check if GRP
|
||||
|
@ -932,7 +932,7 @@ static int32_t check_filename_mismatch(const char * const filename, int ofs)
|
|||
|
||||
if (!Bstrncmp(fnbuf+ofs, tfn, len))
|
||||
{
|
||||
Bfree(tfn);
|
||||
Xfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -940,11 +940,11 @@ static int32_t check_filename_mismatch(const char * const filename, int ofs)
|
|||
|
||||
if (!Bstrncmp(fnbuf+ofs, tfn, len))
|
||||
{
|
||||
Bfree(tfn);
|
||||
Xfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bfree(tfn);
|
||||
Xfree(tfn);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1087,7 +1087,7 @@ int32_t kopen4load(const char *filename, char searchfirst)
|
|||
|
||||
int32_t h = kopen_internal(filename, &lastpfn, searchfirst, 1, 1, newhandle, filegrp, filehan, filepos);
|
||||
|
||||
Bfree(lastpfn);
|
||||
Xfree(lastpfn);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
@ -1378,7 +1378,7 @@ void klistfree(CACHE1D_FIND_REC *rec)
|
|||
while (rec)
|
||||
{
|
||||
n = rec->next;
|
||||
Bfree(rec);
|
||||
Xfree(rec);
|
||||
rec = n;
|
||||
}
|
||||
}
|
||||
|
@ -1407,7 +1407,7 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int32_t type)
|
|||
{
|
||||
if (klistaddentry(&rec, "..", CACHE1D_FIND_DIR, CACHE1D_SOURCE_CURDIR) < 0)
|
||||
{
|
||||
Bfree(path);
|
||||
Xfree(path);
|
||||
klistfree(rec);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1627,20 +1627,20 @@ next:
|
|||
{
|
||||
if (klistaddentry(&rec, drp, CACHE1D_FIND_DRIVE, CACHE1D_SOURCE_DRIVE) < 0)
|
||||
{
|
||||
Bfree(drives);
|
||||
Xfree(drives);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
Bfree(drives);
|
||||
Xfree(drives);
|
||||
}
|
||||
}
|
||||
|
||||
Bfree(path);
|
||||
Xfree(path);
|
||||
// XXX: may be NULL if no file was listed, and thus indistinguishable from
|
||||
// an error condition.
|
||||
return rec;
|
||||
failure:
|
||||
Bfree(path);
|
||||
Xfree(path);
|
||||
klistfree(rec);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1690,7 +1690,7 @@ int32_t kdfread_LZ4(void *buffer, int dasizeof, int count, buildvfs_kfd fil)
|
|||
int32_t decompressedLength = LZ4_decompress_safe(pCompressedData, (char*) buffer, leng, dasizeof*count);
|
||||
|
||||
if (pCompressedData != compressedDataStackBuf)
|
||||
Baligned_free(pCompressedData);
|
||||
Xaligned_free(pCompressedData);
|
||||
|
||||
return decompressedLength/dasizeof;
|
||||
}
|
||||
|
@ -1716,5 +1716,5 @@ void dfwrite_LZ4(const void *buffer, int dasizeof, int count, buildvfs_FILE fil)
|
|||
buildvfs_fwrite(pCompressedData, leng, 1, fil);
|
||||
|
||||
if (pCompressedData != compressedDataStackBuf)
|
||||
Baligned_free(pCompressedData);
|
||||
Xaligned_free(pCompressedData);
|
||||
}
|
||||
|
|
|
@ -168,8 +168,8 @@ int32_t engineLoadClipMaps(void)
|
|||
{
|
||||
engineInitClipMaps();
|
||||
|
||||
Bfree(fisec);
|
||||
Bfree(fispr);
|
||||
Xfree(fisec);
|
||||
Xfree(fispr);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -254,8 +254,8 @@ int32_t engineLoadClipMaps(void)
|
|||
clipinfo[sectoidx[k]].picnum);
|
||||
engineInitClipMaps();
|
||||
|
||||
Bfree(fisec);
|
||||
Bfree(fispr);
|
||||
Xfree(fisec);
|
||||
Xfree(fispr);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
@ -318,8 +318,8 @@ int32_t engineLoadClipMaps(void)
|
|||
" for sprite %d.\n", g_clipMapFiles[fi], outersect-fisec[fi], ns-fisec[fi], i-fispr[fi]);
|
||||
engineInitClipMaps();
|
||||
|
||||
Bfree(fisec);
|
||||
Bfree(fispr);
|
||||
Xfree(fisec);
|
||||
Xfree(fispr);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
@ -337,8 +337,8 @@ int32_t engineLoadClipMaps(void)
|
|||
g_clipMapFiles[fi], ns-fisec[fi], sectoidx[ns], i-fispr[fi], numclipmaps);
|
||||
engineInitClipMaps();
|
||||
|
||||
Bfree(fisec);
|
||||
Bfree(fispr);
|
||||
Xfree(fisec);
|
||||
Xfree(fispr);
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
@ -351,8 +351,8 @@ int32_t engineLoadClipMaps(void)
|
|||
initprintf("clip map: INTERNAL ERROR: outersect==-1!\n");
|
||||
engineInitClipMaps();
|
||||
|
||||
Bfree(fisec);
|
||||
Bfree(fispr);
|
||||
Xfree(fisec);
|
||||
Xfree(fispr);
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
@ -517,8 +517,8 @@ int32_t engineLoadClipMaps(void)
|
|||
if (lwcp > 0)
|
||||
initprintf("Loaded clip map%s.\n", lwcp==1 ? "" : "s");
|
||||
|
||||
Bfree(fisec);
|
||||
Bfree(fispr);
|
||||
Xfree(fisec);
|
||||
Xfree(fispr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ char *g_defNamePtr = NULL;
|
|||
|
||||
void clearDefNamePtr(void)
|
||||
{
|
||||
Bfree(g_defNamePtr);
|
||||
Xfree(g_defNamePtr);
|
||||
// g_defNamePtr assumed to be assigned to right after
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ int32_t check_file_exist(const char *fn)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
else Bfree(tfn);
|
||||
else Xfree(tfn);
|
||||
pathsearchmode = opsm;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -221,7 +221,7 @@ int32_t Bcorrectfilename(char *filename, int32_t removefn)
|
|||
if (trailslash) *(first++) = '/';
|
||||
*(first++) = 0;
|
||||
|
||||
Bfree(fn);
|
||||
Xfree(fn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -365,17 +365,17 @@ BDIR *Bopendir(const char *name)
|
|||
*(++tt) = 0;
|
||||
|
||||
dirr->dir = _findfirst(t, &dirr->fid);
|
||||
Bfree(t);
|
||||
Xfree(t);
|
||||
if (dirr->dir == -1)
|
||||
{
|
||||
Bfree(dirr);
|
||||
Xfree(dirr);
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
dirr->dir = opendir(name);
|
||||
if (dirr->dir == NULL)
|
||||
{
|
||||
Bfree(dirr);
|
||||
Xfree(dirr);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -441,7 +441,7 @@ struct Bdirent *Breaddir(BDIR *dir)
|
|||
}
|
||||
#endif
|
||||
|
||||
Bfree(fn);
|
||||
Xfree(fn);
|
||||
|
||||
return &dirr->info;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ int32_t Bclosedir(BDIR *dir)
|
|||
#else
|
||||
closedir(dirr->dir);
|
||||
#endif
|
||||
Bfree(dirr);
|
||||
Xfree(dirr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ void writesettings(void) // save binds and aliases to <cfgname>_m32_settings.cfg
|
|||
OSD_Printf("Wrote m32_settings.cfg\n");
|
||||
else OSD_Printf("Wrote %s_m32_settings.cfg\n",ptr);
|
||||
|
||||
Bfree(ptr);
|
||||
Xfree(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ void writesettings(void) // save binds and aliases to <cfgname>_m32_settings.cfg
|
|||
OSD_Printf("Error writing m32_settings.cfg: %s\n", strerror(errno));
|
||||
else OSD_Printf("Error writing %s_m32_settings.cfg: %s\n",ptr,strerror(errno));
|
||||
|
||||
Bfree(ptr);
|
||||
Xfree(ptr);
|
||||
}
|
||||
|
||||
int32_t writesetup(const char *fn)
|
||||
|
|
|
@ -305,7 +305,7 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
|||
|
||||
tile_from_truecolpic(tile, picptr, alphacut);
|
||||
|
||||
Bfree(picptr);
|
||||
Xfree(picptr);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (istexture)
|
||||
|
@ -2054,7 +2054,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
|
||||
klseek(fd, 0, SEEK_SET);
|
||||
if (kread(fd, filebuf, filesize)!=filesize)
|
||||
{ kclose(fd); Bfree(highpaldata); initprintf("Error: didn't read all of \"%s\".\n", fn); break; }
|
||||
{ kclose(fd); Xfree(highpaldata); initprintf("Error: didn't read all of \"%s\".\n", fn); break; }
|
||||
|
||||
kclose(fd);
|
||||
kpgetdim(filebuf, filesize, &xsiz, &ysiz);
|
||||
|
@ -2063,19 +2063,19 @@ static int32_t defsparser(scriptfile *script)
|
|||
{
|
||||
initprintf("Error: image dimensions of \"%s\" must be %dx%d.\n",
|
||||
fn, PR_HIGHPALOOKUP_DIM*PR_HIGHPALOOKUP_DIM, PR_HIGHPALOOKUP_DIM);
|
||||
Bfree(filebuf); Bfree(highpaldata);
|
||||
Xfree(filebuf); Xfree(highpaldata);
|
||||
break;
|
||||
}
|
||||
|
||||
i = kprender(filebuf, filesize, (intptr_t)highpaldata, xsiz*sizeof(coltype), xsiz, ysiz);
|
||||
Bfree(filebuf);
|
||||
Xfree(filebuf);
|
||||
if (EDUKE32_PREDICT_FALSE(i))
|
||||
{ Bfree(highpaldata); initprintf("Error: failed rendering \"%s\".\n", fn); break; }
|
||||
{ Xfree(highpaldata); initprintf("Error: failed rendering \"%s\".\n", fn); break; }
|
||||
}
|
||||
|
||||
polymer_definehighpalookup(basepal, pal, highpaldata);
|
||||
|
||||
Bfree(highpaldata);
|
||||
Xfree(highpaldata);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
@ -2884,7 +2884,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
{
|
||||
initprintf("Error: basepalette: Read failed on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
Bfree(palbuf);
|
||||
Xfree(palbuf);
|
||||
kclose(fil);
|
||||
break;
|
||||
}
|
||||
|
@ -2898,7 +2898,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
paletteSetColorTable(id, palbuf);
|
||||
didLoadPal = 1;
|
||||
|
||||
Bfree(palbuf);
|
||||
Xfree(palbuf);
|
||||
kclose(fil);
|
||||
break;
|
||||
}
|
||||
|
@ -3065,7 +3065,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
{
|
||||
initprintf("Error: palookup: Read failed on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
Bfree(palookupbuf);
|
||||
Xfree(palookupbuf);
|
||||
kclose(fil);
|
||||
break;
|
||||
}
|
||||
|
@ -3088,7 +3088,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
paletteMakeLookupTable(id, palookupbuf, 0,0,0, g_noFloorPal[id]);
|
||||
}
|
||||
|
||||
Bfree(palookupbuf);
|
||||
Xfree(palookupbuf);
|
||||
kclose(fil);
|
||||
break;
|
||||
}
|
||||
|
@ -3364,7 +3364,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
{
|
||||
initprintf("Error: blendtable: Read failed on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
Bfree(blendbuf);
|
||||
Xfree(blendbuf);
|
||||
kclose(fil);
|
||||
break;
|
||||
}
|
||||
|
@ -3372,7 +3372,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
paletteSetBlendTable(id, blendbuf);
|
||||
didLoadTransluc = 1;
|
||||
|
||||
Bfree(blendbuf);
|
||||
Xfree(blendbuf);
|
||||
kclose(fil);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -4405,7 +4405,7 @@ static void classicDrawBunches(int32_t bunch)
|
|||
Bmemcpy((char *)frameplace, bakframe, xdim*ydim);
|
||||
videoEndDrawing(); //}}}
|
||||
|
||||
Baligned_free(bakframe);
|
||||
Xaligned_free(bakframe);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -7757,7 +7757,7 @@ int32_t enginePreInit(void)
|
|||
#else
|
||||
for (i = 0; i < (signed) ARRAY_SIZE(dynarray); i++)
|
||||
{
|
||||
Baligned_free(*dynarray[i].ptr);
|
||||
Xaligned_free(*dynarray[i].ptr);
|
||||
*dynarray[i].ptr = Xaligned_alloc(16, dynarray[i].size);
|
||||
}
|
||||
#endif
|
||||
|
@ -7916,16 +7916,16 @@ void engineUnInit(void)
|
|||
if (i==0 || palookup[i] != palookup[0])
|
||||
{
|
||||
// Take care of handling aliased ^^^ cases!
|
||||
Baligned_free(palookup[i]);
|
||||
Xaligned_free(palookup[i]);
|
||||
}
|
||||
Bmemset(palookup, 0, sizeof(palookup));
|
||||
|
||||
for (bssize_t i=0; i<MAXBLENDTABS; i++)
|
||||
Bfree(blendtable[i]);
|
||||
Xfree(blendtable[i]);
|
||||
Bmemset(blendtable, 0, sizeof(blendtable));
|
||||
|
||||
for (bssize_t i=1; i<MAXBASEPALS; i++)
|
||||
Bfree(basepaltable[i]);
|
||||
Xfree(basepaltable[i]);
|
||||
Bmemset(basepaltable, 0, sizeof(basepaltable));
|
||||
basepaltable[0] = palette;
|
||||
|
||||
|
@ -7939,8 +7939,8 @@ void engineUnInit(void)
|
|||
|
||||
for (bssize_t i = 0; i < num_usermaphacks; i++)
|
||||
{
|
||||
Bfree(usermaphacks[i].mhkfile);
|
||||
Bfree(usermaphacks[i].title);
|
||||
Xfree(usermaphacks[i].mhkfile);
|
||||
Xfree(usermaphacks[i].title);
|
||||
}
|
||||
DO_FREE_AND_NULL(usermaphacks);
|
||||
num_usermaphacks = 0;
|
||||
|
@ -9467,7 +9467,7 @@ skip_reading_mapbin:
|
|||
uint8_t *fullboard = (uint8_t*)Xmalloc(boardsize);
|
||||
kread(fil, fullboard, boardsize);
|
||||
md4once(fullboard, boardsize, g_loadedMapHack.md4);
|
||||
Bfree(fullboard);
|
||||
Xfree(fullboard);
|
||||
|
||||
kclose(fil);
|
||||
// Done reading file.
|
||||
|
@ -9854,7 +9854,7 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
|
|||
}
|
||||
|
||||
buildvfs_write(fil, tsect, sizeof(sectortypev7)*numsectors);
|
||||
Bfree(tsect);
|
||||
Xfree(tsect);
|
||||
|
||||
ts = B_LITTLE16(numwalls);
|
||||
buildvfs_write(fil,&ts,2);
|
||||
|
@ -9897,7 +9897,7 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
|
|||
}
|
||||
|
||||
buildvfs_write(fil, twall, sizeof(walltypev7)*numwalls);
|
||||
Bfree(twall);
|
||||
Xfree(twall);
|
||||
|
||||
ts = B_LITTLE16(numsprites); buildvfs_write(fil,&ts,2);
|
||||
|
||||
|
@ -9931,7 +9931,7 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
|
|||
}
|
||||
|
||||
buildvfs_write(fil, tspri, sizeof(spritetype)*numsprites);
|
||||
Bfree(tspri);
|
||||
Xfree(tspri);
|
||||
}
|
||||
|
||||
buildvfs_close(fil);
|
||||
|
@ -9978,7 +9978,7 @@ static void videoAllocateBuffers(void)
|
|||
|
||||
for (i = 0; i < (signed)ARRAY_SIZE(dynarray); i++)
|
||||
{
|
||||
Baligned_free(*dynarray[i].ptr);
|
||||
Xaligned_free(*dynarray[i].ptr);
|
||||
|
||||
*dynarray[i].ptr = Xaligned_alloc(16, dynarray[i].size);
|
||||
}
|
||||
|
@ -10097,7 +10097,7 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
|
|||
swallf = (float *) Xrealloc(swallf, xdim * sizeof(float));
|
||||
#endif
|
||||
|
||||
Bfree(lookups);
|
||||
Xfree(lookups);
|
||||
|
||||
j = ydim*4; //Leave room for horizlookup&horizlookup2
|
||||
lookups = (int32_t *)Xmalloc(2*j*sizeof(lookups[0]));
|
||||
|
@ -10245,7 +10245,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename)
|
|||
voxmodels[voxindex] = NULL;
|
||||
}
|
||||
|
||||
Bfree(voxfilenames[voxindex]);
|
||||
Xfree(voxfilenames[voxindex]);
|
||||
voxfilenames[voxindex] = Xstrdup(filename);
|
||||
g_haveVoxels = 1;
|
||||
#endif
|
||||
|
@ -12117,7 +12117,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall)
|
|||
}
|
||||
#endif
|
||||
|
||||
Bfree(tmpwall);
|
||||
Xfree(tmpwall);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -47,7 +47,7 @@ static GLuint compileShader(GLenum shaderType, const char* const source)
|
|||
char *infoLog = (char*) Xmalloc(logLength);
|
||||
glGetShaderInfoLog(shaderID, logLength, &logLength, infoLog);
|
||||
OSD_Printf("Log:\n%s\n", infoLog);
|
||||
Bfree(infoLog);
|
||||
Xfree(infoLog);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ void hash_free(hashtable_t *t)
|
|||
hashitem_t * const tmp = cur;
|
||||
cur = cur->next;
|
||||
|
||||
Bfree(tmp->string);
|
||||
Bfree(tmp);
|
||||
Xfree(tmp->string);
|
||||
Xfree(tmp);
|
||||
}
|
||||
} while (--remaining >= 0);
|
||||
|
||||
|
@ -112,14 +112,14 @@ void hash_delete(hashtable_t *t, const char *s)
|
|||
{
|
||||
if (Bstrcmp(s, cur->string) == 0)
|
||||
{
|
||||
Bfree(cur->string);
|
||||
Xfree(cur->string);
|
||||
|
||||
if (!prev)
|
||||
t->items[code] = cur->next;
|
||||
else
|
||||
prev->next = cur->next;
|
||||
|
||||
Bfree(cur);
|
||||
Xfree(cur);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -96,12 +96,12 @@ void hicinit(void)
|
|||
if (hr->skybox)
|
||||
{
|
||||
for (j=5; j>=0; j--)
|
||||
Bfree(hr->skybox->face[j]);
|
||||
Bfree(hr->skybox);
|
||||
Xfree(hr->skybox->face[j]);
|
||||
Xfree(hr->skybox);
|
||||
}
|
||||
|
||||
Bfree(hr->filename);
|
||||
Bfree(hr);
|
||||
Xfree(hr->filename);
|
||||
Xfree(hr);
|
||||
|
||||
hr = next;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float
|
|||
else hrn = hr;
|
||||
|
||||
// store into hicreplc the details for this replacement
|
||||
Bfree(hrn->filename);
|
||||
Xfree(hrn->filename);
|
||||
|
||||
hrn->filename = Xstrdup(filen);
|
||||
hrn->alphacut = min(alphacut,1.f);
|
||||
|
@ -268,18 +268,18 @@ int32_t hicclearsubst(int32_t picnum, int32_t palnum)
|
|||
|
||||
if (!hr) return 0;
|
||||
|
||||
Bfree(hr->filename);
|
||||
Xfree(hr->filename);
|
||||
if (hr->skybox)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=5; i>=0; i--)
|
||||
Bfree(hr->skybox->face[i]);
|
||||
Bfree(hr->skybox);
|
||||
Xfree(hr->skybox->face[i]);
|
||||
Xfree(hr->skybox);
|
||||
}
|
||||
|
||||
if (hrn) hrn->next = hr->next;
|
||||
else hicreplc[picnum] = hr->next;
|
||||
Bfree(hr);
|
||||
Xfree(hr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1369,9 +1369,9 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
kfileptr += leng;
|
||||
break;
|
||||
case 0xda:
|
||||
if ((xdim <= 0) || (ydim <= 0)) { Bfree(dctbuf); return -1; }
|
||||
if ((xdim <= 0) || (ydim <= 0)) { Xfree(dctbuf); return -1; }
|
||||
|
||||
lnumcomponents = (int32_t)(*kfileptr++); if (!lnumcomponents) { Bfree(dctbuf); return -1; }
|
||||
lnumcomponents = (int32_t)(*kfileptr++); if (!lnumcomponents) { Xfree(dctbuf); return -1; }
|
||||
if (lnumcomponents > 1) kcoltype = 2;
|
||||
for (z=0; z<lnumcomponents; z++)
|
||||
{
|
||||
|
@ -1607,7 +1607,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
kplib_yrbrend_func(x,y,&dct[0][0]);
|
||||
}
|
||||
|
||||
Bfree(dctbuf); return 0;
|
||||
Xfree(dctbuf); return 0;
|
||||
}
|
||||
|
||||
//============================== KPEGILIB ends ==============================
|
||||
|
@ -3049,7 +3049,7 @@ void kpzdecode(int32_t const leng, intptr_t * const pic, int32_t * const xsiz, i
|
|||
|
||||
if (kprender(kpzbuf, leng, *pic, ((*xsiz)<<2), *xsiz, *ysiz) < 0)
|
||||
{
|
||||
Bfree((void *) *pic);
|
||||
Xfree((void *) *pic);
|
||||
*pic = (intptr_t)NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ static int32_t read_whole_file(const char *fn, char **retbufptr)
|
|||
|
||||
if (i != flen)
|
||||
{
|
||||
Bfree(buf);
|
||||
Xfree(buf);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -247,6 +247,6 @@ int L_RunOnce(L_State *estate, const char *fn)
|
|||
return i;
|
||||
|
||||
int const retval = L_RunString(estate, buf, -1, fn);
|
||||
Bfree(buf);
|
||||
Xfree(buf);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -480,7 +480,7 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32
|
|||
if (!skl) m->skinmap = sk;
|
||||
else skl->next = sk;
|
||||
}
|
||||
else Bfree(sk->fn);
|
||||
else Xfree(sk->fn);
|
||||
|
||||
sk->palette = (uint8_t)palnum;
|
||||
sk->flags = (uint8_t)flags;
|
||||
|
@ -732,7 +732,7 @@ FHardwareTexture *mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t
|
|||
{
|
||||
if (kprender(kpzbuf,picfillen,(intptr_t)pic,bytesperline,siz.x,siz.y))
|
||||
{
|
||||
Bfree(pic);
|
||||
Xfree(pic);
|
||||
return mdloadskin_failed(skinfile, fn);
|
||||
}
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ FHardwareTexture *mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t
|
|||
}
|
||||
else if (lastsize < siz.x*siz.y)
|
||||
{
|
||||
Bfree(lastpic);
|
||||
Xfree(lastpic);
|
||||
lastpic = (coltype *)Xmalloc(siz.x*siz.y*sizeof(coltype));
|
||||
}
|
||||
if (lastpic)
|
||||
|
@ -859,7 +859,7 @@ FHardwareTexture *mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t
|
|||
(onebitalpha ? DAMETH_ONEBITALPHA : 0) |
|
||||
(hasalpha ? DAMETH_HASALPHA : 0));
|
||||
|
||||
Bfree(pic);
|
||||
Xfree(pic);
|
||||
}
|
||||
|
||||
if (!m->skinloaded)
|
||||
|
@ -1107,7 +1107,7 @@ static md2model_t *md2load(buildvfs_kfd fil, const char *filnam)
|
|||
head.ofseof = B_LITTLE32(head.ofseof);
|
||||
#endif
|
||||
|
||||
if ((head.id != IDP2_MAGIC) || (head.vers != 8)) { Bfree(m); return 0; } //"IDP2"
|
||||
if ((head.id != IDP2_MAGIC) || (head.vers != 8)) { Xfree(m); return 0; } //"IDP2"
|
||||
|
||||
ournumskins = head.numskins ? head.numskins : 1;
|
||||
ournumglcmds = head.numglcmds ? head.numglcmds : 1;
|
||||
|
@ -1125,22 +1125,22 @@ static md2model_t *md2load(buildvfs_kfd fil, const char *filnam)
|
|||
|
||||
klseek(fil,head.ofsframes,SEEK_SET);
|
||||
if (kread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes)
|
||||
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
|
||||
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
|
||||
|
||||
if (m->numglcmds > 0)
|
||||
{
|
||||
klseek(fil,head.ofsglcmds,SEEK_SET);
|
||||
if (kread(fil,(char *)m->glcmds,m->numglcmds*sizeof(int32_t)) != (int32_t)(m->numglcmds*sizeof(int32_t)))
|
||||
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
|
||||
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
|
||||
}
|
||||
|
||||
klseek(fil,head.ofstris,SEEK_SET);
|
||||
if (kread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t)))
|
||||
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
|
||||
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
|
||||
|
||||
klseek(fil,head.ofsuv,SEEK_SET);
|
||||
if (kread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t)))
|
||||
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
|
||||
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
|
||||
|
||||
#if B_BIG_ENDIAN != 0
|
||||
{
|
||||
|
@ -1190,7 +1190,7 @@ static md2model_t *md2load(buildvfs_kfd fil, const char *filnam)
|
|||
{
|
||||
klseek(fil,head.ofsskins,SEEK_SET);
|
||||
if (kread(fil,m->skinfn,64*m->numskins) != 64*m->numskins)
|
||||
{ Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
|
||||
{ Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
|
||||
}
|
||||
|
||||
m->texid = (FHardwareTexture **)Xcalloc(ournumskins, sizeof(FHardwareTexture*) * HICTINT_MEMORY_COMBINATIONS);
|
||||
|
@ -1317,7 +1317,7 @@ static md2model_t *md2load(buildvfs_kfd fil, const char *filnam)
|
|||
m3->maxdepths = (float *)Xmalloc(sizeof(float) * s->numtris);
|
||||
|
||||
// die MD2 ! DIE !
|
||||
Bfree(m->texid); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m);
|
||||
Xfree(m->texid); Xfree(m->skinfn); Xfree(m->basepath); Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m);
|
||||
|
||||
return ((md2model_t *)m3);
|
||||
}
|
||||
|
@ -1385,7 +1385,7 @@ static md3model_t *md3load(buildvfs_kfd fil)
|
|||
m->head.eof = B_LITTLE32(m->head.eof);
|
||||
#endif
|
||||
|
||||
if ((m->head.id != IDP3_MAGIC) && (m->head.vers != 15)) { Bfree(m); return 0; } //"IDP3"
|
||||
if ((m->head.id != IDP3_MAGIC) && (m->head.vers != 15)) { Xfree(m); return 0; } //"IDP3"
|
||||
|
||||
m->numskins = m->head.numskins; //<- dead code?
|
||||
m->numframes = m->head.numframes;
|
||||
|
@ -2281,13 +2281,13 @@ static void md3free(md3model_t *m)
|
|||
for (anim=m->animations; anim; anim=nanim)
|
||||
{
|
||||
nanim = anim->next;
|
||||
Bfree(anim);
|
||||
Xfree(anim);
|
||||
}
|
||||
for (sk=m->skinmap; sk; sk=nsk)
|
||||
{
|
||||
nsk = sk->next;
|
||||
Bfree(sk->fn);
|
||||
Bfree(sk);
|
||||
Xfree(sk->fn);
|
||||
Xfree(sk);
|
||||
}
|
||||
|
||||
if (m->head.surfs)
|
||||
|
@ -2295,23 +2295,23 @@ static void md3free(md3model_t *m)
|
|||
for (bssize_t surfi=m->head.numsurfs-1; surfi>=0; surfi--)
|
||||
{
|
||||
md3surf_t *s = &m->head.surfs[surfi];
|
||||
Bfree(s->tris);
|
||||
Bfree(s->geometry); // FREE_SURFS_GEOMETRY
|
||||
Xfree(s->tris);
|
||||
Xfree(s->geometry); // FREE_SURFS_GEOMETRY
|
||||
}
|
||||
Bfree(m->head.surfs);
|
||||
Xfree(m->head.surfs);
|
||||
}
|
||||
Bfree(m->head.tags);
|
||||
Bfree(m->head.frames);
|
||||
Xfree(m->head.tags);
|
||||
Xfree(m->head.frames);
|
||||
|
||||
Bfree(m->texid);
|
||||
Xfree(m->texid);
|
||||
|
||||
Bfree(m->muladdframes);
|
||||
Xfree(m->muladdframes);
|
||||
|
||||
Bfree(m->indexes);
|
||||
Bfree(m->vindexes);
|
||||
Bfree(m->maxdepths);
|
||||
Xfree(m->indexes);
|
||||
Xfree(m->vindexes);
|
||||
Xfree(m->maxdepths);
|
||||
|
||||
Bfree(m);
|
||||
Xfree(m);
|
||||
}
|
||||
|
||||
//---------------------------------------- MD3 LIBRARY ENDS ----------------------------------------
|
||||
|
|
|
@ -184,7 +184,7 @@ int OSD_Exec(const char *szScript)
|
|||
if (handle != buildvfs_kfd_invalid)
|
||||
kclose(handle);
|
||||
|
||||
Bfree(buf);
|
||||
Xfree(buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ int OSD_Exec(const char *szScript)
|
|||
}
|
||||
--osd->execdepth;
|
||||
|
||||
Bfree(buf);
|
||||
Xfree(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ static int osdfunc_fileinfo(osdcmdptr_t parm)
|
|||
uint32_t const xxhash = XXH32_digest(&xxh);
|
||||
xxhtime = timerGetTicks() - xxhtime;
|
||||
|
||||
Bfree(buf);
|
||||
Xfree(buf);
|
||||
|
||||
OSD_Printf("fileinfo: %s\n"
|
||||
" File size: %d\n"
|
||||
|
@ -1430,10 +1430,10 @@ void OSD_ResizeDisplay(int w, int h)
|
|||
Bmemcpy(newfmt + newcols * i, t.fmt + d.cols * i, copycols);
|
||||
}
|
||||
|
||||
Bfree(t.buf);
|
||||
Xfree(t.buf);
|
||||
t.buf = newtext;
|
||||
|
||||
Bfree(t.fmt);
|
||||
Xfree(t.fmt);
|
||||
t.fmt = newfmt;
|
||||
|
||||
t.maxlines = newmaxlines;
|
||||
|
@ -1649,7 +1649,7 @@ void OSD_Puts(const char *tmpstr)
|
|||
char *chp2 = Xstrdup(tmpstr);
|
||||
buildvfs_fputs(OSD_StripColors(chp2, tmpstr), osdlog);
|
||||
Bprintf("%s", chp2);
|
||||
Bfree(chp2);
|
||||
Xfree(chp2);
|
||||
}
|
||||
else if (log.lines == log.cutoff)
|
||||
{
|
||||
|
@ -1860,7 +1860,7 @@ void OSD_Dispatch(const char *cmd)
|
|||
// cheap hack for comments in cfgs
|
||||
if (token[0] == '/' && token[1] == '/')
|
||||
{
|
||||
Bfree(workbuf);
|
||||
Xfree(workbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1877,7 +1877,7 @@ void OSD_Dispatch(const char *cmd)
|
|||
else if (m32_osd_tryscript)
|
||||
M32RunScript(cmd);
|
||||
|
||||
Bfree(workbuf);
|
||||
Xfree(workbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1909,7 +1909,7 @@ void OSD_Dispatch(const char *cmd)
|
|||
}
|
||||
while (wtp && restart);
|
||||
|
||||
Bfree(workbuf);
|
||||
Xfree(workbuf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1992,7 +1992,7 @@ static osdsymbol_t *osd_addsymbol(const char *pszName)
|
|||
|
||||
hash_add(&h_osd, pszName, osd->numsymbols, 1);
|
||||
hash_add(&h_osd, lowercase, osd->numsymbols, 1);
|
||||
Bfree(lowercase);
|
||||
Xfree(lowercase);
|
||||
|
||||
osd->symbptrs[osd->numsymbols++] = newsymb;
|
||||
|
||||
|
@ -2036,7 +2036,7 @@ static osdsymbol_t * osd_findexactsymbol(const char *pszName)
|
|||
char *const lname = Xstrdup(pszName);
|
||||
Bstrtolower(lname);
|
||||
symbolNum = hash_find(&h_osd, lname);
|
||||
Bfree(lname);
|
||||
Xfree(lname);
|
||||
}
|
||||
|
||||
return (symbolNum >= 0) ? osd->symbptrs[symbolNum] : NULL;
|
||||
|
|
|
@ -331,7 +331,7 @@ void paletteLoadFromDisk(void)
|
|||
if (kread_and_test(fil, &blendnum, 1))
|
||||
{
|
||||
initprintf("Warning: failed reading additional blending table index\n");
|
||||
Bfree(tab);
|
||||
Xfree(tab);
|
||||
return kclose(fil);
|
||||
}
|
||||
|
||||
|
@ -341,13 +341,13 @@ void paletteLoadFromDisk(void)
|
|||
if (kread_and_test(fil, tab, 256*256))
|
||||
{
|
||||
initprintf("Warning: failed reading additional blending table\n");
|
||||
Bfree(tab);
|
||||
Xfree(tab);
|
||||
return kclose(fil);
|
||||
}
|
||||
|
||||
paletteSetBlendTable(blendnum, tab);
|
||||
}
|
||||
Bfree(tab);
|
||||
Xfree(tab);
|
||||
|
||||
// Read log2 of count of alpha blending tables.
|
||||
uint8_t lognumalphatabs;
|
||||
|
|
|
@ -34,7 +34,7 @@ static void png_write_chunk(uint32_t const size, char const *const type,
|
|||
crc = Bcrc32(chunk, chunk_size + 4, crc);
|
||||
png_write_uint32(crc);
|
||||
|
||||
Bfree(chunk);
|
||||
Xfree(chunk);
|
||||
}
|
||||
|
||||
void png_set_pal(uint8_t const * const data, int numentries)
|
||||
|
@ -93,5 +93,5 @@ void png_write(buildvfs_FILE const file, int const width, int const height,
|
|||
png_write_chunk(linesiz, "IDAT", lines, CHUNK_COMPRESSED);
|
||||
png_write_chunk(0, "IEND", NULL, 0);
|
||||
|
||||
Bfree(lines);
|
||||
Xfree(lines);
|
||||
}
|
||||
|
|
|
@ -445,11 +445,11 @@ void polymost_glreset()
|
|||
if (pth->flags & PTH_HASFULLBRIGHT)
|
||||
{
|
||||
delete pth->ofb->glpic;
|
||||
Bfree(pth->ofb);
|
||||
Xfree(pth->ofb);
|
||||
}
|
||||
|
||||
delete pth->glpic;
|
||||
Bfree(pth);
|
||||
Xfree(pth);
|
||||
pth = next;
|
||||
}
|
||||
|
||||
|
@ -1781,7 +1781,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
|
|||
(npoty ? DAMETH_NPOTWALL : 0) |
|
||||
(hasalpha ? (DAMETH_HASALPHA|DAMETH_ONEBITALPHA) : 0));
|
||||
|
||||
Bfree(pic);
|
||||
Xfree(pic);
|
||||
}
|
||||
|
||||
polymost_setuptexture(pth->glpic, dameth, -1);
|
||||
|
@ -1916,7 +1916,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
|||
{
|
||||
if (kprender(kpzbuf,picfillen,(intptr_t)pic,bytesperline,siz.x,siz.y))
|
||||
{
|
||||
Bfree(pic);
|
||||
Xfree(pic);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
@ -1934,7 +1934,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
|||
}
|
||||
else if (lastsize < siz.x*siz.y)
|
||||
{
|
||||
Bfree(lastpic);
|
||||
Xfree(lastpic);
|
||||
lastpic = (coltype *)Xmalloc(siz.x*siz.y*sizeof(coltype));
|
||||
}
|
||||
if (lastpic)
|
||||
|
@ -2057,7 +2057,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
|||
(onebitalpha ? DAMETH_ONEBITALPHA : 0) |
|
||||
(hasalpha ? DAMETH_HASALPHA : 0));
|
||||
|
||||
Bfree(pic);
|
||||
Xfree(pic);
|
||||
}
|
||||
|
||||
// precalculate scaling parameters for replacement
|
||||
|
@ -7370,7 +7370,7 @@ static int32_t gen_font_glyph_tex(void)
|
|||
polymosttext->CreateTexture(256, 128, false, false);
|
||||
polymosttext->LoadTexture((uint8_t*)tbuf); // RGBA
|
||||
polymosttext->SetSampler(Sampler2DNoFilter);
|
||||
Bfree(tbuf);
|
||||
Xfree(tbuf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ static void screencapture_end(char *fn, buildvfs_FILE * filptr)
|
|||
{
|
||||
buildvfs_fclose(*filptr);
|
||||
OSD_Printf("Saved screenshot to %s\n", fn);
|
||||
Bfree(fn);
|
||||
Xfree(fn);
|
||||
capturecounter.count++;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ int videoCaptureScreen(const char *filename, char inverseit)
|
|||
|
||||
if (fp == nullptr)
|
||||
{
|
||||
Bfree(fn);
|
||||
Xfree(fn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ int videoCaptureScreen(const char *filename, char inverseit)
|
|||
Bmemcpy(imgBuf + (ydim - i - 1) * bytesPerLine, rowBuf, bytesPerLine);
|
||||
}
|
||||
|
||||
Bfree(rowBuf);
|
||||
Xfree(rowBuf);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -125,7 +125,7 @@ int videoCaptureScreen(const char *filename, char inverseit)
|
|||
|
||||
png_set_text("Software", osd->version.buf);
|
||||
png_write(fp, xdim, ydim, HICOLOR ? PNG_TRUECOLOR : PNG_INDEXED, imgBuf);
|
||||
Bfree(imgBuf);
|
||||
Xfree(imgBuf);
|
||||
screencapture_end(fn, &fp);
|
||||
|
||||
return 0;
|
||||
|
@ -141,7 +141,7 @@ int videoCaptureScreenTGA(const char *filename, char inverseit)
|
|||
buildvfs_FILE fil = capturecounter.opennextfile_withext(fn, "tga");
|
||||
if (fil == nullptr)
|
||||
{
|
||||
Bfree(fn);
|
||||
Xfree(fn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ int videoCaptureScreenTGA(const char *filename, char inverseit)
|
|||
swapchar(&inversebuf[i], &inversebuf[i + 2]);
|
||||
|
||||
buildvfs_fwrite(inversebuf, xdim*ydim, 3, fil);
|
||||
Bfree(inversebuf);
|
||||
Xfree(inversebuf);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
|
|
|
@ -341,10 +341,10 @@ scriptfile *scriptfile_fromstring(const char *string)
|
|||
void scriptfile_close(scriptfile *sf)
|
||||
{
|
||||
if (!sf) return;
|
||||
Bfree(sf->lineoffs);
|
||||
Bfree(sf->textbuf);
|
||||
Bfree(sf->filename);
|
||||
Bfree(sf);
|
||||
Xfree(sf->lineoffs);
|
||||
Xfree(sf->textbuf);
|
||||
Xfree(sf->filename);
|
||||
Xfree(sf);
|
||||
}
|
||||
|
||||
int scriptfile_eof(scriptfile *sf)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
|
||||
#define CLEAR_GL_ERRORS() while(glGetError() != GL_NO_ERROR) { }
|
||||
#define TEXCACHE_FREEBUFS() { Bfree(pic), Bfree(packbuf), Bfree(midbuf); }
|
||||
#define TEXCACHE_FREEBUFS() { Xfree(pic), Xfree(packbuf), Xfree(midbuf); }
|
||||
|
||||
globaltexcache texcache;
|
||||
|
||||
|
@ -193,7 +193,7 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
|
|||
if (tilestat == -2) // bad filename
|
||||
hicclearsubst(dapicnum, dapalnum);
|
||||
|
||||
Bfree(pth);
|
||||
Xfree(pth);
|
||||
|
||||
return (drawingskybox || hicprecaching) ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
|
||||
}
|
||||
|
|
|
@ -760,12 +760,12 @@ int32_t tileCRC(int16_t tileNum)
|
|||
if (dasiz <= 0)
|
||||
return 0;
|
||||
|
||||
data = (char *)Bmalloc(dasiz);
|
||||
data = (char *)Xmalloc(dasiz);
|
||||
tileLoadData(tileNum, dasiz, data);
|
||||
|
||||
int32_t crc = Bcrc32((unsigned char *)data, (unsigned int)dasiz, 0);
|
||||
|
||||
Bfree(data);
|
||||
Xfree(data);
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ FHardwareTexture *gloadtex(const int32_t *picbuf, int32_t xsiz, int32_t ysiz, in
|
|||
tex->CreateTexture(xsiz, ysiz, false, false);
|
||||
tex->LoadTexture((uint8_t*)pic2); // RGBA
|
||||
tex->SetSampler(SamplerNoFilter);
|
||||
Bfree(pic2);
|
||||
Xfree(pic2);
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ skindidntfit:
|
|||
i--;
|
||||
if (i < 0) //Time-out! Very slow if this happens... but at least it still works :P
|
||||
{
|
||||
Bfree(zbit);
|
||||
Xfree(zbit);
|
||||
|
||||
//Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/
|
||||
j = 0;
|
||||
|
@ -578,7 +578,7 @@ skindidntfit:
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(shp); Bfree(zbit); Bfree(bx0);
|
||||
Xfree(shp); Xfree(zbit); Xfree(bx0);
|
||||
|
||||
return gvox;
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ static int32_t loadvox(const char *filnam)
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(tbuf);
|
||||
Xfree(tbuf);
|
||||
kclose(fil);
|
||||
|
||||
return 0;
|
||||
|
@ -766,8 +766,8 @@ static int32_t loadkvx(const char *filnam)
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(tbuf);
|
||||
Bfree(xyoffs);
|
||||
Xfree(tbuf);
|
||||
Xfree(xyoffs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -840,7 +840,7 @@ static int32_t loadkv6(const char *filnam)
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(ylen);
|
||||
Xfree(ylen);
|
||||
kclose(fil);
|
||||
|
||||
return 0;
|
||||
|
@ -855,7 +855,7 @@ void voxfree(voxmodel_t *m)
|
|||
DO_FREE_AND_NULL(m->quad);
|
||||
DO_FREE_AND_NULL(m->texid);
|
||||
|
||||
Bfree(m);
|
||||
Xfree(m);
|
||||
}
|
||||
|
||||
voxmodel_t *voxload(const char *filnam)
|
||||
|
|
|
@ -113,7 +113,7 @@ static void win_printversion(void)
|
|||
}
|
||||
|
||||
initprintf("Running on %s (build %lu.%lu.%lu)\n", str, osv.dwMajorVersion, osv.dwMinorVersion, osv.dwBuildNumber);
|
||||
Bfree(str);
|
||||
Xfree(str);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -344,7 +344,7 @@ int32_t addsearchpath_ProgramFiles(const char *p)
|
|||
Bsprintf(buffer,"%s/%s",ProgramFiles[i],p);
|
||||
if (addsearchpath(buffer) == 0) // if any work, return success
|
||||
returncode = 0;
|
||||
Bfree(buffer);
|
||||
Xfree(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
|||
|
||||
win_close();
|
||||
|
||||
Bfree(argvbuf);
|
||||
Xfree(argvbuf);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1074,17 +1074,17 @@ static void UninitDirectInput(void)
|
|||
|
||||
if (axisdefs)
|
||||
{
|
||||
for (i=joystick.numAxes-1; i>=0; i--) Bfree(axisdefs[i].name);
|
||||
for (i=joystick.numAxes-1; i>=0; i--) Xfree(axisdefs[i].name);
|
||||
DO_FREE_AND_NULL(axisdefs);
|
||||
}
|
||||
if (buttondefs)
|
||||
{
|
||||
for (i=joystick.numButtons-1; i>=0; i--) Bfree(buttondefs[i].name);
|
||||
for (i=joystick.numButtons-1; i>=0; i--) Xfree(buttondefs[i].name);
|
||||
DO_FREE_AND_NULL(buttondefs);
|
||||
}
|
||||
if (hatdefs)
|
||||
{
|
||||
for (i=joystick.numHats-1; i>=0; i--) Bfree(hatdefs[i].name);
|
||||
for (i=joystick.numHats-1; i>=0; i--) Xfree(hatdefs[i].name);
|
||||
DO_FREE_AND_NULL(hatdefs);
|
||||
}
|
||||
|
||||
|
@ -2039,7 +2039,7 @@ int32_t videoUpdatePalette(int32_t start, int32_t num)
|
|||
}
|
||||
|
||||
SetDIBColorTable(hDCSection, start, num, rgb);
|
||||
Bfree(rgb);
|
||||
Xfree(rgb);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -2923,7 +2923,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
|
|||
glinfo.sync = 1;
|
||||
}
|
||||
}
|
||||
Bfree(p);
|
||||
Xfree(p);
|
||||
}
|
||||
numpages = 2; // KJS 20031225: tell rotatesprite that it's double buffered!
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ dukeanim_t *Anim_Find(const char *s)
|
|||
ptr = hash_findcase(&h_dukeanim, str);
|
||||
}
|
||||
|
||||
Bfree(str);
|
||||
Xfree(str);
|
||||
}
|
||||
|
||||
return (dukeanim_t *)(ptr == -1 ? NULL : (dukeanim_t *)ptr);
|
||||
|
|
|
@ -1746,7 +1746,7 @@ static int32_t sort_sounds(int32_t how)
|
|||
{
|
||||
case 'g': // restore original order
|
||||
Bmemcpy(g_sndnum, g_definedsndnum, sizeof(int16_t)*n);
|
||||
Bfree(dst);
|
||||
Xfree(dst);
|
||||
return 0;
|
||||
case 's':
|
||||
compare_sounds = compare_sounds_s;
|
||||
|
@ -1773,7 +1773,7 @@ static int32_t sort_sounds(int32_t how)
|
|||
compare_sounds = compare_sounds_5;
|
||||
break;
|
||||
default:
|
||||
Bfree(dst);
|
||||
Xfree(dst);
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
@ -1815,7 +1815,7 @@ static int32_t sort_sounds(int32_t how)
|
|||
if (src != source)
|
||||
Bmemcpy(source, src, sizeof(int16_t) * n);
|
||||
|
||||
Bfree(dest);
|
||||
Xfree(dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4166,7 +4166,7 @@ ERROR_TOOMANYSPRITES:
|
|||
if (cursor < 0) message("Too many sprites in map!");
|
||||
else deletesprite(cursor);
|
||||
|
||||
Bfree(spritenums);
|
||||
Xfree(spritenums);
|
||||
|
||||
clearkeys();
|
||||
|
||||
|
@ -8482,7 +8482,7 @@ static void G_CheckCommandLine(int32_t argc, char const * const * argv)
|
|||
i++;
|
||||
}
|
||||
|
||||
Bfree(lengths);
|
||||
Xfree(lengths);
|
||||
|
||||
if (j > 0)
|
||||
{
|
||||
|
@ -8998,7 +8998,7 @@ static void SaveInHistory(const char *commandstr)
|
|||
|
||||
if (dosave)
|
||||
{
|
||||
Bfree(scripthist[scripthistend]);
|
||||
Xfree(scripthist[scripthistend]);
|
||||
scripthist[scripthistend] = Xstrdup(commandstr);
|
||||
scripthistend++;
|
||||
scripthistend %= SCRIPTHISTSIZ;
|
||||
|
@ -9109,7 +9109,7 @@ static int osdcmd_do(osdcmdptr_t parm)
|
|||
if (g_numCompilerErrors)
|
||||
{
|
||||
// g_scriptPtr = script + oscrofs; // handled in C_Compile()
|
||||
Bfree(tp);
|
||||
Xfree(tp);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
|
@ -9720,8 +9720,8 @@ static int32_t loadtilegroups(const char *fn)
|
|||
|
||||
for (i=0; i<tile_groups; i++)
|
||||
{
|
||||
Bfree(s_TileGroups[i].pIds);
|
||||
Bfree(s_TileGroups[i].szText);
|
||||
Xfree(s_TileGroups[i].pIds);
|
||||
Xfree(s_TileGroups[i].szText);
|
||||
Bmemcpy(&s_TileGroups[i], &blank, sizeof(blank));
|
||||
}
|
||||
tile_groups = 0;
|
||||
|
@ -9872,14 +9872,14 @@ static int32_t parseconsounds(scriptfile *script)
|
|||
{
|
||||
initprintf("Warning: invalid sound definition %s (sound number < 0 or >= MAXSOUNDS) on line %s:%d\n",
|
||||
definedname, script->filename,scriptfile_getlinum(script,cmdtokptr));
|
||||
Bfree(definedname);
|
||||
Xfree(definedname);
|
||||
num_invalidsounds++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (scriptfile_getstring(script, &filename))
|
||||
{
|
||||
Bfree(definedname);
|
||||
Xfree(definedname);
|
||||
num_invalidsounds++;
|
||||
break;
|
||||
}
|
||||
|
@ -9889,7 +9889,7 @@ static int32_t parseconsounds(scriptfile *script)
|
|||
{
|
||||
initprintf("Warning: invalid sound definition %s (filename too long) on line %s:%d\n",
|
||||
definedname, script->filename,scriptfile_getlinum(script,cmdtokptr));
|
||||
Bfree(definedname);
|
||||
Xfree(definedname);
|
||||
num_invalidsounds++;
|
||||
break;
|
||||
}
|
||||
|
@ -9897,7 +9897,7 @@ static int32_t parseconsounds(scriptfile *script)
|
|||
if (g_sounds[sndnum].filename)
|
||||
{
|
||||
duplicate = 1;
|
||||
Bfree(g_sounds[sndnum].filename);
|
||||
Xfree(g_sounds[sndnum].filename);
|
||||
}
|
||||
g_sounds[sndnum].filename = (char *)Xcalloc(slen+1,sizeof(uint8_t));
|
||||
// Hopefully noone does memcpy(..., g_sounds[].filename, BMAX_PATH)
|
||||
|
@ -9913,7 +9913,7 @@ static int32_t parseconsounds(scriptfile *script)
|
|||
if (0)
|
||||
{
|
||||
BAD:
|
||||
Bfree(definedname);
|
||||
Xfree(definedname);
|
||||
DO_FREE_AND_NULL(g_sounds[sndnum].filename);
|
||||
num_invalidsounds++;
|
||||
break;
|
||||
|
@ -9922,7 +9922,7 @@ BAD:
|
|||
if (g_sounds[sndnum].definedname)
|
||||
{
|
||||
duplicate = 1;
|
||||
Bfree(g_sounds[sndnum].definedname);
|
||||
Xfree(g_sounds[sndnum].definedname);
|
||||
}
|
||||
if (duplicate)
|
||||
initprintf("warning: duplicate sound #%d, overwriting\n", sndnum);
|
||||
|
@ -10055,7 +10055,7 @@ int32_t ExtInit(void)
|
|||
Bsprintf(tempbuf, "m32_settings.cfg");
|
||||
else Bsprintf(tempbuf,"%s_m32_settings.cfg",p);
|
||||
OSD_Exec(tempbuf);
|
||||
Bfree(ptr);
|
||||
Xfree(ptr);
|
||||
}
|
||||
|
||||
// backup pathsearchmode so that a later open
|
||||
|
@ -10138,11 +10138,11 @@ void ExtUnInit(void)
|
|||
#if 0
|
||||
for (i = MAX_TILE_GROUPS-1; i >= 0; i--)
|
||||
{
|
||||
Bfree(s_TileGroups[i].pIds);
|
||||
Bfree(s_TileGroups[i].szText);
|
||||
Xfree(s_TileGroups[i].pIds);
|
||||
Xfree(s_TileGroups[i].szText);
|
||||
}
|
||||
for (i = numhelppages-1; i >= 0; i--) Bfree(helppage[i]);
|
||||
Bfree(helppage);
|
||||
for (i = numhelppages-1; i >= 0; i--) Xfree(helppage[i]);
|
||||
Xfree(helppage);
|
||||
#endif
|
||||
|
||||
Duke_CommonCleanup();
|
||||
|
@ -10684,7 +10684,7 @@ static void Keys2d3d(void)
|
|||
{
|
||||
// map_revision = 0;
|
||||
create_map_snapshot(); // initial map state
|
||||
// Bfree(mapstate->next);
|
||||
// Xfree(mapstate->next);
|
||||
// mapstate = mapstate->prev;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -55,13 +55,13 @@ char *g_rtsNamePtr = NULL;
|
|||
|
||||
void clearGrpNamePtr(void)
|
||||
{
|
||||
Bfree(g_grpNamePtr);
|
||||
Xfree(g_grpNamePtr);
|
||||
// g_grpNamePtr assumed to be assigned to right after
|
||||
}
|
||||
|
||||
void clearScriptNamePtr(void)
|
||||
{
|
||||
Bfree(g_scriptNamePtr);
|
||||
Xfree(g_scriptNamePtr);
|
||||
// g_scriptNamePtr assumed to be assigned to right after
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ void G_ExtInit(void)
|
|||
#ifdef EDUKE32_OSX
|
||||
char *appdir = Bgetappdir();
|
||||
addsearchpath(appdir);
|
||||
Bfree(appdir);
|
||||
Xfree(appdir);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PHYSFS
|
||||
|
@ -292,8 +292,8 @@ void G_ExtInit(void)
|
|||
i==-1 ? "not a directory" : "no such directory");
|
||||
}
|
||||
|
||||
Bfree(CommandPaths->str);
|
||||
Bfree(CommandPaths);
|
||||
Xfree(CommandPaths->str);
|
||||
Xfree(CommandPaths);
|
||||
CommandPaths = s;
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ void G_ExtInit(void)
|
|||
}
|
||||
if (asperr == 0)
|
||||
buildvfs_chdir(cwd);
|
||||
Bfree(homedir);
|
||||
Xfree(homedir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,8 +499,8 @@ void G_LoadGroups(int32_t autoload)
|
|||
G_DoAutoload(CommandGrps->str);
|
||||
}
|
||||
|
||||
Bfree(CommandGrps->str);
|
||||
Bfree(CommandGrps);
|
||||
Xfree(CommandGrps->str);
|
||||
Xfree(CommandGrps);
|
||||
CommandGrps = s;
|
||||
}
|
||||
pathsearchmode = bakpathsearchmode;
|
||||
|
@ -759,7 +759,7 @@ static void G_ParseSteamKeyValuesForPaths(const char *vdf)
|
|||
G_AddSteamPaths(result);
|
||||
}
|
||||
|
||||
Bfree(vdfbufstart);
|
||||
Xfree(vdfbufstart);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -779,7 +779,7 @@ void G_AddSearchPaths(void)
|
|||
Bsnprintf(buf, sizeof(buf), "%s/.steam/steam/steamapps/libraryfolders.vdf", homepath);
|
||||
G_ParseSteamKeyValuesForPaths(buf);
|
||||
|
||||
Bfree(homepath);
|
||||
Xfree(homepath);
|
||||
|
||||
addsearchpath("/usr/share/games/jfduke3d");
|
||||
addsearchpath("/usr/local/share/games/jfduke3d");
|
||||
|
@ -814,8 +814,8 @@ void G_AddSearchPaths(void)
|
|||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
Bfree(applications[i]);
|
||||
Bfree(support[i]);
|
||||
Xfree(applications[i]);
|
||||
Xfree(support[i]);
|
||||
}
|
||||
#elif defined (_WIN32)
|
||||
char buf[BMAX_PATH] = {0};
|
||||
|
@ -1151,11 +1151,11 @@ buildvfs_kfd S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic
|
|||
goto success;
|
||||
#endif
|
||||
|
||||
Bfree(testfn);
|
||||
Xfree(testfn);
|
||||
return origfp;
|
||||
|
||||
success:
|
||||
Bfree(testfn);
|
||||
Xfree(testfn);
|
||||
kclose(origfp);
|
||||
return fp;
|
||||
}
|
||||
|
|
|
@ -699,7 +699,7 @@ static void G_ReadGLFrame(void)
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(frame);
|
||||
Xfree(frame);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -5145,7 +5145,7 @@ static void parsedefinitions_game_include(const char *fileName, scriptfile *pScr
|
|||
|
||||
static void parsedefinitions_game_animsounds(scriptfile *pScript, const char * blockEnd, char const * fileName, dukeanim_t * animPtr)
|
||||
{
|
||||
Bfree(animPtr->sounds);
|
||||
Xfree(animPtr->sounds);
|
||||
|
||||
size_t numPairs = 0, allocSize = 4;
|
||||
|
||||
|
@ -5563,7 +5563,7 @@ void G_UpdateAppTitle(void)
|
|||
|
||||
static void G_FreeHashAnim(const char * /*string*/, intptr_t key)
|
||||
{
|
||||
Bfree((void *)key);
|
||||
Xfree((void *)key);
|
||||
}
|
||||
|
||||
static void G_Cleanup(void)
|
||||
|
@ -5574,36 +5574,36 @@ static void G_Cleanup(void)
|
|||
|
||||
for (i=(MAXLEVELS*(MAXVOLUMES+1))-1; i>=0; i--) // +1 volume for "intro", "briefing" music
|
||||
{
|
||||
Bfree(g_mapInfo[i].name);
|
||||
Bfree(g_mapInfo[i].filename);
|
||||
Bfree(g_mapInfo[i].musicfn);
|
||||
Xfree(g_mapInfo[i].name);
|
||||
Xfree(g_mapInfo[i].filename);
|
||||
Xfree(g_mapInfo[i].musicfn);
|
||||
|
||||
G_FreeMapState(i);
|
||||
}
|
||||
|
||||
for (i=MAXQUOTES-1; i>=0; i--)
|
||||
{
|
||||
Bfree(apStrings[i]);
|
||||
Bfree(apXStrings[i]);
|
||||
Xfree(apStrings[i]);
|
||||
Xfree(apXStrings[i]);
|
||||
}
|
||||
|
||||
for (i=MAXPLAYERS-1; i>=0; i--)
|
||||
{
|
||||
Bfree(g_player[i].ps);
|
||||
Bfree(g_player[i].inputBits);
|
||||
Xfree(g_player[i].ps);
|
||||
Xfree(g_player[i].inputBits);
|
||||
}
|
||||
|
||||
for (i=MAXSOUNDS-1; i>=0; i--)
|
||||
{
|
||||
Bfree(g_sounds[i].filename);
|
||||
Xfree(g_sounds[i].filename);
|
||||
}
|
||||
#if !defined LUNATIC
|
||||
if (label != (char *)&sprite[0]) Bfree(label);
|
||||
if (labelcode != (int32_t *)§or[0]) Bfree(labelcode);
|
||||
Bfree(apScript);
|
||||
Bfree(bitptr);
|
||||
if (label != (char *)&sprite[0]) Xfree(label);
|
||||
if (labelcode != (int32_t *)§or[0]) Xfree(labelcode);
|
||||
Xfree(apScript);
|
||||
Xfree(bitptr);
|
||||
|
||||
// Bfree(MusicPtr);
|
||||
// Xfree(MusicPtr);
|
||||
|
||||
Gv_Clear();
|
||||
|
||||
|
@ -5954,7 +5954,7 @@ static void G_Startup(void)
|
|||
}
|
||||
buildvfs_chdir(cwd);
|
||||
#ifndef __ANDROID__ //This crashes on *some* Android devices. Small onetime memory leak. TODO fix above function
|
||||
Bfree(cwd);
|
||||
Xfree(cwd);
|
||||
#endif
|
||||
}
|
||||
else if (artLoadFiles("tiles%03d.art",MAXCACHE1DSIZE) < 0)
|
||||
|
@ -6201,7 +6201,7 @@ int app_main(int argc, char const * const * argv)
|
|||
else
|
||||
Bstrcpy(cwd, APPBASENAME ".log");
|
||||
OSD_SetLogFile(cwd);
|
||||
Bfree(homedir);
|
||||
Xfree(homedir);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -6511,7 +6511,7 @@ int app_main(int argc, char const * const * argv)
|
|||
else
|
||||
Bsprintf(tempbuf, "%s_settings.cfg", p);
|
||||
|
||||
Bfree(setupFileName);
|
||||
Xfree(setupFileName);
|
||||
|
||||
OSD_Exec(tempbuf);
|
||||
OSD_Exec("autoexec.cfg");
|
||||
|
|
|
@ -1667,7 +1667,7 @@ static int32_t C_GetNextValue(int32_t type)
|
|||
{
|
||||
char *gl = C_GetLabelType(labeltype[i]);
|
||||
initprintf("%s:%d: debug: %s label `%s'.\n",g_scriptFileName,g_lineNumber,gl,label+(i<<6));
|
||||
Bfree(gl);
|
||||
Xfree(gl);
|
||||
}
|
||||
|
||||
scriptWriteValue(labelcode[i]);
|
||||
|
@ -1683,8 +1683,8 @@ static int32_t C_GetNextValue(int32_t type)
|
|||
C_ReportError(-1);
|
||||
initprintf("%s:%d: warning: expected %s, found %s.\n",g_scriptFileName,g_lineNumber,el,gl);
|
||||
g_warningCnt++;
|
||||
Bfree(el);
|
||||
Bfree(gl);
|
||||
Xfree(el);
|
||||
Xfree(gl);
|
||||
return -1; // valid label name, but wrong type
|
||||
}
|
||||
|
||||
|
@ -1933,7 +1933,7 @@ static void C_Include(const char *confile)
|
|||
|
||||
textptr = origtptr;
|
||||
|
||||
Bfree(mptr);
|
||||
Xfree(mptr);
|
||||
}
|
||||
#endif // !defined LUNATIC
|
||||
|
||||
|
@ -2016,7 +2016,7 @@ void C_DefineMusic(int volumeNum, int levelNum, const char *fileName)
|
|||
|
||||
map_t *const pMapInfo = &g_mapInfo[(MAXLEVELS*volumeNum)+levelNum];
|
||||
|
||||
Bfree(pMapInfo->musicfn);
|
||||
Xfree(pMapInfo->musicfn);
|
||||
pMapInfo->musicfn = dup_filename(fileName);
|
||||
check_filename_case(pMapInfo->musicfn);
|
||||
}
|
||||
|
@ -2029,7 +2029,7 @@ void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5])
|
|||
{
|
||||
sound_t *const snd = &g_sounds[sndidx];
|
||||
|
||||
Bfree(snd->filename);
|
||||
Xfree(snd->filename);
|
||||
snd->filename = dup_filename(fn);
|
||||
check_filename_case(snd->filename);
|
||||
|
||||
|
@ -2076,11 +2076,11 @@ void C_DefineLevelName(int32_t vol, int32_t lev, const char *fn,
|
|||
{
|
||||
map_t *const map = &g_mapInfo[(MAXLEVELS*vol)+lev];
|
||||
|
||||
Bfree(map->filename);
|
||||
Xfree(map->filename);
|
||||
map->filename = dup_filename(fn);
|
||||
|
||||
// TODO: truncate to 32 chars?
|
||||
Bfree(map->name);
|
||||
Xfree(map->name);
|
||||
map->name = Xstrdup(levelname);
|
||||
|
||||
map->partime = REALGAMETICSPERSEC * partime;
|
||||
|
@ -2549,7 +2549,7 @@ DO_DEFSTATE:
|
|||
C_ReportError(-1);
|
||||
initprintf("%s:%d: warning: expected state, found %s.\n", g_scriptFileName, g_lineNumber, gl);
|
||||
g_warningCnt++;
|
||||
Bfree(gl);
|
||||
Xfree(gl);
|
||||
scriptWriteAtOffset(CON_NULLOP, &g_scriptPtr[-1]); // get rid of the state, leaving a nullop to satisfy if conditions
|
||||
continue; // valid label name, but wrong type
|
||||
}
|
||||
|
@ -6232,7 +6232,7 @@ void C_Compile(const char *fileName)
|
|||
g_scriptcrc = Bcrc32(NULL, 0, 0L);
|
||||
g_scriptcrc = Bcrc32(textptr, kFileLen, g_scriptcrc);
|
||||
|
||||
Bfree(apScript);
|
||||
Xfree(apScript);
|
||||
|
||||
apScript = (intptr_t *)Xcalloc(1, g_scriptSize * sizeof(intptr_t));
|
||||
bitptr = (uint8_t *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t));
|
||||
|
|
|
@ -5544,7 +5544,7 @@ badindex:
|
|||
|
||||
if (newBytes != oldBytes)
|
||||
{
|
||||
Baligned_free(pValues);
|
||||
Xaligned_free(pValues);
|
||||
pValues = (intptr_t *)Xaligned_alloc(ARRAY_ALIGNMENT, newBytes);
|
||||
}
|
||||
|
||||
|
@ -5572,7 +5572,7 @@ badindex:
|
|||
pValues[i] = ((int32_t *)pArray)[i];
|
||||
}
|
||||
|
||||
Bfree(pArray);
|
||||
Xfree(pArray);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -5624,7 +5624,7 @@ badindex:
|
|||
pArray[k] = Gv_GetArrayValue(arrayNum, k);
|
||||
|
||||
buildvfs_fwrite(pArray, 1, numDiskBytes, fil);
|
||||
Bfree(pArray);
|
||||
Xfree(pArray);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -5659,7 +5659,7 @@ badindex:
|
|||
#endif
|
||||
if (newSize == 0)
|
||||
{
|
||||
Baligned_free(arr.pValues);
|
||||
Xaligned_free(arr.pValues);
|
||||
arr.pValues = nullptr;
|
||||
arr.size = 0;
|
||||
dispatch();
|
||||
|
@ -5680,7 +5680,7 @@ badindex:
|
|||
arr.pValues = newArray;
|
||||
arr.size = newSize;
|
||||
|
||||
Baligned_free(oldArray);
|
||||
Xaligned_free(oldArray);
|
||||
|
||||
dispatch();
|
||||
}
|
||||
|
@ -6496,7 +6496,7 @@ void G_SaveMapState(void)
|
|||
continue;
|
||||
|
||||
save->arraysiz[i] = aGameArrays[i].size;
|
||||
Baligned_free(save->arrays[i]);
|
||||
Xaligned_free(save->arrays[i]);
|
||||
save->arrays[i] = (intptr_t *)Xaligned_alloc(ARRAY_ALIGNMENT, Gv_GetArrayAllocSize(i));
|
||||
Bmemcpy(&save->arrays[i][0], aGameArrays[i].pValues, Gv_GetArrayAllocSize(i));
|
||||
}
|
||||
|
@ -6511,7 +6511,7 @@ void G_SaveMapState(void)
|
|||
else
|
||||
{
|
||||
char *savecode = Xstrdup(svcode);
|
||||
Bfree(save->savecode);
|
||||
Xfree(save->savecode);
|
||||
save->savecode = savecode;
|
||||
}
|
||||
#endif
|
||||
|
@ -6629,7 +6629,7 @@ void G_RestoreMapState(void)
|
|||
continue;
|
||||
|
||||
aGameArrays[i].size = pSavedState->arraysiz[i];
|
||||
Baligned_free(aGameArrays[i].pValues);
|
||||
Xaligned_free(aGameArrays[i].pValues);
|
||||
aGameArrays[i].pValues = (intptr_t *) Xaligned_alloc(ARRAY_ALIGNMENT, Gv_GetArrayAllocSize(i));
|
||||
|
||||
Bmemcpy(aGameArrays[i].pValues, pSavedState->arrays[i], Gv_GetArrayAllocSize(i));
|
||||
|
|
|
@ -251,13 +251,13 @@ static void FreeGameList(void)
|
|||
{
|
||||
while (listgrps)
|
||||
{
|
||||
Bfree(listgrps->name);
|
||||
Bfree(listgrps->scriptname);
|
||||
Bfree(listgrps->defname);
|
||||
Bfree(listgrps->rtsname);
|
||||
Xfree(listgrps->name);
|
||||
Xfree(listgrps->scriptname);
|
||||
Xfree(listgrps->defname);
|
||||
Xfree(listgrps->rtsname);
|
||||
|
||||
grpinfo_t * const fg = listgrps->next;
|
||||
Bfree(listgrps);
|
||||
Xfree(listgrps);
|
||||
listgrps = fg;
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ static void FreeGroupsCache(void)
|
|||
while (grpcache)
|
||||
{
|
||||
struct grpcache * const fg = grpcache->next;
|
||||
Bfree(grpcache);
|
||||
Xfree(grpcache);
|
||||
grpcache = fg;
|
||||
}
|
||||
}
|
||||
|
@ -328,8 +328,8 @@ static void RemoveGroup(grpfile_t *igrp)
|
|||
else
|
||||
prev->next = grp->next;
|
||||
|
||||
Bfree((char *)grp->filename);
|
||||
Bfree(grp);
|
||||
Xfree((char *)grp->filename);
|
||||
Xfree(grp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -388,10 +388,10 @@ static void ProcessGroups(CACHE1D_FIND_REC *srch)
|
|||
if (findfrompath(sidx->name, &fn)) continue; // failed to resolve the filename
|
||||
if (Bstat(fn, &st))
|
||||
{
|
||||
Bfree(fn);
|
||||
Xfree(fn);
|
||||
continue;
|
||||
} // failed to stat the file
|
||||
Bfree(fn);
|
||||
Xfree(fn);
|
||||
if (fg->size == (int32_t)st.st_size && fg->mtime == (int32_t)st.st_mtime)
|
||||
{
|
||||
grpinfo_t const * const grptype = FindGrpInfo(fg->crcval, fg->size);
|
||||
|
@ -453,7 +453,7 @@ static void ProcessGroups(CACHE1D_FIND_REC *srch)
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(buf);
|
||||
Xfree(buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -508,7 +508,7 @@ int32_t ScanGroups(void)
|
|||
{
|
||||
fgg = fg->next;
|
||||
fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval);
|
||||
Bfree(fg);
|
||||
Xfree(fg);
|
||||
i++;
|
||||
}
|
||||
buildvfs_fclose(fp);
|
||||
|
@ -529,9 +529,9 @@ void FreeGroups(void)
|
|||
{
|
||||
while (foundgrps)
|
||||
{
|
||||
Bfree((char *)foundgrps->filename);
|
||||
Xfree((char *)foundgrps->filename);
|
||||
grpfile_t * const fg = foundgrps->next;
|
||||
Bfree(foundgrps);
|
||||
Xfree(foundgrps);
|
||||
foundgrps = fg;
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ nextline:
|
|||
}
|
||||
|
||||
// ----
|
||||
Bfree(filebuf);
|
||||
Xfree(filebuf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -399,11 +399,11 @@ static void free_self_and_successors(mapundo_t *mapst)
|
|||
{
|
||||
(*refcnt)--;
|
||||
if (*refcnt == 0)
|
||||
Bfree(refcnt); // free the block!
|
||||
Xfree(refcnt); // free the block!
|
||||
}
|
||||
}
|
||||
|
||||
Bfree(cur);
|
||||
Xfree(cur);
|
||||
|
||||
if (!prev)
|
||||
break;
|
||||
|
@ -492,7 +492,7 @@ void create_map_snapshot(void)
|
|||
}
|
||||
|
||||
create_compressed_block(2, tspri, Numsprites*sizeof(spritetype), temphash);
|
||||
Bfree(tspri);
|
||||
Xfree(tspri);
|
||||
}
|
||||
}
|
||||
#undef XXH__
|
||||
|
@ -1411,8 +1411,8 @@ too_many_errors:
|
|||
|
||||
if (seen_nextwalls)
|
||||
{
|
||||
Bfree(seen_nextwalls);
|
||||
Bfree(lastnextwallsource);
|
||||
Xfree(seen_nextwalls);
|
||||
Xfree(lastnextwallsource);
|
||||
}
|
||||
|
||||
corruptlevel = errlevel;
|
||||
|
@ -1741,7 +1741,7 @@ static void FuncMenu_Process(const StatusBarMenu *m, int32_t col, int32_t row)
|
|||
tmpscript[1+5+1+snlen] = 0;
|
||||
|
||||
M32RunScript(tmpscript);
|
||||
Bfree(tmpscript);
|
||||
Xfree(tmpscript);
|
||||
|
||||
if (vm.flags&VMFLAG_ERROR)
|
||||
printmessage16("There were errors while executing the menu function");
|
||||
|
|
|
@ -1470,7 +1470,7 @@ static int32_t C_GetNextValue(int32_t type)
|
|||
// {
|
||||
// gl = (char *)C_GetLabelType(labeltype[i]);
|
||||
// initprintf("%s:%d: debug: accepted %s label `%s'.\n",g_szScriptFileName,g_lineNumber,gl,label+(i*MAXLABELLEN));
|
||||
// Bfree(gl);
|
||||
// Xfree(gl);
|
||||
// }
|
||||
|
||||
*(g_scriptPtr++) = thesign*labelval[i];
|
||||
|
@ -1486,8 +1486,8 @@ static int32_t C_GetNextValue(int32_t type)
|
|||
gl = C_GetLabelType(labeltype[i]);
|
||||
C_CUSTOMERROR("expected %s, found %s.", el, gl);
|
||||
// initprintf("i=%d, %s!!! lt:%d t:%d\n", i, label+(i*MAXLABELLEN), labeltype[i], type);
|
||||
Bfree(el);
|
||||
Bfree(gl);
|
||||
Xfree(el);
|
||||
Xfree(gl);
|
||||
|
||||
return -1; // valid label name, but wrong type
|
||||
}
|
||||
|
@ -1779,7 +1779,7 @@ static int32_t C_ParseCommand(void)
|
|||
|
||||
textptr = origtptr;
|
||||
|
||||
Bfree(mptr);
|
||||
Xfree(mptr);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
@ -3721,7 +3721,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
|
|||
if (fp == buildvfs_kfd_invalid)
|
||||
{
|
||||
initprintf("M32 file `%s' not found.\n", mptr);
|
||||
Bfree(mptr);
|
||||
Xfree(mptr);
|
||||
//g_loadFromGroupOnly = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -3731,7 +3731,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
|
|||
initprintf(" \n");
|
||||
initprintf("--- Compiling: %s (%d bytes)\n",mptr,fs);
|
||||
Bstrcpy(g_szScriptFileName, mptr); // JBF 20031130: Store currently compiling file name
|
||||
Bfree(mptr);
|
||||
Xfree(mptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3779,7 +3779,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
|
|||
|
||||
//*script = g_scriptPtr-script;
|
||||
|
||||
Bfree(mptr);
|
||||
Xfree(mptr);
|
||||
|
||||
if (g_stateCount > ostateCount)
|
||||
{
|
||||
|
@ -4011,6 +4011,6 @@ void C_PrintErrorPosition()
|
|||
|
||||
initprintf("%s\n", buf);
|
||||
|
||||
Bfree(buf);
|
||||
Xfree(buf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4778,7 +4778,7 @@ void Net_Connect(const char *srvaddr)
|
|||
if (enet_host_service(g_netClient, &event, 5000) > 0 && event.type == ENET_EVENT_TYPE_CONNECT)
|
||||
{
|
||||
initprintf("Connection to %s:%d succeeded.\n", oursrvaddr, address.port);
|
||||
Bfree(oursrvaddr);
|
||||
Xfree(oursrvaddr);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -4793,7 +4793,7 @@ void Net_Connect(const char *srvaddr)
|
|||
}
|
||||
|
||||
// [75] note: it only gets here if there was an error
|
||||
Bfree(oursrvaddr);
|
||||
Xfree(oursrvaddr);
|
||||
Net_Disconnect();
|
||||
}
|
||||
|
||||
|
|
|
@ -2067,7 +2067,7 @@ void G_FreeMapState(int levelNum)
|
|||
ALIGNED_FREE_AND_NULL(board.savedstate->arrays[j]);
|
||||
}
|
||||
#else
|
||||
Bfree(board.savedstate->savecode);
|
||||
Xfree(board.savedstate->savecode);
|
||||
#endif
|
||||
|
||||
ALIGNED_FREE_AND_NULL(board.savedstate);
|
||||
|
|
|
@ -96,7 +96,7 @@ static int32_t RTS_AddFile(const char *filename)
|
|||
Bstrncpy(lump->name, fileinfo->name, 8);
|
||||
}
|
||||
|
||||
Bfree(fileinfoo);
|
||||
Xfree(fileinfoo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1909,7 +1909,7 @@ static void sv_quoteredefload()
|
|||
}
|
||||
static void sv_postquoteredef()
|
||||
{
|
||||
Bfree(savegame_quoteredefs), savegame_quoteredefs=NULL;
|
||||
Xfree(savegame_quoteredefs), savegame_quoteredefs=NULL;
|
||||
}
|
||||
static void sv_restsave()
|
||||
{
|
||||
|
@ -2055,7 +2055,7 @@ static int32_t El_ReadSaveCode(buildvfs_kfd fil)
|
|||
if (kdfread_LZ4(svcode, 1, slen, fil) != slen) // cnt and sz swapped
|
||||
{
|
||||
OSD_Printf("doloadplayer2: failed reading Lunatic gamevar restoration code.\n");
|
||||
Bfree(svcode);
|
||||
Xfree(svcode);
|
||||
return -104;
|
||||
}
|
||||
|
||||
|
@ -2069,7 +2069,7 @@ static int32_t El_ReadSaveCode(buildvfs_kfd fil)
|
|||
void El_FreeSaveCode(void)
|
||||
{
|
||||
// Free Lunatic gamevar savegame restoration Lua code.
|
||||
Bfree(g_elSavecode);
|
||||
Xfree(g_elSavecode);
|
||||
g_elSavecode = NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,7 @@ int32_t G_GetStringNumLines(const char *text, const char *end, const int32_t ite
|
|||
}
|
||||
// Note: Neither of these care about TEXT_LINEWRAP. This is intended.
|
||||
|
||||
// This function requires you to Bfree() the returned char*.
|
||||
// This function requires you to Xfree() the returned char*.
|
||||
char* G_GetSubString(const char *text, const char *end, const int32_t iter, const int32_t length)
|
||||
{
|
||||
char *line = (char*) Xmalloc((length+1) * sizeof(char));
|
||||
|
@ -536,7 +536,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
|
||||
linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x;
|
||||
|
||||
Bfree(line);
|
||||
Xfree(line);
|
||||
}
|
||||
|
||||
if (f & TEXT_XJUSTIFY)
|
||||
|
@ -728,7 +728,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
|
||||
int32_t linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x;
|
||||
|
||||
Bfree(line);
|
||||
Xfree(line);
|
||||
|
||||
if (f & TEXT_XJUSTIFY)
|
||||
{
|
||||
|
|
|
@ -75,7 +75,7 @@ bool CONTROL_BindsEnabled = 0;
|
|||
bool CONTROL_SmoothMouse = 0;
|
||||
|
||||
#define CONTROL_CheckRange(which) ((unsigned)which >= (unsigned)CONTROL_NUM_FLAGS)
|
||||
#define BIND(x, s, r, k) do { Bfree(x.cmdstr); x.cmdstr = s; x.repeat = r; x.key = k; } while (0)
|
||||
#define BIND(x, s, r, k) do { Xfree(x.cmdstr); x.cmdstr = s; x.repeat = r; x.key = k; } while (0)
|
||||
|
||||
void CONTROL_ClearAllBinds(void)
|
||||
{
|
||||
|
|
|
@ -77,15 +77,15 @@ void SCRIPT_Delete(int32_t scripthandle)
|
|||
{
|
||||
s = SCRIPT(scripthandle,apScript)->nextsection;
|
||||
SCRIPT_FreeSection(SCRIPT(scripthandle,apScript));
|
||||
Bfree(SCRIPT(scripthandle,apScript));
|
||||
Xfree(SCRIPT(scripthandle,apScript));
|
||||
SCRIPT(scripthandle,apScript) = s;
|
||||
}
|
||||
|
||||
SCRIPT_FreeSection(SCRIPT(scripthandle, apScript));
|
||||
Bfree(SCRIPT(scripthandle,apScript));
|
||||
Xfree(SCRIPT(scripthandle,apScript));
|
||||
}
|
||||
|
||||
Bfree(SC(scripthandle));
|
||||
Xfree(SC(scripthandle));
|
||||
SC(scripthandle) = 0;
|
||||
}
|
||||
|
||||
|
@ -100,16 +100,16 @@ void SCRIPT_FreeSection(ScriptSectionType * section)
|
|||
{
|
||||
e = section->entries->nextentry;
|
||||
|
||||
Bfree(section->entries->name);
|
||||
Bfree(section->entries->value);
|
||||
Bfree(section->entries);
|
||||
Xfree(section->entries->name);
|
||||
Xfree(section->entries->value);
|
||||
Xfree(section->entries);
|
||||
section->entries = e;
|
||||
}
|
||||
|
||||
Bfree(section->entries->name);
|
||||
Bfree(section->entries->value);
|
||||
Bfree(section->entries);
|
||||
Bfree(section->name);
|
||||
Xfree(section->entries->name);
|
||||
Xfree(section->entries->value);
|
||||
Xfree(section->entries);
|
||||
Xfree(section->name);
|
||||
}
|
||||
|
||||
#define AllocSection(s) \
|
||||
|
@ -220,7 +220,7 @@ void SCRIPT_AddEntry(int32_t scripthandle, const char * sectionname, const char
|
|||
}
|
||||
}
|
||||
|
||||
Bfree(e->value);
|
||||
Xfree(e->value);
|
||||
e->value = Xstrdup(entryvalue);
|
||||
}
|
||||
|
||||
|
@ -460,13 +460,13 @@ int32_t SCRIPT_Load(char const * filename)
|
|||
s = SCRIPT_Init(filename);
|
||||
if (s<0)
|
||||
{
|
||||
Bfree(b);
|
||||
Xfree(b);
|
||||
return -1;
|
||||
}
|
||||
|
||||
SCRIPT_ParseBuffer(s,b,l);
|
||||
|
||||
Bfree(b);
|
||||
Xfree(b);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ void SCRIPT_PutString(int32_t scripthandle, char const *sectionname, char const
|
|||
*p=0;
|
||||
|
||||
SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw);
|
||||
Bfree(raw);
|
||||
Xfree(raw);
|
||||
}
|
||||
|
||||
void SCRIPT_PutDoubleString
|
||||
|
@ -864,7 +864,7 @@ void SCRIPT_PutDoubleString
|
|||
*p=0;
|
||||
|
||||
SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw);
|
||||
Bfree(raw);
|
||||
Xfree(raw);
|
||||
}
|
||||
|
||||
void SCRIPT_PutNumber
|
||||
|
|
Loading…
Reference in a new issue