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); return (-1);
} }
if ((say = (int *) HMalloc((dst->h + 1) * sizeof(Uint32))) == NULL) { if ((say = (int *) HMalloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
free(sax); HFree(sax);
return (-1); return (-1);
} }
@@ -198,8 +198,8 @@ int zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int smooth)
/* /*
* Remove temp arrays * Remove temp arrays
*/ */
free(sax); HFree(sax);
free(say); HFree(say);
return (0); return (0);
} }
@@ -232,7 +232,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst)
} }
if ((say = (Uint32 *) HMalloc(dst->h * sizeof(Uint32))) == NULL) { if ((say = (Uint32 *) HMalloc(dst->h * sizeof(Uint32))) == NULL) {
if (sax != NULL) { if (sax != NULL) {
free(sax); HFree(sax);
} }
return (-1); return (-1);
} }
@@ -313,8 +313,8 @@ int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst)
/* /*
* Remove temp arrays * Remove temp arrays
*/ */
free(sax); HFree(sax);
free(say); HFree(say);
return (0); return (0);
} }
+1
View File
@@ -382,6 +382,7 @@ mem_init (void)
{ {
int i; int i;
_MemorySem = CreateSemaphore (1);
SetSemaphore (_MemorySem); SetSemaphore (_MemorySem);
freeListHead = &extents[0]; freeListHead = &extents[0];
-2
View File
@@ -25,8 +25,6 @@
#define Stream FILE #define Stream FILE
#define MEMTYPE_ANY 1 #define MEMTYPE_ANY 1
extern Semaphore _MemorySem;
#define SqrtF16 sqrt #define SqrtF16 sqrt
#define Atan2F16 atan2 #define Atan2F16 atan2
#define CosF16 cos #define CosF16 cos
@@ -29,6 +29,7 @@
#include <stdio.h> #include <stdio.h>
#include <vorbis/codec.h> #include <vorbis/codec.h>
#include <vorbis/vorbisfile.h> #include <vorbis/vorbisfile.h>
#include "libs/misc.h"
#include "decoder.h" #include "decoder.h"
#include "wav.h" #include "wav.h"
#include "libs/sound/sound_common.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) if ((vfp = fopen (filename, "r")) == NULL)
{ {
fprintf (stderr, "SoundDecoder_Load(): couldn't open %s\n", filename); fprintf (stderr, "SoundDecoder_Load(): couldn't open %s\n", filename);
free (vf); HFree (vf);
return NULL; 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); fprintf (stderr, "SoundDecoder_Load(): ov_open_callbacks failed for %s, error code %d\n", filename, rc);
fclose (vfp); fclose (vfp);
free (vf); HFree (vf);
return NULL; 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); fprintf (stderr, "SoundDecoder_Load(): failed to retrieve ogg bitstream info for %s\n", filename);
ov_clear (vf); ov_clear (vf);
free (vf); HFree (vf);
return NULL; return NULL;
} }
@@ -459,7 +460,7 @@ void SoundDecoder_Free (TFB_SoundDecoder *decoder)
OggVorbis_File *vf = (OggVorbis_File *) decoder->data; OggVorbis_File *vf = (OggVorbis_File *) decoder->data;
//fprintf (stderr, "SoundDecoder_Free(): freeing %s\n", decoder->filename); //fprintf (stderr, "SoundDecoder_Free(): freeing %s\n", decoder->filename);
ov_clear (vf); ov_clear (vf);
free (vf); HFree (vf);
break; break;
} }
default: default:
@@ -469,9 +470,9 @@ void SoundDecoder_Free (TFB_SoundDecoder *decoder)
} }
} }
free (decoder->buffer); HFree (decoder->buffer);
free (decoder->filename); HFree (decoder->filename);
free (decoder); HFree (decoder);
} }
#endif #endif
@@ -47,7 +47,7 @@ static char *strdup(const char *str)
{ {
char *newstr; char *newstr;
newstr = (char *)HMalloc(strlen(str)+1); newstr = (char *)malloc(strlen(str)+1);
if ( newstr != NULL ) { if ( newstr != NULL ) {
strcpy(newstr, str); strcpy(newstr, str);
} }
@@ -27,6 +27,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <memory.h> #include <memory.h>
#include "libs/misc.h"
#include "wav.h" #include "wav.h"
+1 -2
View File
@@ -219,9 +219,8 @@ main (int argc, char *argv[])
InitTimeSystem (); InitTimeSystem ();
InitTaskSystem (); InitTaskSystem ();
_MemorySem = CreateSemaphore (1);
GraphicsSem = CreateSemaphore (1);
mem_init (); mem_init ();
GraphicsSem = CreateSemaphore (1);
init_xform_control (); init_xform_control ();
TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp); TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp);