本文整理汇总了C++中D_MAGIC_CLEAR函数的典型用法代码示例。如果您正苦于以下问题:C++ D_MAGIC_CLEAR函数的具体用法?C++ D_MAGIC_CLEAR怎么用?C++ D_MAGIC_CLEAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了D_MAGIC_CLEAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dfb_surfacemanager_destroy
void
dfb_surfacemanager_destroy( SurfaceManager *manager )
{
Chunk *chunk;
D_ASSERT( manager != NULL );
D_ASSERT( manager->chunks != NULL );
D_MAGIC_ASSERT( manager, SurfaceManager );
D_MAGIC_CLEAR( manager );
/* Deallocate all chunks. */
chunk = manager->chunks;
while (chunk) {
Chunk *next = chunk->next;
D_MAGIC_CLEAR( chunk );
SHFREE( chunk );
chunk = next;
}
/* Destroy manager lock. */
fusion_skirmish_destroy( &manager->lock );
/* Deallocate manager struct. */
SHFREE( manager );
}
示例2: dfb_clipboard_core_shutdown
static DFBResult
dfb_clipboard_core_shutdown( DFBClipboardCore *data,
bool emergency )
{
DFBClipboardCoreShared *shared;
D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
D_MAGIC_ASSERT( data, DFBClipboardCore );
shared = data->shared;
D_MAGIC_ASSERT( shared, DFBClipboardCoreShared );
fusion_skirmish_destroy( &shared->lock );
if (shared->data)
SHFREE( shared->shmpool, shared->data );
if (shared->mime_type)
SHFREE( shared->shmpool, shared->mime_type );
D_MAGIC_CLEAR( data );
D_MAGIC_CLEAR( shared );
return DFB_OK;
}
示例3: fusion_shm_deinit
DirectResult
fusion_shm_deinit( FusionWorld *world )
{
int i;
DirectResult ret;
FusionSHM *shm;
FusionSHMShared *shared;
D_MAGIC_ASSERT( world, FusionWorld );
shm = &world->shm;
D_MAGIC_ASSERT( shm, FusionSHM );
shared = shm->shared;
D_MAGIC_ASSERT( shared, FusionSHMShared );
ret = fusion_skirmish_prevail( &shared->lock );
if (ret)
return ret;
/* Deinitialize shared data. */
if (fusion_master( world )) {
D_ASSUME( shared->num_pools == 0 );
for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
if (shared->pools[i].active) {
D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );
D_WARN( "destroying remaining '%s'", shared->pools[i].name );
fusion_shm_pool_destroy( world, &shared->pools[i] );
}
}
/* Destroy shared lock. */
fusion_skirmish_destroy( &shared->lock );
D_MAGIC_CLEAR( shared );
}
else {
for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
if (shared->pools[i].active) {
D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );
fusion_shm_pool_detach( shm, &shared->pools[i] );
}
}
fusion_skirmish_dismiss( &shared->lock );
}
D_MAGIC_CLEAR( shm );
return DR_OK;
}
示例4: free_chunk
static Chunk*
free_chunk( SurfaceManager *manager, Chunk *chunk )
{
D_MAGIC_ASSERT( manager, SurfaceManager );
D_MAGIC_ASSERT( chunk, _Chunk_ );
if (!chunk->buffer) {
D_BUG( "freeing free chunk" );
return chunk;
}
else {
D_DEBUG_AT( Core_SM, "Deallocating %d bytes at offset %d.\n",
chunk->length, chunk->offset );
}
if (chunk->buffer->policy == CSP_VIDEOONLY)
manager->available += chunk->length;
chunk->buffer = NULL;
manager->min_toleration--;
if (chunk->prev && !chunk->prev->buffer) {
Chunk *prev = chunk->prev;
//D_DEBUG_AT( Core_SM, " -> merging with previous chunk at %d\n", prev->offset );
prev->length += chunk->length;
prev->next = chunk->next;
if (prev->next)
prev->next->prev = prev;
//D_DEBUG_AT( Core_SM, " -> freeing %p (prev %p, next %p)\n", chunk, chunk->prev, chunk->next);
D_MAGIC_CLEAR( chunk );
SHFREE( chunk );
chunk = prev;
}
if (chunk->next && !chunk->next->buffer) {
Chunk *next = chunk->next;
//D_DEBUG_AT( Core_SM, " -> merging with next chunk at %d\n", next->offset );
chunk->length += next->length;
chunk->next = next->next;
if (chunk->next)
chunk->next->prev = chunk;
D_MAGIC_CLEAR( next );
SHFREE( next );
}
return chunk;
}
示例5: call_handlers
static void
call_handlers( int num,
void *addr )
{
DirectLink *l, *n;
if (num == SIG_DUMP_STACK)
num = DIRECT_SIGNAL_DUMP_STACK;
/* Loop through all handlers. */
direct_mutex_lock( &handlers_lock );
direct_list_foreach_safe (l, n, handlers) {
DirectSignalHandler *handler = (DirectSignalHandler*) l;
if (handler->removed) {
direct_list_remove( &handlers, &handler->link );
D_MAGIC_CLEAR( handler );
D_FREE( handler );
continue;
}
D_LOG( Direct_Signals, FATAL, " --> %d\n", handler->num );
if (handler->num != num && handler->num != DIRECT_SIGNAL_ANY)
continue;
if (handler->num == DIRECT_SIGNAL_ANY && num == DIRECT_SIGNAL_DUMP_STACK)
continue;
switch (handler->func( num, addr, handler->ctx )) {
case DSHR_OK:
break;
case DSHR_REMOVE:
direct_list_remove( &handlers, &handler->link );
D_MAGIC_CLEAR( handler );
D_FREE( handler );
break;
case DSHR_RESUME:
D_LOG( Direct_Signals, FATAL, " '-> cured!\n" );
direct_mutex_unlock( &handlers_lock );
return;
default:
D_BUG( "unknown result" );
break;
}
}
示例6: dfb_font_destroy
void
dfb_font_destroy( CoreFont *font )
{
int i;
D_MAGIC_ASSERT( font, CoreFont );
D_MAGIC_CLEAR( font );
pthread_mutex_lock( &font->lock );
dfb_state_set_destination( &font->state, NULL );
dfb_state_set_source( &font->state, NULL );
dfb_state_destroy( &font->state );
direct_tree_destroy( font->glyph_infos );
if (font->surfaces) {
for (i = 0; i < font->rows; i++)
dfb_surface_unref( font->surfaces[i] );
D_FREE( font->surfaces );
}
pthread_mutex_unlock( &font->lock );
pthread_mutex_destroy( &font->lock );
D_FREE( font );
}
示例7: fbdevDeallocateBuffer
static DFBResult
fbdevDeallocateBuffer( CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
CoreSurfaceBuffer *buffer,
CoreSurfaceAllocation *allocation,
void *alloc_data )
{
FBDevPoolData *data = pool_data;
FBDevAllocationData *alloc = alloc_data;
D_DEBUG_AT( FBDev_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
D_MAGIC_ASSERT( pool, CoreSurfacePool );
D_MAGIC_ASSERT( data, FBDevPoolData );
D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
D_MAGIC_ASSERT( alloc, FBDevAllocationData );
if (alloc->chunk)
dfb_surfacemanager_deallocate( data->manager, alloc->chunk );
D_MAGIC_CLEAR( alloc );
return DFB_OK;
}
示例8: stmfbdevDeallocateBuffer
static DFBResult
stmfbdevDeallocateBuffer (CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
CoreSurfaceBuffer *buffer,
CoreSurfaceAllocation *allocation,
void *alloc_data)
{
STMfbdevPoolData * const data = pool_data;
const STMfbdevPoolLocalData * const local = pool_local;
STMfbdevPoolAllocationData * const alloc = alloc_data;
D_DEBUG_AT (STMfbdev_Surfaces, "%s (%p)\n", __FUNCTION__, buffer);
D_MAGIC_ASSERT (pool, CoreSurfacePool);
D_MAGIC_ASSERT (data, STMfbdevPoolData);
D_MAGIC_ASSERT (local, STMfbdevPoolLocalData);
D_MAGIC_ASSERT (buffer, CoreSurfaceBuffer);
D_MAGIC_ASSERT (allocation, CoreSurfaceAllocation);
D_MAGIC_ASSERT (alloc, STMfbdevPoolAllocationData);
(void) local;
D_ASSERT (alloc->chunk != NULL);
dfb_surfacemanager_deallocate (data->manager, alloc->chunk);
D_MAGIC_CLEAR (alloc);
return DFB_OK;
}
示例9: mesaDeallocateBuffer
static DFBResult
mesaDeallocateBuffer( CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
CoreSurfaceBuffer *buffer,
CoreSurfaceAllocation *allocation,
void *alloc_data )
{
MesaPoolData *data = pool_data;
MesaAllocationData *alloc = alloc_data;
MesaPoolLocalData *local = pool_local;
(void)data;
D_DEBUG_AT( Mesa_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
D_MAGIC_ASSERT( pool, CoreSurfacePool );
D_MAGIC_ASSERT( data, MesaPoolData );
D_MAGIC_ASSERT( alloc, MesaAllocationData );
drmModeRmFB( local->mesa->fd, alloc->fb_id );
eglDestroyImageKHR( local->mesa->dpy, alloc->image );
gbm_bo_destroy( alloc->bo );
D_MAGIC_CLEAR( alloc );
return DFB_OK;
}
示例10: wm_remove_window
static DFBResult
wm_remove_window( CoreWindowStack *stack,
void *wm_data,
void *stack_data,
CoreWindow *window,
void *window_data )
{
WindowData *data = window_data;
D_ASSERT( stack != NULL );
D_ASSERT( wm_data != NULL );
D_ASSERT( stack_data != NULL );
D_ASSERT( window != NULL );
D_ASSERT( window_data != NULL );
D_MAGIC_ASSERT( data, WindowData );
// D_ASSUME( data->window == NULL );
if (data->window)
unique_window_detach_global( data->window, &data->window_reaction );
D_MAGIC_CLEAR( data );
return DFB_OK;
}
示例11: palette_destructor
static void palette_destructor( FusionObject *object, bool zombie, void *ctx )
{
CorePaletteNotification notification;
CorePalette *palette = (CorePalette*) object;
D_MAGIC_ASSERT( palette, CorePalette );
D_DEBUG_AT( Core_Palette, "destroying %p (%d)%s\n", palette,
palette->num_entries, zombie ? " (ZOMBIE)" : "");
D_ASSERT( palette->entries != NULL );
D_ASSERT( palette->entries_yuv != NULL );
notification.flags = CPNF_DESTROY;
notification.palette = palette;
dfb_palette_dispatch( palette, ¬ification, dfb_palette_globals );
if (palette->hash_attached) {
dfb_colorhash_invalidate( NULL, palette );
dfb_colorhash_detach( NULL, palette );
}
SHFREE( palette->shmpool, palette->entries_yuv );
SHFREE( palette->shmpool, palette->entries );
D_MAGIC_CLEAR( palette );
fusion_object_destroy( object );
}
示例12: surface_client_destructor
static void
surface_client_destructor( FusionObject *object, bool zombie, void *ctx )
{
CoreSurfaceClient *client = (CoreSurfaceClient*) object;
CoreSurface *surface;
int index;
D_MAGIC_ASSERT( client, CoreSurfaceClient );
surface = client->surface;
CORE_SURFACE_ASSERT( surface );
D_DEBUG_AT( Core_SurfClient, "destroying %p (%dx%d%s)\n", client,
surface->config.size.w, surface->config.size.h, zombie ? " ZOMBIE" : "");
CoreSurfaceClient_Deinit_Dispatch( &client->call );
dfb_surface_lock( surface );
index = fusion_vector_index_of( &surface->clients, client );
D_ASSERT( index >= 0 );
fusion_vector_remove( &surface->clients, index );
dfb_surface_check_acks( surface );
dfb_surface_unlock( surface );
dfb_surface_unlink( &client->surface );
D_MAGIC_CLEAR( client );
fusion_object_destroy( object );
}
示例13: leave_pool
static void
leave_pool( FusionSHM *shm,
FusionSHMPool *pool,
FusionSHMPoolShared *shared )
{
FusionWorld *world;
D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );
D_MAGIC_ASSERT( shm, FusionSHM );
D_MAGIC_ASSERT( pool, FusionSHMPool );
D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
world = shm->world;
D_MAGIC_ASSERT( world, FusionWorld );
if (munmap( shared->addr_base, shared->max_size ))
D_PERROR( "Fusion/SHM: Could not munmap shared memory file '%s'!\n", pool->filename );
pool->attached = false;
D_FREE( pool->filename );
D_MAGIC_CLEAR( pool );
}
示例14: D_DEBUG_AT
VoodooInstance::~VoodooInstance()
{
D_DEBUG_AT( Voodoo_Instance, "VoodooInstance::%s( %p )\n", __func__, this );
D_MAGIC_ASSERT( this, VoodooInstance );
D_MAGIC_CLEAR( this );
}
示例15: one_core_wq_deinit
void
one_core_wq_deinit( OneCore *core,
OneWaitQueue *queue )
{
D_MAGIC_ASSERT( core, OneCore );
D_MAGIC_ASSERT( queue, OneWaitQueue );
D_MAGIC_CLEAR( queue );
}