Some fixes on the HMalloc patch.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@373 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2002-12-07 20:06:39 +00:00
parent 8c212b2b52
commit 76dde1f05c
7 changed files with 18 additions and 18 deletions
+6 -6
View File
@@ -56,7 +56,7 @@ int zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int smooth)
return (-1);
}
if ((say = (int *) HMalloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
free(sax);
HFree(sax);
return (-1);
}
@@ -198,8 +198,8 @@ int zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int smooth)
/*
* Remove temp arrays
*/
free(sax);
free(say);
HFree(sax);
HFree(say);
return (0);
}
@@ -232,7 +232,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst)
}
if ((say = (Uint32 *) HMalloc(dst->h * sizeof(Uint32))) == NULL) {
if (sax != NULL) {
free(sax);
HFree(sax);
}
return (-1);
}
@@ -313,8 +313,8 @@ int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst)
/*
* Remove temp arrays
*/
free(sax);
free(say);
HFree(sax);
HFree(say);
return (0);
}
+1
View File
@@ -382,6 +382,7 @@ mem_init (void)
{
int i;
_MemorySem = CreateSemaphore (1);
SetSemaphore (_MemorySem);
freeListHead = &extents[0];
-2
View File
@@ -25,8 +25,6 @@
#define Stream FILE
#define MEMTYPE_ANY 1
extern Semaphore _MemorySem;
#define SqrtF16 sqrt
#define Atan2F16 atan2
#define CosF16 cos
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
#include "libs/misc.h"
#include "decoder.h"
#include "wav.h"
#include "libs/sound/sound_common.h"
@@ -207,7 +208,7 @@ TFB_SoundDecoder* SoundDecoder_Load (char *filename, ALuint buffer_size)
if ((vfp = fopen (filename, "r")) == NULL)
{
fprintf (stderr, "SoundDecoder_Load(): couldn't open %s\n", filename);
free (vf);
HFree (vf);
return NULL;
}
@@ -220,7 +221,7 @@ TFB_SoundDecoder* SoundDecoder_Load (char *filename, ALuint buffer_size)
{
fprintf (stderr, "SoundDecoder_Load(): ov_open_callbacks failed for %s, error code %d\n", filename, rc);
fclose (vfp);
free (vf);
HFree (vf);
return NULL;
}
@@ -229,7 +230,7 @@ TFB_SoundDecoder* SoundDecoder_Load (char *filename, ALuint buffer_size)
{
fprintf (stderr, "SoundDecoder_Load(): failed to retrieve ogg bitstream info for %s\n", filename);
ov_clear (vf);
free (vf);
HFree (vf);
return NULL;
}
@@ -459,7 +460,7 @@ void SoundDecoder_Free (TFB_SoundDecoder *decoder)
OggVorbis_File *vf = (OggVorbis_File *) decoder->data;
//fprintf (stderr, "SoundDecoder_Free(): freeing %s\n", decoder->filename);
ov_clear (vf);
free (vf);
HFree (vf);
break;
}
default:
@@ -469,9 +470,9 @@ void SoundDecoder_Free (TFB_SoundDecoder *decoder)
}
}
free (decoder->buffer);
free (decoder->filename);
free (decoder);
HFree (decoder->buffer);
HFree (decoder->filename);
HFree (decoder);
}
#endif
@@ -47,7 +47,7 @@ static char *strdup(const char *str)
{
char *newstr;
newstr = (char *)HMalloc(strlen(str)+1);
newstr = (char *)malloc(strlen(str)+1);
if ( newstr != NULL ) {
strcpy(newstr, str);
}
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include "libs/misc.h"
#include "wav.h"
+1 -2
View File
@@ -219,9 +219,8 @@ main (int argc, char *argv[])
InitTimeSystem ();
InitTaskSystem ();
_MemorySem = CreateSemaphore (1);
GraphicsSem = CreateSemaphore (1);
mem_init ();
GraphicsSem = CreateSemaphore (1);
init_xform_control ();
TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp);