[PATCH 5/6] d2d1: Introduce a helper function to allocate arrays.

Michael Stefaniuc mstefani at winehq.org
Wed Jan 31 12:32:14 CST 2018


On 01/31/2018 04:19 PM, Henri Verbeet wrote:
> diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
> index caeb4b9..2c10252 100644
> --- a/dlls/d2d1/d2d1_private.h
> +++ b/dlls/d2d1/d2d1_private.h
> @@ -477,6 +477,15 @@ void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *
>          ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform) DECLSPEC_HIDDEN;
>  struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN;
>  
> +static inline void *d2d_calloc(size_t count, size_t size)
Why don't you just add this as heap_calloc() to heap.h?
That function wasn't controversial in my initial patch.

I see it doesn't zero the memory but I'm fine with that. We can have a
heap_calloc_zero() too for those that need it.

> +{
> +    SIZE_T s = count * size;
> +
> +    if (size && s / size != count)
> +        return NULL;
> +    return heap_alloc(s);
> +}
> +
>  static inline void d2d_matrix_multiply(D2D_MATRIX_3X2_F *a, const D2D_MATRIX_3X2_F *b)
>  {
>      D2D_MATRIX_3X2_F tmp = *a;

bye
	michael



More information about the wine-devel mailing list