Re: [3/3] dpnet: Convert Address components to use a list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Alistair, Alexandre made me aware that I missed a blaring issue here: Am 2015-02-26 um 04:32 schrieb Alistair Leslie-Hughes:
+ temp = heap_realloc(This->components, sizeof(struct component *) * This->comp_count+1 ); X * This->comp_count+1 won't do what you want it to do.
Also he wants the array to be grown by doubling it. If the expected component count is low as you say, allocate the expected count at object creation (e.g. 4), and then double the array in case you need to grow it. Also, in terms of style, you can write sizeof(*This->components) instead of sizeof(struct component *). That way you won't have to change the code if you change the type of This->components. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU7tiXAAoJEN0/YqbEcdMw6NwP/iWzcMCi48YkZ5iu52GrQDTo 86BL0M0VjFy72VDJq58pXvrK+7skm7JlI+jj/hdF0dtXg7ga6OCHqMwdyKdpUisB P93rCUVNOWvtqWltjct3UjdFM0PUD+IU9s5r3nX6sYMxwU++Kt31q5Cxq5APwxUO XplBpKeoRKtx44xgX0o84/hv6MijePDbocn+sQ3gBSyG4UdC4lt9F1Ze57r87DoW F0LkapFizu+45sRVWm6d6ANL4VL+pq3vVmjlIFRUPerVlIRRGEXnE3/5RqBegOUw MWFqRzj7LicQsy2tyan01o+OoUqGQL6ynesKj+I2LMf76i5JlSPGxoYMYlsk3vE+ JXn74dqP9iX6+Rhk7mv6q4iOQNOYsH5BraRWWLCT3vzr5DZESk+pjqn3ECKPkkZQ S88g9ismdDLkQ5pSNT/tbxeV2oRQSa4cTPp8aSNa5ttZtvwJhoHZjUGtdxAU7Go2 DcJuSbmTXFQo50Iaaw8Qlb+ZPbUVE0rjcALkKH74Bhq5vSbRkA1eu69A2TQOB9S3 x1sVVT78YhhWkl6qjESrhP0NFApNiCunUIK2U110aagOHGUyFaRix5DNN3lCO0ZT n9bvdXbZGCgg5RhxgIaqvTuGBhVZh882tpWecazipmYePUmO+4GzGwWGfxfyPymO qzUzMMRIGsukENMDUaus =3JhD -----END PGP SIGNATURE-----
participants (1)
-
Stefan Dösinger