本文整理汇总了C++中HFree函数的典型用法代码示例。如果您正苦于以下问题:C++ HFree函数的具体用法?C++ HFree怎么用?C++ HFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TFB_UninitInput
void
TFB_UninitInput (void)
{
VControl_Uninit ();
HFree (controls);
HFree (kbdstate);
}
示例2: _ReleaseCelData
BOOLEAN
_ReleaseCelData (void *handle)
{
DRAWABLE DrawablePtr;
int cel_ct;
FRAME FramePtr = NULL;
if ((DrawablePtr = handle) == 0)
return (FALSE);
cel_ct = DrawablePtr->MaxIndex + 1;
FramePtr = DrawablePtr->Frame;
HFree (handle);
if (FramePtr)
{
int i;
for (i = 0; i < cel_ct; i++)
{
TFB_Image *img = FramePtr[i].image;
if (img)
{
FramePtr[i].image = NULL;
TFB_DrawScreen_DeleteImage (img);
}
}
HFree (FramePtr);
}
return (TRUE);
}
示例3: TFB_DrawImage_Delete
void
TFB_DrawImage_Delete (TFB_Image *image)
{
if (image == 0)
{
log_add (log_Warning, "INTERNAL ERROR: Tried to delete a null image!");
/* Should we die here? */
return;
}
LockMutex (image->mutex);
TFB_DrawCanvas_Delete (image->NormalImg);
if (image->ScaledImg) {
TFB_DrawCanvas_Delete (image->ScaledImg);
}
if (image->Palette)
HFree (image->Palette);
UnlockMutex (image->mutex);
DestroyMutex (image->mutex);
HFree (image);
}
示例4: VideoDecoder_Free
void
VideoDecoder_Free (TFB_VideoDecoder *decoder)
{
if (!decoder)
return;
decoder->funcs->Close (decoder);
decoder->funcs->Term (decoder);
HFree (decoder->filename);
HFree (decoder);
}
示例5: CreateThread_SDL
Thread
CreateThread_SDL (ThreadFunction func, void *data, SDWORD stackSize
#ifdef NAMED_SYNCHRO
, const char *name
#endif
)
{
TrueThread thread;
struct ThreadStartInfo *startInfo;
thread = (struct _thread *) HMalloc (sizeof *thread);
#ifdef NAMED_SYNCHRO
thread->name = name;
#endif
#ifdef PROFILE_THREADS
thread->startTime = GetTimeCounter ();
#endif
thread->localData = CreateThreadLocal ();
startInfo = (struct ThreadStartInfo *) HMalloc (sizeof (*startInfo));
startInfo->func = func;
startInfo->data = data;
startInfo->sem = SDL_CreateSemaphore (0);
startInfo->thread = thread;
thread->native = SDL_CreateThread (ThreadHelper, (void *) startInfo);
if (!(thread->native))
{
DestroyThreadLocal (thread->localData);
HFree (startInfo);
HFree (thread);
return NULL;
}
// The responsibility to free 'startInfo' and 'thread' is now by the new
// thread.
QueueThread (thread);
#ifdef DEBUG_THREADS
#if 0
log_add (log_Debug, "Thread '%s' created.", ThreadName (thread));
fflush (stderr);
#endif
#endif
// Signal to the new thread that the thread structure is ready
// and it can begin to use it.
SDL_SemPost (startInfo->sem);
(void) stackSize; /* Satisfying compiler (unused parameter) */
return thread;
}
示例6: DeleteCeosRecord
void DeleteCeosRecord(CeosRecord_t *record)
{
if(record)
{
if(record->Buffer)
{
HFree(record->Buffer);
record->Buffer = NULL;
}
HFree( record );
}
}
示例7: destroy_SoundChunk_list
void
destroy_SoundChunk_list (TFB_SoundChunk *chunk)
{
TFB_SoundChunk *next = NULL;
for ( ; chunk; chunk = next)
{
next = chunk->next;
if (chunk->decoder)
SoundDecoder_Free (chunk->decoder);
HFree (chunk->text);
HFree (chunk);
}
}
示例8: ThreadHelper
static int
ThreadHelper (void *startInfo) {
ThreadFunction func;
void *data;
SDL_sem *sem;
TrueThread thread;
int result;
func = ((struct ThreadStartInfo *) startInfo)->func;
data = ((struct ThreadStartInfo *) startInfo)->data;
sem = ((struct ThreadStartInfo *) startInfo)->sem;
// Wait until the Thread structure is available.
SDL_SemWait (sem);
SDL_DestroySemaphore (sem);
thread = ((struct ThreadStartInfo *) startInfo)->thread;
HFree (startInfo);
result = (*func) (data);
#ifdef DEBUG_THREADS
log_add (log_Debug, "Thread '%s' done (returned %d).",
thread->name, result);
fflush (stderr);
#endif
UnQueueThread (thread);
DestroyThreadLocal (thread->localData);
FinishThread (thread);
/* Destroying the thread is the responsibility of ProcessThreadLifecycles() */
return result;
}
示例9: mixSDL_Uninit
void
mixSDL_Uninit (void)
{
int i;
UninitStreamDecoder ();
for (i = 0; i < NUM_SOUNDSOURCES; ++i)
{
if (soundSource[i].sample && soundSource[i].sample->decoder)
{
StopStream (i);
}
if (soundSource[i].sbuffer)
{
void *sbuffer = soundSource[i].sbuffer;
soundSource[i].sbuffer = NULL;
HFree (sbuffer);
}
DestroyMutex (soundSource[i].stream_mutex);
soundSource[i].stream_mutex = 0;
mixSDL_DeleteSources (1, &soundSource[i].handle);
}
SDL_CloseAudio ();
mixer_Uninit ();
SoundDecoder_Uninit ();
SDL_QuitSubSystem (SDL_INIT_AUDIO);
}
示例10: copyError
/*
* Closes srcHandle if it's not -1.
* Closes dstHandle if it's not -1.
* Removes unlinkpath from the unlinkHandle dir if it's not NULL.
* Frees 'buf' if not NULL.
* Always returns -1.
* errno is what was before the call.
*/
static int
copyError(uio_Handle *srcHandle, uio_Handle *dstHandle,
uio_DirHandle *unlinkHandle, const char *unlinkPath, uint8 *buf)
{
int savedErrno;
savedErrno = errno;
log_add (log_Debug, "Error while copying: %s", strerror (errno));
if (srcHandle != NULL)
uio_close (srcHandle);
if (dstHandle != NULL)
uio_close (dstHandle);
if (unlinkPath != NULL)
uio_unlink (unlinkHandle, unlinkPath);
if (buf != NULL)
HFree(buf);
errno = savedErrno;
return -1;
}
示例11: alloc_colormap
static inline TFB_ColorMap *
alloc_colormap (void)
// returns an addrefed object
{
TFB_ColorMap *map;
if (poolhead)
{ // have some spares
map = poolhead;
poolhead = map->next;
--poolcount;
}
else
{ // no spares, need a new one
map = HMalloc (sizeof (*map));
map->palette = AllocNativePalette ();
if (!map->palette)
{
HFree (map);
return NULL;
}
}
map->next = NULL;
map->index = -1;
map->refcount = 1;
map->version = 0;
return map;
}
示例12: ExtractInt
static void ExtractInt(CeosRecord_t *record, int type, unsigned int offset, unsigned int length, int *value)
{
void *buffer;
char format[32];
buffer = HMalloc( length + 1 );
switch(type)
{
case __CEOS_REC_TYP_A:
sprintf( format, "A%u", length );
GetCeosField( record, offset, format, buffer );
*value = atoi( buffer );
break;
case __CEOS_REC_TYP_B:
sprintf( format, "B%u", length );
#ifdef notdef
GetCeosField( record, offset, format, buffer );
if( length <= 4 )
CeosToNative( value, buffer, length, length );
else
*value = 0;
#else
GetCeosField( record, offset, format, value );
#endif
break;
case __CEOS_REC_TYP_I:
sprintf( format, "I%u", length );
GetCeosField( record, offset, format, value );
break;
}
HFree( buffer );
}
示例13: _ReleaseFontData
BOOLEAN
_ReleaseFontData (void *handle)
{
FONT font = (FONT) handle;
if (font == NULL)
return FALSE;
{
FONT_PAGE *page;
FONT_PAGE *nextPage;
for (page = font->fontPages; page != NULL; page = nextPage)
{
size_t charI;
for (charI = 0; charI < page->numChars; charI++)
{
TFB_Char *c = &page->charDesc[charI];
if (c->data == NULL)
continue;
// XXX: fix this if fonts get per-page data
// rather than per-char
TFB_DrawScreen_DeleteData (c->data);
}
nextPage = page->next;
FreeFontPage (page);
}
}
HFree (font);
return TRUE;
}
示例14: GetCodeResData
static void
GetCodeResData (const char *ship_id, RESOURCE_DATA *resdata)
{
BYTE which_res;
void *hData;
which_res = atoi (ship_id);
hData = HMalloc (sizeof (CODERES_STRUCT));
if (hData)
{
RaceDescInitFunc initFunc = CodeResToInitFunc (which_res);
RACE_DESC *RDPtr = (initFunc == NULL) ? NULL : (*initFunc)();
if (RDPtr == 0)
{
HFree (hData);
hData = 0;
}
else
{
CODERES_STRUCT *cs;
cs = (CODERES_STRUCT *) hData;
cs->data = *RDPtr; // Structure assignment.
}
}
resdata->ptr = hData;
}
示例15: openAL_Uninit
void
openAL_Uninit (void)
{
int i;
UninitStreamDecoder ();
for (i = 0; i < NUM_SOUNDSOURCES; ++i)
{
if (soundSource[i].sample && soundSource[i].sample->decoder)
{
StopStream (i);
}
if (soundSource[i].sbuffer)
{
void *sbuffer = soundSource[i].sbuffer;
soundSource[i].sbuffer = NULL;
HFree (sbuffer);
}
DestroyMutex (soundSource[i].stream_mutex);
}
alcMakeContextCurrent (NULL);
alcDestroyContext (alcContext);
alcContext = NULL;
alcCloseDevice (alcDevice);
alcDevice = NULL;
SoundDecoder_Uninit ();
}