Wireshark-dev: Re: [Wireshark-dev] Dynamically allocated field array
From: Jaap Keuter <[email protected]>
Date: Wed, 28 Nov 2007 19:08:55 +0100
Hi,

Yeah, and I though we're using glib functions for memory management. All this realloc and memcpy look ugly.
Thanx,
Jaap

Kukosa, Tomas wrote:
The packet-tpncp.c has dynamically allocated fields array and register them one by one: /* * The function proto_register_field_array can not work with dynamic arrays,
     * so passing dynamic array elements one-by-one in the loop.
     */
    for(index = 0; index < hf_size; index++) {
        proto_register_field_array(proto_tpncp, &hf[index], 1);
    }
Is it really necessary?
Why proto_register_field_array(proto_tpncp, hf, hf_size); can not be used?
I have probably missed something.
Tomas