[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Removing My* memory alllocation functions



On Wed, 2010-12-08 at 13:40 +1100, Stephen Ecob wrote:
> Regarding 0002-Not-so-sure-about-these-MyStrdup-calls.patch:
> 
> buffer.c:984: I can't tell, and suggest playing it safe with STRDUP()

    if (line)
      line->Number = strdup (pad->Number);

I lumped this one in because we also used strdup for pad->Number when
creating the pad.

> create.c:593: My $0.02: CreateNewText() called with a NULL pointer
> should be stopped in its tracks with a segfault rather than
> propagating the error.  If you're unsure, though, just hit it with
> STRDUP() - it preserves the current functionality.

Tempting to make it a separate patch at the very least, deliberately
stating in the commit that we are changing behaviour.

> create.c:788 This is definitely *unsafe*, I have observed calls with
> NULL pointers at run time.

Your line-numbers don't agree with mine, but if this is pin->Name, I
didn't change that one.. only pin->Number.

> create.c:875 This is definitely *unsafe*, I have observed calls with
> NULL pointers at run time.

Same as above, I left pad->Name as MyStrdup, -> STRDUP in the mechanical
patch.

TBH, there are so few cases left, we might even just expand the STRDUP
macro in the places where it is required.

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user