Am 29.09.12 03:29, schrieb Jon Trulson:
> On Fri, 28 Sep 2012, Marc Balmer wrote:
> 
>> for patch 1:  don't roll your own strfunctions, use strlcpy or so
> 
> I'm inclined to apply this - strlcpy isn't available on all systems
> (on linux, requires bsd lib I think).  In addition, strlcpy also does
> not permit overlapping buffers, based on a google search.  Was
> valgrind detecting overlapping buffers?  Did it fix a problem?

Well, linking with libbsd is no problem, it is available on all Linux
distributions.  An alternativ could be to include your own copy of the
strlcpy function from e.g. OpenBSD, which is really small.  I would opt
for a solutions that used zillions of time over a hand-made kludge.

Or, maybe try to fix the underlying problem, if there is one.

> 
>> for patch 2: hunk 1 and 3 are not needed
>>
>>
> 
> Yeah, not sure about this one either... Confused.
> 
> Marc says 1 and 3 are not needed, but if you omit them, then 2 cannot
> work otherwise.  I wonder if this is the real problem?  Is this on a
> 64b machine?  I wonder if this patch just moved the problem somewhere
> else?
> 
> Comments on either of these?

Well, I was thinking that hunk 1 and 3 just move the definition of the
static variable outside the functions, but don't change the type, so the
important part was hunk 2, which set the variable to NULL.

But I might be wrong, I did just a glimpse over the code as was in a
hurry (a fact that was reflected in the brevity of my reply :)

What I wanted to say is:

void
foo()
{
    static int bla;
    ...
    bla = NULL;
}

is equal to

static int bla;

void
foo()
{
    bla = NULL;
}

and btw, variables declared outside a function need not be initialized
to zero or NULL, they already are.

> 
> 


------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to