[PATCH 1/8] msi: use an array instead of a hashtable for WHEREVIEW

Alexandre Julliard julliard at winehq.org
Wed Aug 24 08:08:45 CDT 2011


Bernhard Loos <bernhardloos at googlemail.com> writes:

> +static UINT add_row(MSIWHEREVIEW *wv, UINT val)
>  {
> -    MSIHASHENTRY *new = msi_alloc(sizeof(MSIHASHENTRY));
> -    MSIHASHENTRY *prev;
> +    MSIROWENTRY *new;
> +
> +    if (wv->reorder_size <= wv->row_count)
> +    {
> +        MSIROWENTRY **new_reorder;
> +        UINT newsize = wv->reorder_size * 2;
> +
> +        new_reorder = msi_alloc_zero(sizeof(MSIROWENTRY *) * newsize);
> +
> +        if (!new_reorder)
> +            return ERROR_OUTOFMEMORY;
> +
> +        memcpy(new_reorder, wv->reorder, wv->row_count * sizeof(MSIROWENTRY *));
> +        msi_free(wv->reorder);

Any reason for not doing a realloc instead?

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list