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 its pointer clearing side effect is required 6. treat calls to MyStrdup() on a case by case basis: 6a. calls known to never supply a NULL pointer: replace MyStrdup(x, y) with strdup(x) 6b. calls known to sometimes supply a NULL pointer: replace MyStrdup(x, y) with: (x) ? strdup(x) : (x) 6c. calls where we aren't sure: treat the same as 6b.
Notes 7. 1,2&3 mean that we discard the following side effects of the mymem.c allocators: 7a. logging messages when MEM_DEBUF defined 7b. 0 == 1 logic 7c. alloc failure handling via MyFatal() -> EmergencySave() My personal feeling is that 7a & 7b are essentially useless and that 7c has almost zero probability of ever actually saving someone from losing their PCB. 8. Instead of simply retaining MYFREE(p) (point 5), we could replace each use of it with an explicit: free(p); p = NULL; Personally I prefer two perspicuous lines to a one line opaque macro. Comments? PS If we achieve consensus I'm happy to code the patch. _______________________________________________ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user