rbtree.h: Take wine_rb_entry as wine_rb_remove argument type and add new wine_rb_remove_key helper using key.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-09-12 13:44:09 +02:00 committed by Alexandre Julliard
parent 1224bfaa35
commit d29e59a145
6 changed files with 17 additions and 13 deletions

View File

@ -78,7 +78,7 @@ static ULONG STDMETHODCALLTYPE d3d11_blend_state_Release(ID3D11BlendState *iface
{
struct d3d_device *device = impl_from_ID3D11Device(state->device);
wined3d_mutex_lock();
wine_rb_remove(&device->blend_states, &state->desc);
wine_rb_remove_key(&device->blend_states, &state->desc);
ID3D11Device_Release(state->device);
wined3d_private_store_cleanup(&state->private_store);
wined3d_mutex_unlock();
@ -379,7 +379,7 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_state_Release(ID3D11DepthStenc
{
struct d3d_device *device = impl_from_ID3D11Device(state->device);
wined3d_mutex_lock();
wine_rb_remove(&device->depthstencil_states, &state->desc);
wine_rb_remove_key(&device->depthstencil_states, &state->desc);
ID3D11Device_Release(state->device);
wined3d_private_store_cleanup(&state->private_store);
wined3d_mutex_unlock();
@ -663,7 +663,7 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerSt
{
struct d3d_device *device = impl_from_ID3D11Device(state->device);
wined3d_mutex_lock();
wine_rb_remove(&device->rasterizer_states, &state->desc);
wine_rb_remove_key(&device->rasterizer_states, &state->desc);
wined3d_rasterizer_state_decref(state->wined3d_state);
wined3d_private_store_cleanup(&state->private_store);
wined3d_mutex_unlock();
@ -963,7 +963,7 @@ static ULONG STDMETHODCALLTYPE d3d11_sampler_state_Release(ID3D11SamplerState *i
wined3d_mutex_lock();
wined3d_sampler_decref(state->wined3d_sampler);
wine_rb_remove(&device->sampler_states, &state->desc);
wine_rb_remove_key(&device->sampler_states, &state->desc);
ID3D11Device_Release(state->device);
wined3d_private_store_cleanup(&state->private_store);
wined3d_mutex_unlock();

View File

@ -2483,7 +2483,7 @@ void add_function_decl(struct wine_rb_tree *funcs, char *name, struct hlsl_ir_fu
d3dcompiler_free(name);
return;
}
wine_rb_remove(&func->overloads, decl->parameters);
wine_rb_remove(&func->overloads, old_entry);
free_function_decl(old_decl);
}
wine_rb_put(&func->overloads, decl->parameters, &decl->entry);

View File

@ -933,7 +933,7 @@ void WINAPI IoDeleteDriver( DRIVER_OBJECT *driver_object )
TRACE( "(%p)\n", driver_object );
EnterCriticalSection( &drivers_cs );
wine_rb_remove( &wine_drivers, &driver_object->DriverName );
wine_rb_remove_key( &wine_drivers, &driver_object->DriverName );
LeaveCriticalSection( &drivers_cs );
RtlFreeUnicodeString( &driver_object->DriverName );

View File

@ -5389,7 +5389,7 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc
key.vs_id = entry->vs.id;
key.gs_id = entry->gs.id;
key.ps_id = entry->ps.id;
wine_rb_remove(&priv->program_lookup, &key);
wine_rb_remove_key(&priv->program_lookup, &key);
GL_EXTCALL(glDeleteProgram(entry->id));
if (entry->vs.id)

View File

@ -226,13 +226,11 @@ static inline int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct
return 0;
}
static inline void wine_rb_remove(struct wine_rb_tree *tree, const void *key)
static inline void wine_rb_remove(struct wine_rb_tree *tree, struct wine_rb_entry *entry)
{
struct wine_rb_entry *entry, *iter, *child, *parent, *w;
struct wine_rb_entry *iter, *child, *parent, *w;
int need_fixup;
if (!(entry = wine_rb_get(tree, key))) return;
if (entry->right && entry->left)
for(iter = entry->right; iter->left; iter = iter->left);
else
@ -337,4 +335,10 @@ static inline void wine_rb_remove(struct wine_rb_tree *tree, const void *key)
if (tree->root) tree->root->flags &= ~WINE_RB_FLAG_RED;
}
static inline void wine_rb_remove_key(struct wine_rb_tree *tree, const void *key)
{
struct wine_rb_entry *entry = wine_rb_get(tree, key);
if (entry) wine_rb_remove(tree, entry);
}
#endif /* __WINE_WINE_RBTREE_H */

View File

@ -350,7 +350,7 @@ static NTSTATUS unload_driver( struct wine_rb_entry *entry, BOOL destroy )
return STATUS_SUCCESS;
}
wine_rb_remove( &wine_drivers, driver->name );
wine_rb_remove( &wine_drivers, &driver->entry );
memset( &environment, 0, sizeof(environment) );
environment.Version = 1;
@ -405,7 +405,7 @@ static void WINAPI async_create_driver( PTP_CALLBACK_INSTANCE instance, void *co
error:
EnterCriticalSection( &drivers_cs );
wine_rb_remove( &wine_drivers, driver->name );
wine_rb_remove( &wine_drivers, &driver->entry );
LeaveCriticalSection( &drivers_cs );
set_service_status( driver->handle, SERVICE_STOPPED, 0 );