Wireshark mailing list archives

Re: Why are ett[] arrays static?


From: Peter Wu <peter () lekensteyn nl>
Date: Fri, 19 Oct 2018 17:40:36 +0200

On Fri, Oct 19, 2018 at 10:51:48AM -0400, Jeff Morriss wrote:
Is it just me or is there no reason for ett[] arrays:

    /* Setup protocol subtree array */
    static gint *ett[] = {
        &ett_PROTOABBREV

to be static?

It seems to me that making it static is just wasting space (keeping the
array around forever)?

You are right, it has been static since its introduction in 1999, see
commit a7aba0a28890856d2570951c2b0a76c922fdfa72

Almost all occurrences can be replaced by 'gint *const ett[]' ("an array
of const pointer to int") as the array itself remains unmodified.
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: