[2/5] libwine: Add a generic red-black tree.

Alexandre Julliard julliard at winehq.org
Tue Jun 2 04:43:47 CDT 2009


Henri Verbeet <hverbeet at codeweavers.com> writes:

> +void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t *compare)
> +{
> +    tree->compare = compare;
> +    tree->root = NULL;
> +    tree->stack.entries = malloc(16 * sizeof(*tree->stack.entries));
> +    if (!tree->stack.entries)
> +    {
> +        ERR("Failed to allocate stack memory.\n");
> +    }

You can't hardcode malloc(), the allocator needs to be configurable,
particularly for use from the memory management code. Also printing an
ERR in that sort of code is not acceptable, errors need to be propagated
correctly and handled by the user.

I also still think this would be better as inline functions, at least
until it stabilizes. We don't want to change the libwine interface any
more than strictly necessary.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list