Commit acc0bb05 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

rbtree.h: Pass compare function instead of wine_rb_functions to wine_rb_init.

Also change return type to void since the function can no longer fail. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7cfa7496
......@@ -207,14 +207,6 @@ static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry
return *id - t->id;
}
static const struct wine_rb_functions d3d10_effect_type_rb_functions =
{
d3d10_rb_alloc,
d3d10_rb_realloc,
d3d10_rb_free,
d3d10_effect_type_compare,
};
HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT flags,
ID3D10Device *device, ID3D10EffectPool *effect_pool, ID3D10Effect **effect)
{
......@@ -231,7 +223,7 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl
return E_OUTOFMEMORY;
}
wine_rb_init(&object->types, &d3d10_effect_type_rb_functions);
wine_rb_init(&object->types, d3d10_effect_type_compare);
object->ID3D10Effect_iface.lpVtbl = &d3d10_effect_vtbl;
object->refcount = 1;
ID3D10Device_AddRef(device);
......
......@@ -43,10 +43,6 @@ const char *debug_d3d10_shader_variable_class(D3D10_SHADER_VARIABLE_CLASS c) DEC
const char *debug_d3d10_shader_variable_type(D3D10_SHADER_VARIABLE_TYPE t) DECLSPEC_HIDDEN;
const char *debug_d3d10_device_state_types(D3D10_DEVICE_STATE_TYPES t) DECLSPEC_HIDDEN;
void *d3d10_rb_alloc(size_t size) DECLSPEC_HIDDEN;
void *d3d10_rb_realloc(void *ptr, size_t size) DECLSPEC_HIDDEN;
void d3d10_rb_free(void *ptr) DECLSPEC_HIDDEN;
enum d3d10_effect_object_type
{
D3D10_EOT_RASTERIZER_STATE = 0x0,
......
......@@ -132,21 +132,6 @@ const char *debug_d3d10_device_state_types(D3D10_DEVICE_STATE_TYPES t)
#undef WINE_D3D10_TO_STR
void *d3d10_rb_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
void *d3d10_rb_realloc(void *ptr, size_t size)
{
return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
}
void d3d10_rb_free(void *ptr)
{
HeapFree(GetProcessHeap(), 0, ptr);
}
void skip_dword_unknown(const char *location, const char **ptr, unsigned int count)
{
unsigned int i;
......
......@@ -5271,21 +5271,6 @@ static const struct wined3d_device_parent_ops d3d_wined3d_device_parent_ops =
device_parent_create_swapchain,
};
static void *d3d_rb_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
static void *d3d_rb_realloc(void *ptr, size_t size)
{
return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
}
static void d3d_rb_free(void *ptr)
{
HeapFree(GetProcessHeap(), 0, ptr);
}
static int d3d_sampler_state_compare(const void *key, const struct wine_rb_entry *entry)
{
const D3D11_SAMPLER_DESC *ka = key;
......@@ -5294,14 +5279,6 @@ static int d3d_sampler_state_compare(const void *key, const struct wine_rb_entry
return memcmp(ka, kb, sizeof(*ka));
}
static const struct wine_rb_functions d3d_sampler_state_rb_ops =
{
d3d_rb_alloc,
d3d_rb_realloc,
d3d_rb_free,
d3d_sampler_state_compare,
};
static int d3d_blend_state_compare(const void *key, const struct wine_rb_entry *entry)
{
const D3D11_BLEND_DESC *ka = key;
......@@ -5310,14 +5287,6 @@ static int d3d_blend_state_compare(const void *key, const struct wine_rb_entry *
return memcmp(ka, kb, sizeof(*ka));
}
static const struct wine_rb_functions d3d_blend_state_rb_ops =
{
d3d_rb_alloc,
d3d_rb_realloc,
d3d_rb_free,
d3d_blend_state_compare,
};
static int d3d_depthstencil_state_compare(const void *key, const struct wine_rb_entry *entry)
{
const D3D11_DEPTH_STENCIL_DESC *ka = key;
......@@ -5327,14 +5296,6 @@ static int d3d_depthstencil_state_compare(const void *key, const struct wine_rb_
return memcmp(ka, kb, sizeof(*ka));
}
static const struct wine_rb_functions d3d_depthstencil_state_rb_ops =
{
d3d_rb_alloc,
d3d_rb_realloc,
d3d_rb_free,
d3d_depthstencil_state_compare,
};
static int d3d_rasterizer_state_compare(const void *key, const struct wine_rb_entry *entry)
{
const D3D11_RASTERIZER_DESC *ka = key;
......@@ -5343,14 +5304,6 @@ static int d3d_rasterizer_state_compare(const void *key, const struct wine_rb_en
return memcmp(ka, kb, sizeof(*ka));
}
static const struct wine_rb_functions d3d_rasterizer_state_rb_ops =
{
d3d_rb_alloc,
d3d_rb_realloc,
d3d_rb_free,
d3d_rasterizer_state_compare,
};
void d3d_device_init(struct d3d_device *device, void *outer_unknown)
{
device->IUnknown_inner.lpVtbl = &d3d_device_inner_unknown_vtbl;
......@@ -5371,8 +5324,8 @@ void d3d_device_init(struct d3d_device *device, void *outer_unknown)
device->blend_factor[2] = 1.0f;
device->blend_factor[3] = 1.0f;
wine_rb_init(&device->blend_states, &d3d_blend_state_rb_ops);
wine_rb_init(&device->depthstencil_states, &d3d_depthstencil_state_rb_ops);
wine_rb_init(&device->rasterizer_states, &d3d_rasterizer_state_rb_ops);
wine_rb_init(&device->sampler_states, &d3d_sampler_state_rb_ops);
wine_rb_init(&device->blend_states, d3d_blend_state_compare);
wine_rb_init(&device->depthstencil_states, d3d_depthstencil_state_compare);
wine_rb_init(&device->rasterizer_states, d3d_rasterizer_state_compare);
wine_rb_init(&device->sampler_states, d3d_sampler_state_compare);
}
......@@ -191,21 +191,6 @@ static BOOL copy_value(const char *ptr, void **value, DWORD size)
return TRUE;
}
static void *d3dcompiler_rb_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
static void *d3dcompiler_rb_realloc(void *ptr, size_t size)
{
return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
}
static void d3dcompiler_rb_free(void *ptr)
{
HeapFree(GetProcessHeap(), 0, ptr);
}
static int d3dcompiler_shader_reflection_type_compare(const void *key, const struct wine_rb_entry *entry)
{
const struct d3dcompiler_shader_reflection_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3dcompiler_shader_reflection_type, entry);
......@@ -241,14 +226,6 @@ static void d3dcompiler_shader_reflection_type_destroy(struct wine_rb_entry *ent
HeapFree(GetProcessHeap(), 0, t);
}
static const struct wine_rb_functions d3dcompiler_shader_reflection_type_rb_functions =
{
d3dcompiler_rb_alloc,
d3dcompiler_rb_realloc,
d3dcompiler_rb_free,
d3dcompiler_shader_reflection_type_compare,
};
static void free_signature(struct d3dcompiler_shader_signature *sig)
{
TRACE("Free signature %p\n", sig);
......@@ -1686,7 +1663,7 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl
reflection->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl;
reflection->refcount = 1;
wine_rb_init(&reflection->types, &d3dcompiler_shader_reflection_type_rb_functions);
wine_rb_init(&reflection->types, d3dcompiler_shader_reflection_type_compare);
hr = dxbc_parse(data, data_size, &src_dxbc);
if (FAILED(hr))
......
......@@ -1701,28 +1701,6 @@ static int compare_hlsl_types_rb(const void *key, const struct wine_rb_entry *en
return strcmp(name, type->name);
}
static inline void *d3dcompiler_alloc_rb(size_t size)
{
return d3dcompiler_alloc(size);
}
static inline void *d3dcompiler_realloc_rb(void *ptr, size_t size)
{
return d3dcompiler_realloc(ptr, size);
}
static inline void d3dcompiler_free_rb(void *ptr)
{
d3dcompiler_free(ptr);
}
static const struct wine_rb_functions hlsl_type_rb_funcs =
{
d3dcompiler_alloc_rb,
d3dcompiler_realloc_rb,
d3dcompiler_free_rb,
compare_hlsl_types_rb,
};
void push_scope(struct hlsl_parse_ctx *ctx)
{
struct hlsl_scope *new_scope = d3dcompiler_alloc(sizeof(*new_scope));
......@@ -1734,7 +1712,7 @@ void push_scope(struct hlsl_parse_ctx *ctx)
}
TRACE("Pushing a new scope\n");
list_init(&new_scope->vars);
wine_rb_init(&new_scope->types, &hlsl_type_rb_funcs);
wine_rb_init(&new_scope->types, compare_hlsl_types_rb);
new_scope->upper = ctx->cur_scope;
ctx->cur_scope = new_scope;
list_add_tail(&ctx->scopes, &new_scope->entry);
......@@ -1844,14 +1822,6 @@ static int compare_function_decl_rb(const void *key, const struct wine_rb_entry
return 0;
}
static const struct wine_rb_functions hlsl_ir_function_decl_rb_funcs =
{
d3dcompiler_alloc_rb,
d3dcompiler_realloc_rb,
d3dcompiler_free_rb,
compare_function_decl_rb,
};
static int compare_function_rb(const void *key, const struct wine_rb_entry *entry)
{
const char *name = key;
......@@ -1860,17 +1830,9 @@ static int compare_function_rb(const void *key, const struct wine_rb_entry *entr
return strcmp(name, func->name);
}
static const struct wine_rb_functions function_rb_funcs =
{
d3dcompiler_alloc_rb,
d3dcompiler_realloc_rb,
d3dcompiler_free_rb,
compare_function_rb,
};
void init_functions_tree(struct wine_rb_tree *funcs)
{
wine_rb_init(&hlsl_ctx.functions, &function_rb_funcs);
wine_rb_init(&hlsl_ctx.functions, compare_function_rb);
}
static const char *debug_base_type(const struct hlsl_type *type)
......@@ -2507,7 +2469,7 @@ void add_function_decl(struct wine_rb_tree *funcs, char *name, struct hlsl_ir_fu
TRACE("Function %s redeclared as a user defined function.\n", debugstr_a(name));
func->intrinsic = intrinsic;
wine_rb_destroy(&func->overloads, free_function_decl_rb, NULL);
wine_rb_init(&func->overloads, &hlsl_ir_function_decl_rb_funcs);
wine_rb_init(&func->overloads, compare_function_decl_rb);
}
decl->func = func;
if ((old_entry = wine_rb_get(&func->overloads, decl->parameters)))
......@@ -2530,7 +2492,7 @@ void add_function_decl(struct wine_rb_tree *funcs, char *name, struct hlsl_ir_fu
}
func = d3dcompiler_alloc(sizeof(*func));
func->name = name;
wine_rb_init(&func->overloads, &hlsl_ir_function_decl_rb_funcs);
wine_rb_init(&func->overloads, compare_function_decl_rb);
decl->func = func;
wine_rb_put(&func->overloads, decl->parameters, &decl->entry);
func->intrinsic = intrinsic;
......
......@@ -349,7 +349,6 @@ struct module_format
} u;
};
extern const struct wine_rb_functions source_rb_functions DECLSPEC_HIDDEN;
struct module
{
struct process* process;
......@@ -645,6 +644,7 @@ extern const char* pe_map_directory(struct module* module, int dirno, DWORD* si
/* source.c */
extern unsigned source_new(struct module* module, const char* basedir, const char* source) DECLSPEC_HIDDEN;
extern const char* source_get(const struct module* module, unsigned idx) DECLSPEC_HIDDEN;
extern int source_rb_compare(const void *key, const struct wine_rb_entry *entry) DECLSPEC_HIDDEN;
/* stabs.c */
typedef void (*stabs_def_cb)(struct module* module, unsigned long load_offset,
......
......@@ -225,7 +225,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
module->sources_used = 0;
module->sources_alloc = 0;
module->sources = 0;
wine_rb_init(&module->sources_offsets_tree, &source_rb_functions);
wine_rb_init(&module->sources_offsets_tree, source_rb_compare);
return module;
}
......
......@@ -36,36 +36,13 @@ struct source_rb
unsigned source;
};
static void *source_rb_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
static void *source_rb_realloc(void *ptr, size_t size)
{
return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
}
static void source_rb_free(void *ptr)
{
HeapFree(GetProcessHeap(), 0, ptr);
}
static int source_rb_compare(const void *key, const struct wine_rb_entry *entry)
int source_rb_compare(const void *key, const struct wine_rb_entry *entry)
{
const struct source_rb *t = WINE_RB_ENTRY_VALUE(entry, const struct source_rb, entry);
return strcmp((const char*)key, rb_module->sources + t->source);
}
const struct wine_rb_functions source_rb_functions =
{
source_rb_alloc,
source_rb_realloc,
source_rb_free,
source_rb_compare,
};
/******************************************************************
* source_find
*
......
......@@ -4957,14 +4957,6 @@ static int sig_tree_compare(const void *key, const struct wine_rb_entry *entry)
return compare_sig(key, &e->sig);
}
static const struct wine_rb_functions sig_tree_functions =
{
wined3d_rb_alloc,
wined3d_rb_realloc,
wined3d_rb_free,
sig_tree_compare
};
static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
const struct fragment_pipeline *fragment_pipe)
{
......@@ -4993,7 +4985,7 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
memset(priv->pshader_const_dirty, 1,
sizeof(*priv->pshader_const_dirty) * d3d_info->limits.ps_uniform_count);
wine_rb_init(&priv->signature_tree, &sig_tree_functions);
wine_rb_init(&priv->signature_tree, sig_tree_compare);
priv->vertex_pipe = vertex_pipe;
priv->fragment_pipe = fragment_pipe;
......@@ -5877,7 +5869,7 @@ static void *arbfp_alloc(const struct wined3d_shader_backend_ops *shader_backend
else if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv))))
return NULL;
wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions);
wine_rb_init(&priv->fragment_shaders, wined3d_ffp_frag_program_key_compare);
priv->use_arbfp_fixed_func = TRUE;
return priv;
......@@ -7052,14 +7044,6 @@ static void arbfp_free_blit_shader(struct wine_rb_entry *entry, void *context)
HeapFree(GetProcessHeap(), 0, entry_arb);
}
static const struct wine_rb_functions wined3d_arbfp_blit_rb_functions =
{
wined3d_rb_alloc,
wined3d_rb_realloc,
wined3d_rb_free,
arbfp_blit_type_compare,
};
static HRESULT arbfp_blit_alloc(struct wined3d_device *device)
{
struct arbfp_blit_priv *priv;
......@@ -7067,7 +7051,7 @@ static HRESULT arbfp_blit_alloc(struct wined3d_device *device)
if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv))))
return E_OUTOFMEMORY;
wine_rb_init(&priv->shaders, &wined3d_arbfp_blit_rb_functions);
wine_rb_init(&priv->shaders, arbfp_blit_type_compare);
device->blit_priv = priv;
......
......@@ -1323,7 +1323,7 @@ static void *atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend
if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv))))
return NULL;
wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions);
wine_rb_init(&priv->fragment_shaders, wined3d_ffp_frag_program_key_compare);
return priv;
}
......
......@@ -5050,14 +5050,6 @@ static int wined3d_sampler_compare(const void *key, const struct wine_rb_entry *
return memcmp(&sampler->desc, key, sizeof(sampler->desc));
}
static const struct wine_rb_functions wined3d_sampler_rb_functions =
{
wined3d_rb_alloc,
wined3d_rb_realloc,
wined3d_rb_free,
wined3d_sampler_compare,
};
HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
UINT adapter_idx, enum wined3d_device_type device_type, HWND focus_window, DWORD flags,
BYTE surface_alignment, struct wined3d_device_parent *device_parent)
......@@ -5089,7 +5081,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
fragment_pipeline = adapter->fragment_pipe;
wine_rb_init(&device->samplers, &wined3d_sampler_rb_functions);
wine_rb_init(&device->samplers, wined3d_sampler_compare);
if (vertex_pipeline->vp_states && fragment_pipeline->states
&& FAILED(hr = compile_state_table(device->StateTable, device->multistate_funcs,
......
......@@ -8425,14 +8425,6 @@ static void constant_heap_free(struct constant_heap *heap)
HeapFree(GetProcessHeap(), 0, heap->entries);
}
static const struct wine_rb_functions wined3d_glsl_program_rb_functions =
{
wined3d_rb_alloc,
wined3d_rb_realloc,
wined3d_rb_free,
glsl_program_key_compare,
};
static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
const struct fragment_pipeline *fragment_pipe)
{
......@@ -8483,7 +8475,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
goto fail;
}
wine_rb_init(&priv->program_lookup, &wined3d_glsl_program_rb_functions);
wine_rb_init(&priv->program_lookup, glsl_program_key_compare);
priv->next_constant_version = 1;
priv->vertex_pipe = vertex_pipe;
......@@ -8917,7 +8909,7 @@ static void *glsl_vertex_pipe_vp_alloc(const struct wined3d_shader_backend_ops *
if (shader_backend == &glsl_shader_backend)
{
priv = shader_priv;
wine_rb_init(&priv->ffp_vertex_shaders, &wined3d_ffp_vertex_program_rb_functions);
wine_rb_init(&priv->ffp_vertex_shaders, wined3d_ffp_vertex_program_key_compare);
return priv;
}
......@@ -9437,7 +9429,7 @@ static void *glsl_fragment_pipe_alloc(const struct wined3d_shader_backend_ops *s
if (shader_backend == &glsl_shader_backend)
{
priv = shader_priv;
wine_rb_init(&priv->ffp_fragment_shaders, &wined3d_ffp_frag_program_rb_functions);
wine_rb_init(&priv->ffp_fragment_shaders, wined3d_ffp_frag_program_key_compare);
return priv;
}
......
......@@ -5523,22 +5523,7 @@ void sampler_texdim(struct wined3d_context *context, const struct wined3d_state
texture_activate_dimensions(state->textures[sampler], context->gl_info);
}
void *wined3d_rb_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
void *wined3d_rb_realloc(void *ptr, size_t size)
{
return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
}
void wined3d_rb_free(void *ptr)
{
HeapFree(GetProcessHeap(), 0, ptr);
}
static int ffp_frag_program_key_compare(const void *key, const struct wine_rb_entry *entry)
int wined3d_ffp_frag_program_key_compare(const void *key, const struct wine_rb_entry *entry)
{
const struct ffp_frag_settings *ka = key;
const struct ffp_frag_settings *kb = &WINE_RB_ENTRY_VALUE(entry, const struct ffp_frag_desc, entry)->settings;
......@@ -5546,14 +5531,6 @@ static int ffp_frag_program_key_compare(const void *key, const struct wine_rb_en
return memcmp(ka, kb, sizeof(*ka));
}
const struct wine_rb_functions wined3d_ffp_frag_program_rb_functions =
{
wined3d_rb_alloc,
wined3d_rb_realloc,
wined3d_rb_free,
ffp_frag_program_key_compare,
};
void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings)
{
......@@ -5683,7 +5660,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->padding = 0;
}
static int wined3d_ffp_vertex_program_key_compare(const void *key, const struct wine_rb_entry *entry)
int wined3d_ffp_vertex_program_key_compare(const void *key, const struct wine_rb_entry *entry)
{
const struct wined3d_ffp_vs_settings *ka = key;
const struct wined3d_ffp_vs_settings *kb = &WINE_RB_ENTRY_VALUE(entry,
......@@ -5692,14 +5669,6 @@ static int wined3d_ffp_vertex_program_key_compare(const void *key, const struct
return memcmp(ka, kb, sizeof(*ka));
}
const struct wine_rb_functions wined3d_ffp_vertex_program_rb_functions =
{
wined3d_rb_alloc,
wined3d_rb_realloc,
wined3d_rb_free,
wined3d_ffp_vertex_program_key_compare,
};
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
......
......@@ -172,10 +172,6 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
return complex_fixup;
}
void *wined3d_rb_alloc(size_t size) DECLSPEC_HIDDEN;
void *wined3d_rb_realloc(void *ptr, size_t size) DECLSPEC_HIDDEN;
void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN;
/* Device caps */
#define MAX_STREAM_OUT 4
#define MAX_STREAMS 16
......@@ -2248,8 +2244,9 @@ struct ffp_frag_desc
struct ffp_frag_settings settings;
};
extern const struct wine_rb_functions wined3d_ffp_frag_program_rb_functions DECLSPEC_HIDDEN;
extern const struct wine_rb_functions wined3d_ffp_vertex_program_rb_functions DECLSPEC_HIDDEN;
int wined3d_ffp_frag_program_key_compare(const void *key, const struct wine_rb_entry *entry) DECLSPEC_HIDDEN;
int wined3d_ffp_vertex_program_key_compare(const void *key, const struct wine_rb_entry *entry) DECLSPEC_HIDDEN;
extern const struct wined3d_parent_ops wined3d_null_parent_ops DECLSPEC_HIDDEN;
unsigned int wined3d_max_compat_varyings(const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
......
......@@ -34,17 +34,11 @@ struct wine_rb_entry
unsigned int flags;
};
struct wine_rb_functions
{
void *(*alloc)(size_t size);
void *(*realloc)(void *ptr, size_t size);
void (*free)(void *ptr);
int (*compare)(const void *key, const struct wine_rb_entry *entry);
};
typedef int (*wine_rb_compare_func_t)(const void *key, const struct wine_rb_entry *entry);
struct wine_rb_tree
{
int (*compare)(const void *key, const struct wine_rb_entry *entry);
wine_rb_compare_func_t compare;
struct wine_rb_entry *root;
};
......@@ -129,12 +123,10 @@ static inline void wine_rb_postorder(struct wine_rb_tree *tree, wine_rb_traverse
}
}
static inline int wine_rb_init(struct wine_rb_tree *tree, const struct wine_rb_functions *functions)
static inline void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
{
tree->compare = functions->compare;
tree->compare = compare;
tree->root = NULL;
return 0;
}
static inline void wine_rb_for_each_entry(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment