From: wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On
Behalf Of Kukosa, Tomas
Sent: Wednesday, November 28, 2007
11:03 PM
To: Developer support list for
Wireshark
Subject: Re: [Wireshark-dev]
Dynamically allocated field array
I have already made some changes in
memory allocation. Please update your source.
If it is possible to call proto_register_field_array() only
once, please try it.
It is not critical for 0.99.7.
Hi,
I agree it looks somewhat awkward. The TPNCP is constantly changing, so the
fields are allocated dynamically by reading the tpncp.dat file at application
startup. I replaced all the memory management functions with glib's analogs
before submitting the patch, but I missed these two somehow, sorry. This code
was written a long time ago and, as far as I remember, I had some problems
passing dynamically allocated array to proto_register_field_array function, so
I registered the fields one-by-one. Do you see the better solution? I will be
glad to implement it. Meanwhile I will replace realloc and memcpy with glib's
analogs. Is it critical for 0.99.7 release?
Thank you,
Valery.
-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx]
On Behalf Of Jaap Keuter
Sent: Wednesday, November 28, 2007 8:09 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Dynamically allocated field array
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
>
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev