On Mar 19, 2009, at 1:54 PM, Stephen Fisher wrote:

> Stop using fixed length strings so much? :-)
>
> Even if we cast them now, I can see people adding sizeof in the future
> and forgetting to cast it.  GLib doesn't appear to have any other
> solution.

I suspect a lot of the g_snprintf() is to generate formatted strings  
and put them into places such as the Info column and the display form  
of protocol tree items, and I suspect a lot of those calls generate  
strings by producing an initial string and appending to them.  The  
idiom used for the latter is really ugly.

GLib has the GString type, which, other than doing g_mallocs which  
could leak if the dissector throws an exception, are probably the  
right type for this.  Perhaps we should create an ep_string type or  
something such as that, which is a string similar to a GString to  
which you can append stuff, with the string expanding as necessary,  
and use that to replace those g_snprintf()s?
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to