ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 35253: /trunk/ /trunk/doc/: README.d

From: Anders Broman <anders.broman@xxxxxxxxxxxx>
Date: Mon, 3 Jan 2011 12:16:13 +0100
 

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: den 3 januari 2011 11:08
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] [Wireshark-commits] rev 35253: /trunk/ /trunk/doc/: README.developer /trunk/epan/: tvbuff.c tvbuff.h


On Jan 3, 2011, at 12:50 AM, news.gmane.com wrote:

>> "Stephen Fisher" <steve@xxxxxxxxxxxxxxxxxx> wrote in message 
>> news:20101223181634.GA30749@xxxxxxxxxxxxxxxxxxxxxxxxx...
>>> I've introduced a new function called 
>>> tvb_get_ephemeral_unicode_string()
>>> for converting UTF-16 strings in a tvbuff to UTF-8 for display in 
>>> Wireshark.  This new function even works with tshark (at least on 
>>> Unix) if using a UTF-8 compatiable terminal emulator:
>> 
>> Does this replaces tvb_get_ephemeral_faked_unicode?
>> The function name suggests, that the return value must be released.
>
>Within the context of Wireshark, no, it doesn't; it suggests, due to the "ephemeral" in the name, that it's automatically 
>released when dissection is started on a new packet, although, given that most routines that return ephemerally-allocated 
>memory have just "ep_" at the beginning the name, it should perhaps be named "ep_tvb_get_unicode_string()" or something 
>such as that to make it clearer.  (Yes, tvb_get_ephemeral_faked_unicode() had "ephemeral", not "ep", in its name, but that >was arguably an error as well.  "ep_" should come before "tvb_", as other ephemeral-allocation routines have names that 
>begin with "ep_", including "ep_tvb_memdup()".)

I think I'd prefer the routines defined in tvbuff.c to be prefixed with "tvb_" and having "ep" added some where else
So "ep_tvb_memdup() should perhaps become "tvb_ep_memdup()" or "tvb_memdup_ep()".
Anders

>> Is there
>> also a function returning a string that will be garbage collected?
>
>No - Wireshark doesn't do garbage collection (unless one or more of the extension languages does, and then it does it only >for items allocated in the environment for the extension languages in question, courtesy of the language's garbage 
>collector).  It just does "ephemeral" and "session" allocation, where all items allocated with a particular lifetime are 
>automatically released in bulk.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe