Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-07 Thread Peter Clifton
On Tue, 2010-12-07 at 14:59 +1100, Stephen Ecob wrote: I propose the following solution: 1. replace all calls to MyCalloc() with calls to calloc() 2. replace all calls to MyMalloc() with calls to malloc() 3. replace all calls to MyRealloc() with calls to realloc() 4. replace all calls to

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Peter Clifton
On Mon, 2010-12-06 at 16:58 +1100, Stephen Ecob wrote: If you use (or intend to use) lib dmalloc with PCB you will find the following useful. I've uploaded a patch against current heaad to sourceforge, ID #3129279, described as follows: Looks useful, I will push it, however, please explain

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Peter TB Brett
On Monday 06 Dec 2010 13:31:09 Peter Clifton wrote: I did loose some respect for the dmalloc author(s) when I noticed on their page they can't spell Microsoft Windows correctly. Windoze In general, valgrind (probably not even conceived of when dmalloc was first written), is a much more

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Stephen Ecob
On Tue, Dec 7, 2010 at 12:31 AM, Peter Clifton pc...@cam.ac.uk wrote: On Mon, 2010-12-06 at 16:58 +1100, Stephen Ecob wrote: If you use (or intend to use) lib dmalloc with PCB you will find the following useful. I've uploaded a patch against current heaad to sourceforge, ID #3129279,

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Peter Clifton
On Tue, 2010-12-07 at 10:04 +1100, Stephen Ecob wrote: Dropping the (a) ? (a) : 1 foolishness would be cleaner, but could expose latent bugs in the 71 callers of the mymem allocators. I'm happy to proceed either way. What is your preference ? Let me push a big patch nuking the My* allocation

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Peter Clifton
On Tue, 2010-12-07 at 00:48 +, Peter Clifton wrote: On Tue, 2010-12-07 at 10:04 +1100, Stephen Ecob wrote: Dropping the (a) ? (a) : 1 foolishness would be cleaner, but could expose latent bugs in the 71 callers of the mymem allocators. I'm happy to proceed either way. What is your

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Stephen Ecob
On Tue, Dec 7, 2010 at 11:48 AM, Peter Clifton pc...@cam.ac.uk wrote: On Tue, 2010-12-07 at 10:04 +1100, Stephen Ecob wrote: Dropping the (a) ? (a) : 1 foolishness would be cleaner, but could expose latent bugs in the 71 callers of the mymem allocators. I'm happy to proceed either way.  What

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Russell Shaw
On 07/12/10 11:55, Peter Clifton wrote: On Tue, 2010-12-07 at 00:48 +, Peter Clifton wrote: On Tue, 2010-12-07 at 10:04 +1100, Stephen Ecob wrote: Dropping the (a) ? (a) : 1 foolishness would be cleaner, but could expose latent bugs in the 71 callers of the mymem allocators. I'm happy to

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Peter Clifton
On Tue, 2010-12-07 at 11:58 +1100, Stephen Ecob wrote: On Tue, Dec 7, 2010 at 11:48 AM, Peter Clifton pc...@cam.ac.uk wrote: On Tue, 2010-12-07 at 10:04 +1100, Stephen Ecob wrote: Dropping the (a) ? (a) : 1 foolishness would be cleaner, but could expose latent bugs in the 71 callers of

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Stephen Ecob
I count 54 locations in head that call MyStrdup() A run time check of calls to MyStrdup() shows: create.c:197 made 0 NULL calls, 48 good calls create.c:219 made 0 NULL calls, 32 good calls create.c:238 made 0 NULL calls, 1 good calls create.c:240 made 0 NULL calls, 1 good calls create.c:286 made

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread DJ Delorie
So calls with a NULL pointer are rare, but there are at least 3 callers that require tolerance of it. I wouldn't call 3% rare. Uncommon, perhaps, but given who those three callers are, it's far more significant than mere numbers show. ___

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Stephen Ecob
I propose the following solution: 1. replace all calls to MyCalloc() with calls to calloc() 2. replace all calls to MyMalloc() with calls to malloc() 3. replace all calls to MyRealloc() with calls to realloc() 4. replace all calls to SaveFree() with calls to free() 5. retain the MYFREE() macro as

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread timecop
5. retain the MYFREE() macro as its pointer clearing side effect is required 8. Instead of simply retaining MYFREE(p) (point 5), we could replace each use of it with an explicit: free(p); p = NULL; Is this MY prefix actually in the code? Most sane places call the kind of free your'e

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread DJ Delorie
Is this MY prefix actually in the code? It's free software, you could just look at the code yourself. Yes, the MY prefix is used in pcb, otherwise why would we be talking about it? ___ geda-user mailing list geda-user@moria.seul.org

Re: gEDA-user: Small patch to aid use of lib dmalloc

2010-12-06 Thread Stephen Ecob
On Tue, Dec 7, 2010 at 3:06 PM, timecop time...@gmail.com wrote: 5. retain the MYFREE() macro as its pointer clearing side effect is required 8. Instead of simply retaining MYFREE(p) (point 5), we could replace each use of it with an explicit:  free(p);  p = NULL; Is this MY prefix actually

gEDA-user: Small patch to aid use of lib dmalloc

2010-12-05 Thread Stephen Ecob
If you use (or intend to use) lib dmalloc with PCB you will find the following useful. I've uploaded a patch against current heaad to sourceforge, ID #3129279, described as follows: PCB supports the use of the dmalloc library as a configuration option. This patch makes the PCB source code more