Wireshark-dev: Re: [Wireshark-dev] Using global variables to store dissection?information
From: Anders Broman <[email protected]>
Date: Thu, 10 May 2012 13:48:11 +0200

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jakub Zawadzki
Sent: den 10 maj 2012 13:38
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Using global variables to store dissection?information

On Wed, May 09, 2012 at 02:57:45PM +0000, Christopher Maynard wrote:
>> Jakub Zawadzki <[email protected]> writes:
>> > There's already packet_info structure which is always private for 
>> > current dissection. The easiest fix would be to move all global 
>> > variables to packet_info structure. Anyone against it?
>> From Guy's comments I got the feeling that the packet_info "katamari" 
>> was already too big and that there was a desire to reduce its size, not increase it.
>It can be one member:
>  void *current_proto_data;
>Another solution would require adding extra parameter to dissect_ subroutines.
>It's much more work and I'm afraid it's not easy to do in generated dissectors (like ASN.1 ones).
>I can live when people use global variables ;) But it's much easier to hit bugs when you forgot to register cleanup function.
>Primarly I wanted to know if we can decide on some global policy:
>If it's ok to use global variables or not? 

I think that falls in the category of "It should be avoided" but you may "have to"

>What should be used instead of them we can disscuss later.

If we provide means and methods to avoid using them at least the would be less frequent :-)


Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe