dpnet: Convert Address components to use a list

Stefan Dösinger stefandoesinger at gmail.com
Thu Apr 9 04:24:14 CDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2015-04-08 um 09:10 schrieb Alistair Leslie-Hughes:
> +{
> +    if(This->comp_count == This->comp_array_size)
> +    {
> +        struct component **temp;
> +
> +        temp = heap_realloc(This->components, sizeof(struct component *) * (This->comp_array_size*2) );
Style hint: You can use sizeof(*temp) here, that way the alloc code
doesn't need to be changed when you change the type of temp. This is
even more helpful when the declaration of the pointer is in a
different file, like in the heap_alloc call that allocates
client->components.

> +    if(This->components)
> +    {
> +        This->components[This->comp_count] = item;
> +        This->comp_count++;
> +        return TRUE;
> +    }
Can this ever be NULL for a legitimate reason? Note that the
heap_realloc call already assumes This->components is not NULL.

> @@ -540,8 +596,8 @@ HRESULT DPNET_CreateDirectPlay8Address(IClassFactory *iface, IUnknown *pUnkOuter
>  
>      client->IDirectPlay8Address_iface.lpVtbl = &DirectPlay8Address_Vtbl;
>      client->ref = 1;
> -
> -    list_init(&client->components);
> +    client->comp_array_size = 4;
> +    client->components = heap_alloc( sizeof(struct component *) * client->comp_array_size );
Please add error checking here. (The NULL check in add_component
doesn't help if this fails. You'll just get a half-working address
object where AddComponent always fails)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVJkU+AAoJEN0/YqbEcdMwYRYP/0Vzb0FQDV6xBWc66VFjECxa
dSyWsm34yksURXd9H7ayT+cGHQiyfq9dP5MIEL3Lrf7Npiqy7b3DV2NYH1X3foL8
NZoU0R6BSq1XUkqcEWFnXRDIHWs8f0Q1kNyRcUfsuXO4c6vAQOde7CdRtMHuLEy5
DOZjnnSbfAjoKq9Xk3JGJOs1juceoNumojpYE6wtbwDM5Q3Z8DOAdDEvv9qCw9SU
Gziuis+LLN2yFDb+cONIKApy/XS/zs2imFS4z/wlKAEu72aGib/64j/d7j48jIxl
C7ojDWjWGQj1CDSF6Wn0X80TV5Xjgolgw3ndyPFvqResCk4+UMeoyPaBXLLmozcu
VaNtd4sGVTTAe7ivfKVaZx1K0gR8mezsFXEZ2jBfZlTOGHIRiImQ84ORZvahWr7t
HYh0ZdDddzNOEbJVAlvxMrB/HLL+ODAOZJaElN6QXyWPBYFIb5AH+VwXeBccahSM
xg8xkZLQIPqgDyQaI4TPDCboU5VzptTtl3uKJSy4QX+gV23IFXT9AUnPrWLas+3J
qW0pX1tljdTxrVqU3mGvvE3KnUsHyEvx4sBVNWOzEagnSv4TQiabNlkyPfQmJsiH
WE/Lx2WTWV9ucLfsGmCNbx+Cu52hDNj1R93hqgpSgAvvUjFeGjxTy4SQFD17ig6M
ZFkE66v0L53cG4lQASGw
=FqJl
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list