panel crashed, segmentation fault

Benedikt Meurer Benedikt.Meurer at unix-ag.uni-siegen.de
Thu Mar 13 14:46:31 CET 2003


On Thu, 13, Mar 2003, Olivier FOURDAN wrote:

> Hi Benny,

Hello Olivier,

> Okay, great, so now, I ask you to remove the replacement of the static buffer and put back the g_strdup_printf() for the following reasons :
> 
> 1) snprintf is not available on all platforms (e.g. some older versions of Solaris don't have snprintf, while g_snprintf equivalent is provided by glib)

Ok, that fallback to g_snprintf could be provided.

> 2) I'm against static buffers and try as much as possible to avoid their use, because, most of the time, you just cannot guarantee that the default size you put for the buffer will fit for in all cases.

The buffers used in libxfce4mcs aren't static, but are automatic buffers
allocated on the callers stack. The places where I replaced g_strdup_snprintf
with snprintf are safe, and the size should be sufficient.

> 3) I think the the speed improvements that result from the use of static buffer are nothing compared to the drawbaks of having fixed buffer size.
> 4) I don't care about memory fragmentation. That's the job of the underlying system after all...

The memory fragmentation happens on the applications heap and is not
job of the underlying system, but job of the application to beware of.

But I'll use dynamic buffers if you want to :)

> Cheers,
> Olivier.

regards,
Benedikt

-- 
Those who do not understand Unix are condemned to reinvent it, poorly.
    -- Henry Spencer



More information about the Xfce4-dev mailing list