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

gEDA-cvs: pcb.git: branch: master updated (0e24fde9348a61c2d25bb07b0a53e47e52a2d0a5)



The branch, master has been updated
       via  0e24fde9348a61c2d25bb07b0a53e47e52a2d0a5 (commit)
       via  277f9b937180093f38f2cdc2abc5a57ba22cb610 (commit)
      from  48ba0051476ab1e0bf1e8f3d598c410a09f41614 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/action.c                  |   12 +-
 src/buffer.c                  |   13 +-
 src/command.c                 |    2 +-
 src/copy.c                    |    2 +-
 src/create.c                  |   51 +++-----
 src/drill.c                   |   29 +++--
 src/file.c                    |   34 +++---
 src/find.c                    |   43 +++----
 src/fontmode.c                |    8 +-
 src/hid/common/flags.c        |    2 +-
 src/hid/gerber/gerber.c       |    6 +-
 src/hid/gtk/gtkhid-gdk.c      |    6 +-
 src/hid/gtk/gui-dialog-size.c |    2 +-
 src/hid/gtk/gui-top-window.c  |    4 +-
 src/hid/lesstif/main.c        |    5 +-
 src/hid/lesstif/menu.c        |    4 +-
 src/hid/lesstif/styles.c      |    3 +-
 src/intersect.c               |   11 +-
 src/main.c                    |    6 +-
 src/misc.c                    |   20 ++--
 src/move.c                    |    2 +-
 src/mymem.c                   |  277 ++++++++++-------------------------------
 src/mymem.h                   |    9 +-
 src/netlist.c                 |    6 +-
 src/parse_l.l                 |    5 +-
 src/parse_y.y                 |   82 ++++++------
 src/rats.c                    |   24 ++--
 src/remove.c                  |    8 +-
 src/report.c                  |    2 +-
 src/undo.c                    |   10 +-
 30 files changed, 253 insertions(+), 435 deletions(-)


=================
 Commit Messages
=================

commit 0e24fde9348a61c2d25bb07b0a53e47e52a2d0a5
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Remove My* memory allocation routines. Just use the standard APIs directly
    
    This means the following changes:
    
      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()
    
      5a. Where the MYFREE(x) macro is used and its pointer clearing side-
          effect is required, call free (x); and (x) = NULL; directly.
      5b. Where the MYFREE(x) macro is used, and (x) is immediately re-
          assigned, or its location free'd or zero'd, skip the (x) = NULL;
    
      6. Replace all calls to MyStrdup() with calls to the STRDUP(x) macro,
         which expands to (((x) != NULL) ? strdup (x) : NULL).
    
    NB: The previous commit already replaced various known "safe" calls of
        MyStrdup() with strdup(), when the argument is known to be non-NULL.
    
      1,2,3 and 6. mean that we discard the following features of the
      mymem.c allocators:
    
        7. Logging messages when MEM_DEBUF defined
        8. Logic to assign 1 unit of memory if 0 is requested
        9. Allocation failure handling via MyFatal() -> EmergencySave()
    
    
    With feedback from Stephen Ecob <silicon.on.inspiration@xxxxxxxxx>
    
    7. Is old debug code which is rarely (if ever) used. Current debug tools
       such as Valgrind can do a much better job of memory debugging now.
    
    8. This is really papering over the possibility of a caller bug, and
       should never have been included in the first place.
    
    9. This is unlikely to actually ever save someone from loosing their PCB.

:100644 100644 f5e043a... 0e035a6... M	src/action.c
:100644 100644 c69fc39... 4447c30... M	src/buffer.c
:100644 100644 b41263b... 5c2b985... M	src/command.c
:100644 100644 735f20f... 538ea0d... M	src/create.c
:100644 100644 738ed18... 1f1d770... M	src/drill.c
:100644 100644 5a926f8... bfe0de0... M	src/file.c
:100644 100644 8d468bb... 3176357... M	src/find.c
:100644 100644 e4a566d... 30859fb... M	src/hid/common/flags.c
:100644 100644 1f6341b... 85e01f3... M	src/hid/gerber/gerber.c
:100644 100644 461b779... 5cd969c... M	src/hid/gtk/gtkhid-gdk.c
:100644 100644 2f49f06... 16caff3... M	src/hid/gtk/gui-dialog-size.c
:100644 100644 9c30a93... 90977e2... M	src/hid/gtk/gui-top-window.c
:100644 100644 76dce1a... 5f497a8... M	src/hid/lesstif/main.c
:100644 100644 aca306d... 6baa016... M	src/hid/lesstif/menu.c
:100644 100644 d3dcdaa... 9b67d0f... M	src/hid/lesstif/styles.c
:100644 100644 8f99ad7... 7389ba9... M	src/intersect.c
:100644 100644 c23ae8b... 462285d... M	src/main.c
:100644 100644 9ab9f53... 2e471d0... M	src/misc.c
:100644 100644 13863c1... 09cb6ab... M	src/mymem.c
:100644 100644 fdfd7e6... 4e36640... M	src/mymem.h
:100644 100644 459b08a... 4a26bc9... M	src/netlist.c
:100644 100644 c9d96c8... a2808ad... M	src/parse_l.l
:100644 100644 f4fc367... 7aa7b80... M	src/parse_y.y
:100644 100644 67a0efc... 3c5ede1... M	src/rats.c
:100644 100644 98b9ade... 8defaf4... M	src/remove.c
:100644 100644 dc01153... 7af4358... M	src/report.c
:100644 100644 68ea8ff... 5226c53... M	src/undo.c

commit 277f9b937180093f38f2cdc2abc5a57ba22cb610
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Convet some "safe" usage of MyStrdup to plain strdup
    
    These cases are ones where we know the caller will not risk
    passing a NULL string to duplicate.

:100644 100644 9e1370b... f5e043a... M	src/action.c
:100644 100644 f9d6f5a... c69fc39... M	src/buffer.c
:100644 100644 c8244ed... ee831b9... M	src/copy.c
:100644 100644 15c0099... 735f20f... M	src/create.c
:100644 100644 8cbd95d... 5a926f8... M	src/file.c
:100644 100644 bd9fcee... 4f7f5b8... M	src/fontmode.c
:100644 100644 923e0ee... c23ae8b... M	src/main.c
:100644 100644 34b18cb... 9ab9f53... M	src/misc.c
:100644 100644 cce6e19... cbb2e3d... M	src/move.c
:100644 100644 ade8326... 459b08a... M	src/netlist.c
:100644 100644 46a18c8... 67a0efc... M	src/rats.c

=========
 Changes
=========

commit 0e24fde9348a61c2d25bb07b0a53e47e52a2d0a5
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Remove My* memory allocation routines. Just use the standard APIs directly
    
    This means the following changes:
    
      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()
    
      5a. Where the MYFREE(x) macro is used and its pointer clearing side-
          effect is required, call free (x); and (x) = NULL; directly.
      5b. Where the MYFREE(x) macro is used, and (x) is immediately re-
          assigned, or its location free'd or zero'd, skip the (x) = NULL;
    
      6. Replace all calls to MyStrdup() with calls to the STRDUP(x) macro,
         which expands to (((x) != NULL) ? strdup (x) : NULL).
    
    NB: The previous commit already replaced various known "safe" calls of
        MyStrdup() with strdup(), when the argument is known to be non-NULL.
    
      1,2,3 and 6. mean that we discard the following features of the
      mymem.c allocators:
    
        7. Logging messages when MEM_DEBUF defined
        8. Logic to assign 1 unit of memory if 0 is requested
        9. Allocation failure handling via MyFatal() -> EmergencySave()
    
    
    With feedback from Stephen Ecob <silicon.on.inspiration@xxxxxxxxx>
    
    7. Is old debug code which is rarely (if ever) used. Current debug tools
       such as Valgrind can do a much better job of memory debugging now.
    
    8. This is really papering over the possibility of a caller bug, and
       should never have been included in the first place.
    
    9. This is unlikely to actually ever save someone from loosing their PCB.

diff --git a/src/action.c b/src/action.c
index f5e043a..0e035a6 100644
--- a/src/action.c
+++ b/src/action.c
@@ -5731,7 +5731,7 @@ ActionSaveTo (int argc, char **argv, int x, int y)
 
   if (strcasecmp (function, "LayoutAs") == 0)
     {
-      MYFREE (PCB->Filename);
+      free (PCB->Filename);
       PCB->Filename = strdup (name);
       SavePCB (PCB->Filename);
       return 0;
@@ -5891,7 +5891,7 @@ ActionLoadFrom (int argc, char **argv, int x, int y)
   else if (strcasecmp (function, "Netlist") == 0)
     {
       if (PCB->Netlistname)
-	SaveFree (PCB->Netlistname);
+	free (PCB->Netlistname);
       PCB->Netlistname = StripWhiteSpaceAndDup (name);
       FreeLibraryMemory (&PCB->NetlistLib);
       if (!ImportNetlist (PCB->Netlistname))
@@ -7239,7 +7239,7 @@ ActionElementSetAttr (int argc, char **argv, int x, int y)
 
   if (attr && value)
     {
-      MYFREE (attr->value);
+      free (attr->value);
       attr->value = strdup (value);
     }
   if (attr && ! value)
diff --git a/src/buffer.c b/src/buffer.c
index c69fc39..4447c30 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -953,7 +953,7 @@ SmashBufferElement (BufferTypePtr Buffer)
 			  line->Point2.X, line->Point2.Y,
 			  line->Thickness, 0, NoFlags ());
     if (line)
-      line->Number = MyStrdup (NAMEONPCB_NAME (element), "SmashBuffer");
+      line->Number = STRDUP (NAMEONPCB_NAME (element));
   }
   END_LOOP;
   ARC_LOOP (element);
@@ -991,11 +991,11 @@ SmashBufferElement (BufferTypePtr Buffer)
 				 pad->Point2.X, pad->Point2.Y,
 				 pad->Thickness, pad->Clearance, NoFlags ());
     if (line)
-      line->Number = MyStrdup (pad->Number, "SmashBuffer");
+      line->Number = STRDUP (pad->Number);
   }
   END_LOOP;
   FreeElementMemory (element);
-  SaveFree (element);
+  free (element);
   return (true);
 }
 
@@ -1216,7 +1216,7 @@ LoadLayoutToBuffer (BufferTypePtr Buffer, char *Filename)
     {
       /* clear data area and replace pointer */
       ClearBuffer (Buffer);
-      SaveFree (Buffer->Data);
+      free (Buffer->Data);
       Buffer->Data = newPCB->Data;
       newPCB->Data = NULL;
       Buffer->X = newPCB->CursorX;
diff --git a/src/command.c b/src/command.c
index b41263b..5c2b985 100644
--- a/src/command.c
+++ b/src/command.c
@@ -297,7 +297,7 @@ CommandLoadNetlist (int argc, char **argv, int x, int y)
       return (1);
     }
   if (PCB->Netlistname)
-    SaveFree (PCB->Netlistname);
+    free (PCB->Netlistname);
   PCB->Netlistname = StripWhiteSpaceAndDup (filename);
   free (name);
   return (0);
diff --git a/src/create.c b/src/create.c
index 735f20f..538ea0d 100644
--- a/src/create.c
+++ b/src/create.c
@@ -80,7 +80,7 @@ DataTypePtr
 CreateNewBuffer (void)
 {
   DataTypePtr data;
-  data = (DataTypePtr) MyCalloc (1, sizeof (DataType), "CreateNewBuffer()");
+  data = (DataTypePtr) calloc (1, sizeof (DataType));
   data->pcb = (void *) PCB;
   return data;
 }
@@ -136,7 +136,7 @@ CreateNewPCB (bool SetDefaultNames)
   int i;
 
   /* allocate memory, switch all layers on and copy resources */
-  ptr = MyCalloc (1, sizeof (PCBType), "CreateNewPCB()");
+  ptr = calloc (1, sizeof (PCBType));
   ptr->Data = CreateNewBuffer ();
   ptr->Data->pcb = (void *) ptr;
 
@@ -259,7 +259,7 @@ CreateNewVia (DataTypePtr Data,
 	       0.01 * Via->DrillingHole, 0.01 * DrillingHole);
     }
 
-  Via->Name = MyStrdup (Name, "CreateNewVia()");
+  Via->Name = STRDUP (Name);
   Via->Flags = Flags;
   CLEAR_FLAG (WARNFLAG, Via);
   SET_FLAG (VIAFLAG, Via);
@@ -704,8 +704,7 @@ CreateNewArcInElement (ElementTypePtr Element,
   if (Element->ArcN >= Element->ArcMax)
     {
       Element->ArcMax += STEP_ELEMENTARC;
-      arc = MyRealloc (arc, Element->ArcMax * sizeof (ArcType),
-		       "CreateNewArcInElement()");
+      arc = realloc (arc, Element->ArcMax * sizeof (ArcType));
       Element->Arc = arc;
       memset (arc + Element->ArcN, 0, STEP_ELEMENTARC * sizeof (ArcType));
     }
@@ -751,8 +750,7 @@ CreateNewLineInElement (ElementTypePtr Element,
   if (Element->LineN >= Element->LineMax)
     {
       Element->LineMax += STEP_ELEMENTLINE;
-      line = MyRealloc (line, Element->LineMax * sizeof (LineType),
-			"CreateNewLineInElement()");
+      line = realloc (line, Element->LineMax * sizeof (LineType));
       Element->Line = line;
       memset (line + Element->LineN, 0, STEP_ELEMENTLINE * sizeof (LineType));
     }
@@ -787,8 +785,8 @@ CreateNewPin (ElementTypePtr Element,
   pin->Thickness = Thickness;
   pin->Clearance = Clearance;
   pin->Mask = Mask;
-  pin->Name = MyStrdup (Name, "CreateNewPin()");
-  pin->Number = MyStrdup (Number, "CreateNewPin()");
+  pin->Name = STRDUP (Name);
+  pin->Number = STRDUP (Number);
   pin->Flags = Flags;
   CLEAR_FLAG (WARNFLAG, pin);
   SET_FLAG (PINFLAG, pin);
@@ -874,8 +872,8 @@ CreateNewPad (ElementTypePtr Element,
   pad->Thickness = Thickness;
   pad->Clearance = Clearance;
   pad->Mask = Mask;
-  pad->Name = MyStrdup (Name, "CreateNewPad()");
-  pad->Number = MyStrdup (Number, "CreateNewPad()");
+  pad->Name = STRDUP (Name);
+  pad->Number = STRDUP (Number);
   pad->Flags = Flags;
   CLEAR_FLAG (WARNFLAG, pad);
   pad->ID = ID++;
@@ -892,13 +890,13 @@ AddTextToElement (TextTypePtr Text, FontTypePtr PCBFont,
 		  LocationType X, LocationType Y,
 		  BYTE Direction, char *TextString, int Scale, FlagType Flags)
 {
-  MYFREE (Text->TextString);
+  free (Text->TextString);
+  Text->TextString = (TextString && *TextString) ? strdup (TextString) : NULL;
   Text->X = X;
   Text->Y = Y;
   Text->Direction = Direction;
   Text->Flags = Flags;
   Text->Scale = Scale;
-  Text->TextString = (TextString && *TextString) ? strdup (TextString) : NULL;
 
   /* calculate size of the bounding box */
   SetTextBoundingBox (PCBFont, Text);
@@ -919,8 +917,7 @@ CreateNewLineInSymbol (SymbolTypePtr Symbol,
   if (Symbol->LineN >= Symbol->LineMax)
     {
       Symbol->LineMax += STEP_SYMBOLLINE;
-      line = MyRealloc (line, Symbol->LineMax * sizeof (LineType),
-			"CreateNewLineInSymbol()");
+      line = realloc (line, Symbol->LineMax * sizeof (LineType));
       Symbol->Line = line;
       memset (line + Symbol->LineN, 0, STEP_SYMBOLLINE * sizeof (LineType));
     }
@@ -994,7 +991,7 @@ CreateNewConnection (LibraryMenuTypePtr net, char *conn)
 {
   LibraryEntryTypePtr entry = GetLibraryEntryMemory (net);
 
-  entry->ListEntry = MyStrdup (conn, "CreateNewConnection()");
+  entry->ListEntry = STRDUP (conn);
   return (entry);
 }
 
@@ -1007,12 +1004,10 @@ CreateNewAttribute (AttributeListTypePtr list, char *name, char *value)
   if (list->Number >= list->Max)
     {
       list->Max += 10;
-      list->List = MyRealloc (list->List,
-			      list->Max * sizeof (AttributeType),
-			      "CreateNewAttribute");
+      list->List = realloc (list->List, list->Max * sizeof (AttributeType));
     }
-  list->List[list->Number].name = MyStrdup (name, "CreateNewAttribute");
-  list->List[list->Number].value = MyStrdup (value, "CreateNewAttribute");
+  list->List[list->Number].name = STRDUP (name);
+  list->List[list->Number].value = STRDUP (value);
   list->Number++;
   return &list->List[list->Number - 1];
 }
diff --git a/src/drill.c b/src/drill.c
index 738ed18..1f1d770 100644
--- a/src/drill.c
+++ b/src/drill.c
@@ -126,7 +126,7 @@ GetDrillInfo (DataTypePtr top)
   bool DrillFound = false;
   bool NewDrill;
 
-  AllDrills = MyCalloc (1, sizeof (DrillInfoType), "GetAllDrillInfo()");
+  AllDrills = calloc (1, sizeof (DrillInfoType));
   ALLPIN_LOOP (top);
   {
     if (!DrillFound)
@@ -235,10 +235,9 @@ RoundDrillInfo (DrillInfoTypePtr d, int roundto)
 	    = d->Drill[i].ElementN + d->Drill[i+1].ElementN;
 	  if (d->Drill[i].ElementMax)
 	    {
-	      d->Drill[i].Element = MyRealloc (d->Drill[i].Element,
-					       d->Drill[i].ElementMax *
-					       sizeof(ElementTypePtr),
-					       "RoundDrillInfo");
+	      d->Drill[i].Element = realloc (d->Drill[i].Element,
+					     d->Drill[i].ElementMax *
+					     sizeof (ElementTypePtr));
 
 	      for (ei = 0; ei < d->Drill[i+1].ElementN; ei++)
 		{
@@ -250,16 +249,18 @@ RoundDrillInfo (DrillInfoTypePtr d, int roundto)
 		      = d->Drill[i + 1].Element[ei];
 		}
 	    }
-	  MYFREE (d->Drill[i + 1].Element);
+	  free (d->Drill[i + 1].Element);
+	  d->Drill[i + 1].Element = NULL;
 
 	  d->Drill[i].PinMax = d->Drill[i].PinN + d->Drill[i + 1].PinN;
-	  d->Drill[i].Pin = MyRealloc (d->Drill[i].Pin,
-				       d->Drill[i].PinMax *
-				       sizeof (PinTypePtr), "RoundDrillInfo");
+	  d->Drill[i].Pin = realloc (d->Drill[i].Pin,
+				     d->Drill[i].PinMax *
+				     sizeof (PinTypePtr));
 	  memcpy (d->Drill[i].Pin + d->Drill[i].PinN, d->Drill[i + 1].Pin,
 		  d->Drill[i + 1].PinN * sizeof (PinTypePtr));
 	  d->Drill[i].PinN += d->Drill[i + 1].PinN;
-	  MYFREE (d->Drill[i + 1].Pin);
+	  free (d->Drill[i + 1].Pin);
+	  d->Drill[i + 1].Pin = NULL;
 
 	  d->Drill[i].PinCount += d->Drill[i + 1].PinCount;
 	  d->Drill[i].ViaCount += d->Drill[i + 1].ViaCount;
@@ -285,10 +286,10 @@ FreeDrillInfo (DrillInfoTypePtr Drills)
 {
   DRILL_LOOP (Drills);
   {
-    MYFREE (drill->Element);
-    MYFREE (drill->Pin);
+    free (drill->Element);
+    free (drill->Pin);
   }
   END_LOOP;
-  MYFREE (Drills->Drill);
-  SaveFree (Drills);
+  free (Drills->Drill);
+  free (Drills);
 }
diff --git a/src/file.c b/src/file.c
index 5a926f8..bfe0de0 100644
--- a/src/file.c
+++ b/src/file.c
@@ -319,7 +319,7 @@ SavePCB (char *Filename)
        * it might be identical to 'PCB->Filename'
        */
       copy = strdup (Filename);
-      SaveFree (PCB->Filename);
+      free (PCB->Filename);
       PCB->Filename = copy;
       SetChangedFlag (false);
     }
@@ -1223,7 +1223,7 @@ LoadNewlibFootprintsFromDir(char *libpath, char *toppath)
 	 * entry->ListEntry points to fp name itself.
 	 */
 	len = strlen(subdir) + strlen("/") + strlen(subdirentry->d_name) + 1;
-	entry->AllocatedMemory = MyCalloc (1, len, "ParseLibraryTree()");
+	entry->AllocatedMemory = calloc (1, len);
 	strcat (entry->AllocatedMemory, subdir);
 	strcat (entry->AllocatedMemory, PCB_DIR_SEPARATOR_S);
 
@@ -1382,7 +1382,7 @@ ReadLibraryContents (void)
   /*  First load the M4 stuff.  The variable Settings.LibraryPath
    *  points to it.
    */
-  MYFREE (command);
+  free (command);
   command = EvaluateFilename (Settings.LibraryContentsCommand,
 			      Settings.LibraryPath, Settings.LibraryFilename,
 			      NULL);
@@ -1447,8 +1447,7 @@ ReadLibraryContents (void)
 	  /* create the list entry */
 	  len = strlen (EMPTY (entry->Value)) +
 	    strlen (EMPTY (entry->Description)) + 4;
-	  entry->ListEntry = MyCalloc (len, sizeof (char),
-				       "ReadLibraryDescription()");
+	  entry->ListEntry = calloc (len, sizeof (char));
 	  sprintf (entry->ListEntry,
 		   "%s, %s", EMPTY (entry->Value),
 		   EMPTY (entry->Description));
@@ -1507,7 +1506,7 @@ ReadNetlist (char *filename)
   else
     {
       used_popen = 1;
-      MYFREE (command);
+      free (command);
       command = EvaluateFilename (Settings.RatCommand,
 				  Settings.RatPath, filename, NULL);
 
diff --git a/src/find.c b/src/find.c
index 8d468bb..3176357 100644
--- a/src/find.c
+++ b/src/find.c
@@ -569,19 +569,26 @@ FreeLayoutLookupMemory (void)
 
   for (i = 0; i < max_copper_layer; i++)
     {
-      MYFREE (LineList[i].Data);
-      MYFREE (ArcList[i].Data);
-      MYFREE (PolygonList[i].Data);
+      free (LineList[i].Data);
+      LineList[i].Data = NULL;
+      free (ArcList[i].Data);
+      ArcList[i].Data = NULL;
+      free (PolygonList[i].Data);
+      PolygonList[i].Data = NULL;
     }
-  MYFREE (PVList.Data);
-  MYFREE (RatList.Data);
+  free (PVList.Data);
+  PVList.Data = NULL;
+  free (RatList.Data);
+  RatList.Data = NULL;
 }
 
 void
 FreeComponentLookupMemory (void)
 {
-  MYFREE (PadList[0].Data);
-  MYFREE (PadList[1].Data);
+  free (PadList[0].Data);
+  PadList[0].Data = NULL;
+  free (PadList[1].Data);
+  PadList[1].Data = NULL;
 }
 
 /* ---------------------------------------------------------------------------
@@ -608,9 +615,7 @@ InitComponentLookup (void)
   for (i = 0; i < 2; i++)
     {
       /* allocate memory for working list */
-      PadList[i].Data =
-        (void **) MyCalloc (NumberOfPads[i], sizeof (PadTypePtr),
-                            "InitComponentLookup()");
+      PadList[i].Data = calloc (NumberOfPads[i], sizeof (PadTypePtr));
 
       /* clear some struct members */
       PadList[i].Location = 0;
@@ -637,16 +642,12 @@ InitLayoutLookup (void)
       if (layer->LineN)
         {
           /* allocate memory for line pointer lists */
-          LineList[i].Data =
-            (void **) MyCalloc (layer->LineN, sizeof (LineTypePtr),
-                                "InitLayoutLookup()");
+          LineList[i].Data = calloc (layer->LineN, sizeof (LineTypePtr));
           LineList[i].Size = layer->LineN;
         }
       if (layer->ArcN)
         {
-          ArcList[i].Data =
-            (void **) MyCalloc (layer->ArcN, sizeof (ArcTypePtr),
-                                "InitLayoutLookup()");
+          ArcList[i].Data = calloc (layer->ArcN, sizeof (ArcTypePtr));
           ArcList[i].Size = layer->ArcN;
         }
 
@@ -654,9 +655,7 @@ InitLayoutLookup (void)
       /* allocate memory for polygon list */
       if (layer->PolygonN)
         {
-          PolygonList[i].Data = (void **) MyCalloc (layer->PolygonN,
-                                                    sizeof (PolygonTypePtr),
-                                                    "InitLayoutLookup()");
+          PolygonList[i].Data = calloc (layer->PolygonN, sizeof (PolygonTypePtr));
           PolygonList[i].Size = layer->PolygonN;
         }
 
@@ -681,15 +680,13 @@ InitLayoutLookup (void)
   else
     TotalV = 0;
   /* allocate memory for 'new PV to check' list and clear struct */
-  PVList.Data = (void **) MyCalloc (TotalP + TotalV, sizeof (PinTypePtr),
-                                    "InitLayoutLookup()");
+  PVList.Data = calloc (TotalP + TotalV, sizeof (PinTypePtr));
   PVList.Size = TotalP + TotalV;
   PVList.Location = 0;
   PVList.DrawLocation = 0;
   PVList.Number = 0;
   /* Initialize ratline data */
-  RatList.Data = (void **) MyCalloc (PCB->Data->RatN, sizeof (RatTypePtr),
-                                     "InitLayoutLookup()");
+  RatList.Data = calloc (PCB->Data->RatN, sizeof (RatTypePtr));
   RatList.Size = PCB->Data->RatN;
   RatList.Location = 0;
   RatList.DrawLocation = 0;
diff --git a/src/hid/common/flags.c b/src/hid/common/flags.c
index e4a566d..30859fb 100644
--- a/src/hid/common/flags.c
+++ b/src/hid/common/flags.c
@@ -110,7 +110,7 @@ hid_get_flag (const char *name)
       if (nbuf < (cp - name + 1))
 	{
 	  nbuf = cp - name + 10;
-	  buf = MyRealloc (buf, nbuf, "hid_get_flag");
+	  buf = realloc (buf, nbuf);
 	}
       memcpy (buf, name, cp - name);
       buf[cp - name] = 0;
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 1f6341b..85e01f3 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -230,9 +230,7 @@ SetAppLayer (int l)
     {
       int prev = n_layerapps;
       n_layerapps = l + 1;
-      layerapps =
-	MyRealloc (layerapps, n_layerapps * sizeof (Apertures),
-		   "SetAppLayer");
+      layerapps = realloc (layerapps, n_layerapps * sizeof (Apertures));
       curapp = layerapps + prev;
       while (curapp < layerapps + n_layerapps)
 	{
@@ -364,7 +362,7 @@ gerber_do_export (HID_Attr_Val * options)
   all_layers = options[HA_all_layers].int_value;
 
   i = strlen (fnbase);
-  filename = MyRealloc (filename, i + 40, "gerber");
+  filename = realloc (filename, i + 40);
   strcpy (filename, fnbase);
   strcat (filename, ".");
   filesuff = filename + strlen (filename);
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 461b779..5cd969c 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -133,8 +133,7 @@ ghid_draw_grid (void)
   if (n > npoints)
     {
       npoints = n + 10;
-      points =
-	MyRealloc (points, npoints * sizeof (GdkPoint), "gtk_draw_grid");
+      points = realloc (points, npoints * sizeof (GdkPoint));
     }
   n = 0;
   for (x = x1; x <= x2; x += PCB->Grid)
@@ -601,8 +600,7 @@ ghid_fill_polygon (hidGC gc, int n_coords, int *x, int *y)
   if (npoints < n_coords)
     {
       npoints = n_coords + 1;
-      points = MyRealloc (points,
-			  npoints * sizeof (GdkPoint), (char *) __FUNCTION__);
+      points = realloc (points, npoints * sizeof (GdkPoint));
     }
   for (i = 0; i < n_coords; i++)
     {
diff --git a/src/hid/gtk/gui-dialog-size.c b/src/hid/gtk/gui-dialog-size.c
index 2f49f06..16caff3 100644
--- a/src/hid/gtk/gui-dialog-size.c
+++ b/src/hid/gtk/gui-dialog-size.c
@@ -308,7 +308,7 @@ ghid_route_style_dialog (gint index, RouteStyleType * temp_rst)
       if (index < NUM_STYLES && !set_temp1 && !set_temp2)
 	{
 	  string = ghid_entry_get_text (sd->name_entry);
-	  SaveFree (rst->Name);
+	  free (rst->Name);
 	  rst->Name = StripWhiteSpaceAndDup (string);
 	  pcb_use_route_style (rst);
 	  SetChangedFlag (true);
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 9c30a93..90977e2 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -303,9 +303,7 @@ note_toggle_flag (const char *actionname, MenuFlagType type, char *name)
   if (n_tflags >= max_tflags)
     {
       max_tflags += 20;
-      tflags =
-	MyRealloc (tflags, max_tflags * sizeof (ToggleFlagType),
-		   __FUNCTION__);
+      tflags = realloc (tflags, max_tflags * sizeof (ToggleFlagType));
     }
   tflags[n_tflags].actionname = strdup (actionname);
   tflags[n_tflags].flagname = name;
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 76dce1a..5f497a8 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -2236,8 +2236,7 @@ draw_grid ()
   if (n > npoints)
     {
       npoints = n + 10;
-      points =
-	MyRealloc (points, npoints * sizeof (XPoint), "lesstif_draw_grid");
+      points = realloc (points, npoints * sizeof (XPoint));
     }
   n = 0;
   prevx = 0;
@@ -3675,7 +3674,7 @@ lesstif_show_item (void *item)
   if (!mainwind)
     return;
 
-  pd = (PinoutData *) MyCalloc (1, sizeof (PinoutData), "lesstif_show_item");
+  pd = calloc (1, sizeof (PinoutData));
 
   pd->item = item;
 
diff --git a/src/hid/lesstif/menu.c b/src/hid/lesstif/menu.c
index aca306d..6baa016 100644
--- a/src/hid/lesstif/menu.c
+++ b/src/hid/lesstif/menu.c
@@ -672,9 +672,7 @@ note_widget_flag (Widget w, char *type, char *name)
   if (n_wflags >= max_wflags)
     {
       max_wflags += 20;
-      wflags =
-	MyRealloc (wflags, max_wflags * sizeof (WidgetFlagType),
-		   __FUNCTION__);
+      wflags = realloc (wflags, max_wflags * sizeof (WidgetFlagType));
     }
   wflags[n_wflags].w = w;
   wflags[n_wflags].flagname = name;
diff --git a/src/hid/lesstif/styles.c b/src/hid/lesstif/styles.c
index d3dcdaa..9b67d0f 100644
--- a/src/hid/lesstif/styles.c
+++ b/src/hid/lesstif/styles.c
@@ -452,8 +452,7 @@ lesstif_insert_style_buttons (Widget menu)
 
   num_style_buttons++;
   s = num_style_buttons * sizeof (StyleButtons);
-  style_button_list =
-    (StyleButtons *) MyRealloc (style_button_list, s, __FUNCTION__);
+  style_button_list = realloc (style_button_list, s);
   sb = style_button_list + num_style_buttons - 1;
 
   for (i = 0; i < NUM_STYLES; i++)
diff --git a/src/intersect.c b/src/intersect.c
index 8f99ad7..7389ba9 100644
--- a/src/intersect.c
+++ b/src/intersect.c
@@ -97,8 +97,7 @@ createSortedYList (BoxListTypePtr boxlist)
   int i, n;
   /* create sorted list of Y coordinates */
   yCoords.size = 2 * boxlist->BoxN;
-  yCoords.p = MyCalloc (yCoords.size, sizeof (*yCoords.p),
-                        "createSortedYList");
+  yCoords.p = calloc (yCoords.size, sizeof (*yCoords.p));
   for (i = 0; i < boxlist->BoxN; i++)
     {
       yCoords.p[2 * i] = boxlist->Box[i].Y1;
@@ -124,7 +123,7 @@ createSegmentTree (LocationType * yCoords, int N)
   int i;
   /* size is twice the nearest larger power of 2 */
   st.size = 2 * nextpwrof2 (N);
-  st.nodes = MyCalloc (st.size, sizeof (*st.nodes), "createSegmentTree");
+  st.nodes = calloc (st.size, sizeof (*st.nodes));
   /* initialize the rightmost leaf node */
   st.nodes[st.size - 1].left = (N > 0) ? yCoords[--N] : 10;
   st.nodes[st.size - 1].right = st.nodes[st.size - 1].left + 1;
@@ -235,10 +234,8 @@ ComputeUnionArea (BoxListTypePtr boxlist)
   segtree = createSegmentTree (yCoords.p, yCoords.size);
   free (yCoords.p);
   /* create sorted list of left and right X coordinates of rectangles */
-  rectLeft = MyCalloc (boxlist->BoxN, sizeof (*rectLeft),
-                       "ComputeUnionArea(1)");
-  rectRight = MyCalloc (boxlist->BoxN, sizeof (*rectRight),
-                        "ComputeUnionArea(2)");
+  rectLeft = calloc (boxlist->BoxN, sizeof (*rectLeft));
+  rectRight = calloc (boxlist->BoxN, sizeof (*rectRight));
   for (i = 0; i < boxlist->BoxN; i++)
     {
       assert (boxlist->Box[i].X1 <= boxlist->Box[i].X2);
diff --git a/src/main.c b/src/main.c
index c23ae8b..462285d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -226,7 +226,7 @@ usage_hid (HID * h)
       exporter = NULL;
     }
 
-  note = (UsageNotes *) MyMalloc (sizeof (UsageNotes), "usage_hid");
+  note = malloc (sizeof (UsageNotes));
   note->next = usage_notes;
   note->seen = attributes;
   usage_notes = note;
diff --git a/src/misc.c b/src/misc.c
index 9ab9f53..2e471d0 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -962,13 +962,13 @@ ExpandFilename (char *Dirname, char *Filename)
   DSClearString (&answer);
   if (Dirname)
     {
-      command = MyCalloc (strlen (Filename) + strlen (Dirname) + 7,
-                          sizeof (char), "ExpandFilename()");
+      command = calloc (strlen (Filename) + strlen (Dirname) + 7,
+                        sizeof (char));
       sprintf (command, "echo %s/%s", Dirname, Filename);
     }
   else
     {
-      command = MyCalloc (strlen (Filename) + 6, sizeof (char), "Expand()");
+      command = calloc (strlen (Filename) + 6, sizeof (char));
       sprintf (command, "echo %s", Filename);
     }
 
@@ -984,13 +984,13 @@ ExpandFilename (char *Dirname, char *Filename)
             DSAddCharacter (&answer, c);
         }
 
-      SaveFree (command);
+      free (command);
       return (pclose (pipe) ? NULL : answer.Data);
     }
 
   /* couldn't be expanded by the shell */
   PopenErrorMessage (command);
-  SaveFree (command);
+  free (command);
   return (NULL);
 }
 
@@ -1904,7 +1904,7 @@ AttributePutToList (AttributeListType *list, const char *name, const char *value
 	if (strcmp (name, list->List[i].name) == 0)
 	  {
 	    free (list->List[i].value);
-	    list->List[i].value = MyStrdup (value, "AttributePutToList");
+	    list->List[i].value = STRDUP (value);
 	    return 1;
 	  }
     }
@@ -1920,8 +1920,8 @@ AttributePutToList (AttributeListType *list, const char *name, const char *value
 
   /* Now add the new attribute.  */
   i = list->Number;
-  list->List[i].name = MyStrdup (name, "AttributePutToList");
-  list->List[i].value = MyStrdup (value, "AttributePutToList");
+  list->List[i].name = STRDUP (name);
+  list->List[i].value = STRDUP (value);
   list->Number ++;
   return 0;
 }
diff --git a/src/mymem.c b/src/mymem.c
index 13863c1..09cb6ab 100644
--- a/src/mymem.c
+++ b/src/mymem.c
@@ -69,9 +69,8 @@ GetRubberbandMemory (void)
       Crosshair.AttachedObject.RubberbandMax)
     {
       Crosshair.AttachedObject.RubberbandMax += STEP_RUBBERBAND;
-      ptr = MyRealloc (ptr,
-		       Crosshair.AttachedObject.RubberbandMax *
-		       sizeof (RubberbandType), "GetRubberbandMemory()");
+      ptr = realloc (ptr, Crosshair.AttachedObject.RubberbandMax *
+                          sizeof (RubberbandType));
       Crosshair.AttachedObject.Rubberband = ptr;
       memset (ptr + Crosshair.AttachedObject.RubberbandN, 0,
 	      STEP_RUBBERBAND * sizeof (RubberbandType));
@@ -88,8 +87,7 @@ GetPointerMemory (PointerListTypePtr list)
   if (list->PtrN >= list->PtrMax)
     {
       list->PtrMax = STEP_POINT + (2 * list->PtrMax);
-      ptr = MyRealloc (ptr, list->PtrMax * sizeof (void *),
-		       "GetPointerMemory()");
+      ptr = realloc (ptr, list->PtrMax * sizeof (void *));
       list->Ptr = ptr;
       memset (ptr + list->PtrN, 0,
 	      (list->PtrMax - list->PtrN) * sizeof (void *));
@@ -100,7 +98,7 @@ GetPointerMemory (PointerListTypePtr list)
 void
 FreePointerListMemory (PointerListTypePtr list)
 {
-  MYFREE (list->Ptr);
+  free (list->Ptr);
   memset (list, 0, sizeof (PointerListType));
 }
 
@@ -116,8 +114,7 @@ GetBoxMemory (BoxListTypePtr Boxes)
   if (Boxes->BoxN >= Boxes->BoxMax)
     {
       Boxes->BoxMax = STEP_POINT + (2 * Boxes->BoxMax);
-      box = MyRealloc (box, Boxes->BoxMax * sizeof (BoxType),
-		       "GetBoxMemory()");
+      box = realloc (box, Boxes->BoxMax * sizeof (BoxType));
       Boxes->Box = box;
       memset (box + Boxes->BoxN, 0,
 	      (Boxes->BoxMax - Boxes->BoxN) * sizeof (BoxType));
@@ -138,8 +135,7 @@ GetConnectionMemory (NetTypePtr Net)
   if (Net->ConnectionN >= Net->ConnectionMax)
     {
       Net->ConnectionMax += STEP_POINT;
-      con = MyRealloc (con, Net->ConnectionMax * sizeof (ConnectionType),
-		       "GetConnectionMemory()");
+      con = realloc (con, Net->ConnectionMax * sizeof (ConnectionType));
       Net->Connection = con;
       memset (con + Net->ConnectionN, 0,
 	      STEP_POINT * sizeof (ConnectionType));
@@ -159,8 +155,7 @@ GetNetMemory (NetListTypePtr Netlist)
   if (Netlist->NetN >= Netlist->NetMax)
     {
       Netlist->NetMax += STEP_POINT;
-      net = MyRealloc (net, Netlist->NetMax * sizeof (NetType),
-		       "GetNetMemory()");
+      net = realloc (net, Netlist->NetMax * sizeof (NetType));
       Netlist->Net = net;
       memset (net + Netlist->NetN, 0, STEP_POINT * sizeof (NetType));
     }
@@ -179,9 +174,8 @@ GetNetListMemory (NetListListTypePtr Netlistlist)
   if (Netlistlist->NetListN >= Netlistlist->NetListMax)
     {
       Netlistlist->NetListMax += STEP_POINT;
-      netlist = MyRealloc
-	(netlist, Netlistlist->NetListMax * sizeof (NetListType),
-	 "GetNetListMemory()");
+      netlist = realloc (netlist,
+                         Netlistlist->NetListMax * sizeof (NetListType));
       Netlistlist->NetList = netlist;
       memset (netlist + Netlistlist->NetListN, 0,
 	      STEP_POINT * sizeof (NetListType));
@@ -211,8 +205,7 @@ GetPinMemory (ElementTypePtr Element)
 	  END_LOOP;
 	}
       Element->PinMax += STEP_PIN;
-      pin = MyRealloc (pin, Element->PinMax * sizeof (PinType),
-		       "GetPinMemory()");
+      pin = realloc (pin, Element->PinMax * sizeof (PinType));
       Element->Pin = pin;
       memset (pin + Element->PinN, 0, STEP_PIN * sizeof (PinType));
       if (onBoard)
@@ -249,8 +242,7 @@ GetPadMemory (ElementTypePtr Element)
 	  END_LOOP;
 	}
       Element->PadMax += STEP_PAD;
-      pad = MyRealloc (pad, Element->PadMax * sizeof (PadType),
-		       "GetPadMemory()");
+      pad = realloc (pad, Element->PadMax * sizeof (PadType));
       Element->Pad = pad;
       memset (pad + Element->PadN, 0, STEP_PAD * sizeof (PadType));
       if (onBoard)
@@ -279,8 +271,7 @@ GetViaMemory (DataTypePtr Data)
       Data->ViaMax += STEP_VIA;
       if (Data->via_tree)
 	r_destroy_tree (&Data->via_tree);
-      via = MyRealloc (via, Data->ViaMax * sizeof (PinType),
-		       "GetViaMemory()");
+      via = realloc (via, Data->ViaMax * sizeof (PinType));
       Data->Via = via;
       memset (via + Data->ViaN, 0, STEP_VIA * sizeof (PinType));
       Data->via_tree = r_create_tree (NULL, 0, 0);
@@ -308,8 +299,7 @@ GetRatMemory (DataTypePtr Data)
       /* all of the pointers move, so rebuild the whole tree */
       if (Data->rat_tree)
         r_destroy_tree (&Data->rat_tree);
-      rat = MyRealloc (rat, Data->RatMax * sizeof (RatType),
-		       "GetRatMemory()");
+      rat = realloc (rat, Data->RatMax * sizeof (RatType));
       Data->Rat = rat;
       memset (rat + Data->RatN, 0, STEP_RAT * sizeof (RatType));
       Data->rat_tree = r_create_tree (NULL, 0, 0);
@@ -337,8 +327,7 @@ GetLineMemory (LayerTypePtr Layer)
       /* all of the pointers move, so rebuild the whole tree */
       if (Layer->line_tree)
 	r_destroy_tree (&Layer->line_tree);
-      line = MyRealloc (line, Layer->LineMax * sizeof (LineType),
-			"GetLineMemory()");
+      line = realloc (line, Layer->LineMax * sizeof (LineType));
       Layer->Line = line;
       memset (line + Layer->LineN, 0, STEP_LINE * sizeof (LineType));
       Layer->line_tree = r_create_tree (NULL, 0, 0);
@@ -365,8 +354,7 @@ GetArcMemory (LayerTypePtr Layer)
       Layer->ArcMax += STEP_ARC;
       if (Layer->arc_tree)
 	r_destroy_tree (&Layer->arc_tree);
-      arc = MyRealloc (arc, Layer->ArcMax * sizeof (ArcType),
-		       "GetArcMemory()");
+      arc = realloc (arc, Layer->ArcMax * sizeof (ArcType));
       Layer->Arc = arc;
       memset (arc + Layer->ArcN, 0, STEP_ARC * sizeof (ArcType));
       Layer->arc_tree = r_create_tree (NULL, 0, 0);
@@ -393,8 +381,7 @@ GetTextMemory (LayerTypePtr Layer)
       Layer->TextMax += STEP_TEXT;
       if (Layer->text_tree)
 	r_destroy_tree (&Layer->text_tree);
-      text = MyRealloc (text, Layer->TextMax * sizeof (TextType),
-			"GetTextMemory()");
+      text = realloc (text, Layer->TextMax * sizeof (TextType));
       Layer->Text = text;
       memset (text + Layer->TextN, 0, STEP_TEXT * sizeof (TextType));
       Layer->text_tree = r_create_tree (NULL, 0, 0);
@@ -421,8 +408,7 @@ GetPolygonMemory (LayerTypePtr Layer)
       Layer->PolygonMax += STEP_POLYGON;
       if (Layer->polygon_tree)
 	r_destroy_tree (&Layer->polygon_tree);
-      polygon = MyRealloc (polygon, Layer->PolygonMax * sizeof (PolygonType),
-			   "GetPolygonMemory()");
+      polygon = realloc (polygon, Layer->PolygonMax * sizeof (PolygonType));
       Layer->Polygon = polygon;
       memset (polygon + Layer->PolygonN, 0,
 	      STEP_POLYGON * sizeof (PolygonType));
@@ -449,8 +435,7 @@ GetPointMemoryInPolygon (PolygonTypePtr Polygon)
   if (Polygon->PointN >= Polygon->PointMax)
     {
       Polygon->PointMax += STEP_POLYGONPOINT;
-      points = MyRealloc (points, Polygon->PointMax * sizeof (PointType),
-			  "GetPointMemoryInPolygon()");
+      points = realloc (points, Polygon->PointMax * sizeof (PointType));
       Polygon->Points = points;
       memset (points + Polygon->PointN, 0,
 	      STEP_POLYGONPOINT * sizeof (PointType));
@@ -471,8 +456,7 @@ GetHoleIndexMemoryInPolygon (PolygonTypePtr Polygon)
   if (Polygon->HoleIndexN >= Polygon->HoleIndexMax)
     {
       Polygon->HoleIndexMax += STEP_POLYGONHOLEINDEX;
-      holeindex = MyRealloc (holeindex, Polygon->HoleIndexMax * sizeof (int),
-			     "GetHoleIndexMemoryInPolygon()");
+      holeindex = realloc (holeindex, Polygon->HoleIndexMax * sizeof (int));
       Polygon->HoleIndex = holeindex;
       memset (holeindex + Polygon->HoleIndexN, 0,
 	      STEP_POLYGONHOLEINDEX * sizeof (int));
@@ -495,8 +479,7 @@ GetElementMemory (DataTypePtr Data)
       Data->ElementMax += STEP_ELEMENT;
       if (Data->element_tree)
 	r_destroy_tree (&Data->element_tree);
-      element = MyRealloc (element, Data->ElementMax * sizeof (ElementType),
-			   "GetElementMemory()");
+      element = realloc (element, Data->ElementMax * sizeof (ElementType));
       Data->Element = element;
       memset (element + Data->ElementN, 0,
 	      STEP_ELEMENT * sizeof (ElementType));
@@ -545,8 +528,7 @@ GetLibraryMenuMemory (LibraryTypePtr lib)
   if (lib->MenuN >= lib->MenuMax)
     {
       lib->MenuMax += STEP_LIBRARYMENU;
-      menu = MyRealloc (menu, lib->MenuMax * sizeof (LibraryMenuType),
-			"GetLibraryMenuMemory()");
+      menu = realloc (menu, lib->MenuMax * sizeof (LibraryMenuType));
       lib->Menu = menu;
       memset (menu + lib->MenuN, 0,
 	      STEP_LIBRARYMENU * sizeof (LibraryMenuType));
@@ -566,8 +548,7 @@ GetLibraryEntryMemory (LibraryMenuTypePtr Menu)
   if (Menu->EntryN >= Menu->EntryMax)
     {
       Menu->EntryMax += STEP_LIBRARYENTRY;
-      entry = MyRealloc (entry, Menu->EntryMax * sizeof (LibraryEntryType),
-			 "GetLibraryEntryMemory()");
+      entry = realloc (entry, Menu->EntryMax * sizeof (LibraryEntryType));
       Menu->Entry = entry;
       memset (entry + Menu->EntryN, 0,
 	      STEP_LIBRARYENTRY * sizeof (LibraryEntryType));
@@ -589,9 +570,8 @@ GetDrillElementMemory (DrillTypePtr Drill)
   if (Drill->ElementN >= Drill->ElementMax)
     {
       Drill->ElementMax += STEP_ELEMENT;
-      element =
-	MyRealloc (element, Drill->ElementMax * sizeof (ElementTypeHandle),
-		   "GetDrillElementMemory()");
+      element = realloc (element,
+                         Drill->ElementMax * sizeof (ElementTypeHandle));
       Drill->Element = element;
       memset (element + Drill->ElementN, 0,
 	      STEP_ELEMENT * sizeof (ElementTypeHandle));
@@ -613,8 +593,7 @@ GetDrillPinMemory (DrillTypePtr Drill)
   if (Drill->PinN >= Drill->PinMax)
     {
       Drill->PinMax += STEP_POINT;
-      pin = MyRealloc (pin, Drill->PinMax * sizeof (PinTypeHandle),
-		       "GetDrillPinMemory()");
+      pin = realloc (pin, Drill->PinMax * sizeof (PinTypeHandle));
       Drill->Pin = pin;
       memset (pin + Drill->PinN, 0, STEP_POINT * sizeof (PinTypeHandle));
     }
@@ -633,8 +612,7 @@ GetDrillInfoDrillMemory (DrillInfoTypePtr DrillInfo)
   if (DrillInfo->DrillN >= DrillInfo->DrillMax)
     {
       DrillInfo->DrillMax += STEP_DRILL;
-      drill = MyRealloc (drill, DrillInfo->DrillMax * sizeof (DrillType),
-			 "GetDrillInfoDrillMemory()");
+      drill = realloc (drill, DrillInfo->DrillMax * sizeof (DrillType));
       DrillInfo->Drill = drill;
       memset (drill + DrillInfo->DrillN, 0, STEP_DRILL * sizeof (DrillType));
     }
@@ -642,112 +620,6 @@ GetDrillInfoDrillMemory (DrillInfoTypePtr DrillInfo)
 }
 
 /* ---------------------------------------------------------------------------
- * allocates memory with error handling
- */
-void *
-MyCalloc (size_t Number, size_t Size, const char *Text)
-{
-  void *p;
-
-#ifdef MEM_DEBUG
-  fprintf (stderr, "MyCalloc %d by %d from %s ", Number, Size, Text);
-#endif
-  /* InitComponentLookup() at least can ask for zero here, so return something
-     |  that can be freed.
-   */
-  if (Number == 0)
-    Number = 1;
-  if (Size == 0)
-    Size = 1;
-
-  if ((p = calloc (Number, Size)) == NULL)
-    MyFatal ("out of memory during malloc() in '%s'()\n",
-	     (Text ? Text : "(unknown)"));
-#ifdef MEM_DEBUG
-  fprintf (stderr, "returned 0x%x\n", p);
-#endif
-  return (p);
-}
-
-void *
-MyMalloc (size_t Size, const char *Text)
-{
-  void *p;
-
-#ifdef MEM_DEBUG
-  fprintf (stderr, "MyMalloc %d by %d from %s ", Number, Size, Text);
-#endif
-  /* avoid malloc of 0 bytes */
-  if (Size == 0)
-    Size = 1;
-  if ((p = malloc (Size)) == NULL)
-    MyFatal ("out of memory during malloc() in '%s'()\n",
-	     (Text ? Text : "(unknown)"));
-#ifdef MEM_DEBUG
-  fprintf (stderr, "returned 0x%x\n", p);
-#endif
-  return (p);
-}
-
-/* ---------------------------------------------------------------------------
- * allocates memory with error handling
- * this is a save version because BSD doesn't support the
- * handling of NULL pointers in realloc()
- */
-void *
-MyRealloc (void *Ptr, size_t Size, const char *Text)
-{
-  void *p;
-
-#ifdef MEM_DEBUG
-  fprintf (stderr, "0x%x Realloc to %d from %s ", Ptr, Size, Text);
-#endif
-  if (Size == 0)
-    Size = 1;
-  p = Ptr ? realloc (Ptr, Size) : malloc (Size);
-  if (!p)
-    MyFatal ("out of memory during realloc() in '%s'()\n",
-	     (Text ? Text : "(unknown)"));
-#ifdef MEM_DEBUG
-  fprintf (stderr, "returned 0x%x\n", p);
-#endif
-  return (p);
-}
-
-/* ---------------------------------------------------------------------------
- * allocates memory for a new string, does some error processing
- */
-char *
-MyStrdup (const char *S, const char *Text)
-{
-  char *p = NULL;
-
-  /* bug-fix by Ulrich Pegelow (ulrpeg@xxxxxxxxxxxxxx) */
-  if (S && ((p = strdup (S)) == NULL))
-    MyFatal ("out of memory during g_strdup() in '%s'\n",
-	     (Text ? Text : "(unknown)"));
-#ifdef MEM_DEBUG
-  fprintf (stderr, "g_strdup returning 0x%x\n", p);
-#endif
-  return (p);
-}
-
-/* ---------------------------------------------------------------------------
- * frees memory and sets pointer to NULL
- * too troublesome for modern C compiler,
- * warning: dereferencing type-punned pointer will break strict-aliasing rules
- * Use MYFREE() macro instead
- */
-#if 0
-void
-MyFree (char **Ptr)
-{
-  SaveFree (*Ptr);
-  *Ptr = NULL;
-}
-#endif
-
-/* ---------------------------------------------------------------------------
  * frees memory used by a polygon
  */
 void
@@ -755,8 +627,8 @@ FreePolygonMemory (PolygonTypePtr Polygon)
 {
   if (Polygon)
     {
-      MYFREE (Polygon->Points);
-      MYFREE (Polygon->HoleIndex);
+      free (Polygon->Points);
+      free (Polygon->HoleIndex);
       if (Polygon->Clipped)
 	poly_Free (&Polygon->Clipped);
       poly_FreeContours (&Polygon->NoHoles);
@@ -772,7 +644,7 @@ FreeBoxListMemory (BoxListTypePtr Boxlist)
 {
   if (Boxlist)
     {
-      MYFREE (Boxlist->Box);
+      free (Boxlist->Box);
       memset (Boxlist, 0, sizeof (BoxListType));
     }
 }
@@ -790,7 +662,7 @@ FreeNetListMemory (NetListTypePtr Netlist)
 	FreeNetMemory (net);
       }
       END_LOOP;
-      MYFREE (Netlist->Net);
+      free (Netlist->Net);
       memset (Netlist, 0, sizeof (NetListType));
     }
 }
@@ -808,7 +680,7 @@ FreeNetListListMemory (NetListListTypePtr Netlistlist)
 	FreeNetListMemory (netlist);
       }
       END_LOOP;
-      MYFREE (Netlistlist->NetList);
+      free (Netlistlist->NetList);
       memset (Netlistlist, 0, sizeof (NetListListType));
     }
 }
@@ -821,7 +693,7 @@ FreeNetMemory (NetTypePtr Net)
 {
   if (Net)
     {
-      MYFREE (Net->Connection);
+      free (Net->Connection);
       memset (Net, 0, sizeof (NetType));
     }
 }
@@ -835,10 +707,10 @@ FreeAttributeListMemory (AttributeListTypePtr list)
 
   for (i = 0; i < list->Number; i++)
     {
-      SaveFree (list->List[i].name);
-      SaveFree (list->List[i].value);
+      free (list->List[i].name);
+      free (list->List[i].value);
     }
-  SaveFree (list->List);
+  free (list->List);
   list->List = NULL;
   list->Max = 0;
 }
@@ -853,25 +725,25 @@ FreeElementMemory (ElementTypePtr Element)
     {
       ELEMENTNAME_LOOP (Element);
       {
-	MYFREE (textstring);
+	free (textstring);
       }
       END_LOOP;
       PIN_LOOP (Element);
       {
-	MYFREE (pin->Name);
-	MYFREE (pin->Number);
+	free (pin->Name);
+	free (pin->Number);
       }
       END_LOOP;
       PAD_LOOP (Element);
       {
-	MYFREE (pad->Name);
-	MYFREE (pad->Number);
+	free (pad->Name);
+	free (pad->Number);
       }
       END_LOOP;
-      MYFREE (Element->Pin);
-      MYFREE (Element->Pad);
-      MYFREE (Element->Line);
-      MYFREE (Element->Arc);
+      free (Element->Pin);
+      free (Element->Pad);
+      free (Element->Line);
+      free (Element->Arc);
       FreeAttributeListMemory (&Element->Attributes);
       memset (Element, 0, sizeof (ElementType));
     }
@@ -887,15 +759,15 @@ FreePCBMemory (PCBTypePtr PCBPtr)
 
   if (PCBPtr)
     {
-      MYFREE (PCBPtr->Name);
-      MYFREE (PCBPtr->Filename);
-      MYFREE (PCBPtr->PrintFilename);
+      free (PCBPtr->Name);
+      free (PCBPtr->Filename);
+      free (PCBPtr->PrintFilename);
       if (PCBPtr->Data)
 	FreeDataMemory (PCBPtr->Data);
-      MYFREE (PCBPtr->Data);
+      free (PCBPtr->Data);
       /* release font symbols */
       for (i = 0; i <= MAX_FONTPOSITION; i++)
-	MYFREE (PCBPtr->Font.Symbol[i].Line);
+	free (PCBPtr->Font.Symbol[i].Line);
       FreeLibraryMemory (&PCBPtr->NetlistLib);
       FreeAttributeListMemory (&PCBPtr->Attributes);
       /* clear struct */
@@ -920,43 +792,43 @@ FreeDataMemory (DataTypePtr Data)
     {
       VIA_LOOP (Data);
       {
-	MYFREE (via->Name);
+	free (via->Name);
       }
       END_LOOP;
-      MYFREE (Data->Via);
+      free (Data->Via);
       ELEMENT_LOOP (Data);
       {
 	FreeElementMemory (element);
       }
       END_LOOP;
-      MYFREE (Data->Element);
-      MYFREE (Data->Rat);
+      free (Data->Element);
+      free (Data->Rat);
 
       for (layer = Data->Layer, i = 0; i < MAX_LAYER + 2; layer++, i++)
 	{
 	  FreeAttributeListMemory (&layer->Attributes);
 	  TEXT_LOOP (layer);
 	  {
-	    MYFREE (text->TextString);
+	    free (text->TextString);
 	  }
 	  END_LOOP;
 	  if (layer->Name)
-	    MYFREE (layer->Name);
+	    free (layer->Name);
 	  LINE_LOOP (layer);
 	  {
 	    if (line->Number)
-	      MYFREE (line->Number);
+	      free (line->Number);
 	  }
 	  END_LOOP;
-	  MYFREE (layer->Line);
-	  MYFREE (layer->Arc);
-	  MYFREE (layer->Text);
+	  free (layer->Line);
+	  free (layer->Arc);
+	  free (layer->Text);
 	  POLYGON_LOOP (layer);
 	  {
 	    FreePolygonMemory (polygon);
 	  }
 	  END_LOOP;
-	  MYFREE (layer->Polygon);
+	  free (layer->Polygon);
 	  if (layer->line_tree)
 	    r_destroy_tree (&layer->line_tree);
 	  if (layer->arc_tree)
@@ -999,36 +871,21 @@ FreeLibraryMemory (LibraryTypePtr lib)
   {
     ENTRY_LOOP (menu);
     {
-      SaveFree ((void *) entry->AllocatedMemory);
-      SaveFree ((void *) entry->ListEntry);
+      free (entry->AllocatedMemory);
+      free (entry->ListEntry);
     }
     END_LOOP;
-    SaveFree ((void *) menu->Entry);
-    SaveFree ((void *) menu->Name);
+    free (menu->Entry);
+    free (menu->Name);
   }
   END_LOOP;
-  SaveFree ((void *) lib->Menu);
+  free (lib->Menu);
 
   /* clear struct */
   memset (lib, 0, sizeof (LibraryType));
 }
 
 /* ---------------------------------------------------------------------------
- * a 'save' free routine which first does a quick check if the pointer
- * is zero. The routine isn't implemented as a macro to make additional
- * safety features easier to implement
- */
-void
-SaveFree (void *Ptr)
-{
-#ifdef MEM_DEBUG
-  fprintf (stderr, "Freeing 0x%x\n", Ptr);
-#endif
-  if (Ptr)
-    free (Ptr);
-}
-
-/* ---------------------------------------------------------------------------
  * reallocates memory for a dynamic length string if necessary
  */
 static void
@@ -1038,7 +895,7 @@ DSRealloc (DynamicStringTypePtr Ptr, size_t Length)
   if (input_null || Length >= Ptr->MaxLength)
     {
       Ptr->MaxLength = Length + 512;
-      Ptr->Data = MyRealloc (Ptr->Data, Ptr->MaxLength, "ReallocDS()");
+      Ptr->Data = realloc (Ptr->Data, Ptr->MaxLength);
       if (input_null)
 	Ptr->Data[0] = '\0';
     }
@@ -1106,7 +963,7 @@ StripWhiteSpaceAndDup (char *S)
   /* string is not empty -> allocate memory */
   if (length)
     {
-      p2 = MyRealloc (NULL, length + 1, "StripWhiteSpace()");
+      p2 = realloc (NULL, length + 1);
       strncpy (p2, p1, length);
       *(p2 + length) = '\0';
       return (p2);
diff --git a/src/mymem.h b/src/mymem.h
index fdfd7e6..4e36640 100644
--- a/src/mymem.h
+++ b/src/mymem.h
@@ -64,6 +64,8 @@
 #define	STEP_RUBBERBAND		100
 #define STEP_RAT		2000
 
+#define STRDUP(x) (((x) != NULL) ? strdup (x) : NULL)
+
 /* ---------------------------------------------------------------------------
  * some memory types
  */
@@ -95,12 +97,6 @@ ElementTypeHandle GetDrillElementMemory (DrillTypePtr);
 PinTypeHandle GetDrillPinMemory (DrillTypePtr);
 DrillTypePtr GetDrillInfoDrillMemory (DrillInfoTypePtr);
 void **GetPointerMemory (PointerListTypePtr);
-void *MyCalloc (size_t, size_t, const char *);
-void *MyMalloc (size_t, const char *);
-void *MyRealloc (void *, size_t, const char *);
-char *MyStrdup (const char *s, const char *);
-/* void MyFree (void **); */
-#define MYFREE(x) do { SaveFree(x); (x)=NULL; } while (0)
 void FreePolygonMemory (PolygonTypePtr);
 void FreeElementMemory (ElementTypePtr);
 void FreePCBMemory (PCBTypePtr);
@@ -111,7 +107,6 @@ void FreeNetMemory (NetTypePtr);
 void FreeDataMemory (DataTypePtr);
 void FreeLibraryMemory (LibraryTypePtr);
 void FreePointerListMemory (PointerListTypePtr);
-void SaveFree (void *);
 void DSAddCharacter (DynamicStringTypePtr, char);
 void DSAddString (DynamicStringTypePtr, const char *);
 void DSClearString (DynamicStringTypePtr);
diff --git a/src/netlist.c b/src/netlist.c
index 459b08a..4a26bc9 100644
--- a/src/netlist.c
+++ b/src/netlist.c
@@ -242,10 +242,8 @@ netlist_clear (LibraryMenuType * net, LibraryEntryType * pin)
 static void
 netlist_style (LibraryMenuType *net, const char *style)
 {
-  if (net->Style)
-    MYFREE (net->Style);
-  if (style)
-    net->Style = strdup ((char *)style);
+  free (net->Style);
+  net->Style = STRDUP ((char *)style);
 }
 
 /* The primary purpose of this action is to rebuild a netlist from a
diff --git a/src/parse_l.l b/src/parse_l.l
index c9d96c8..a2808ad 100644
--- a/src/parse_l.l
+++ b/src/parse_l.l
@@ -171,7 +171,7 @@ Attribute	{ return(T_ATTRIBUTE); }
 							 * leading and trailing '"'
 							 */
 						yyleng -= 2;
-						yylval.string = MyCalloc(yyleng+1, sizeof(char), "LEX");
+						yylval.string = calloc (yyleng+1, sizeof (char));
 						p1 = (char *) (yytext +1);
 						p2 = yylval.string;
 						while(yyleng--)
@@ -247,8 +247,7 @@ static int Parse(char *Executable, char *Path, char *Filename, char *Parameter)
 	  {
 	    used_popen = 1;
 	    /* release old command and create new from template */
-	    if (command)
-	      MYFREE (command);
+	    free (command);
 	    command = EvaluateFilename(Executable, Path, Filename, Parameter);
 
 	    /* open pipe to stdout of command */
diff --git a/src/parse_y.y b/src/parse_y.y
index f4fc367..7aa7b80 100644
--- a/src/parse_y.y
+++ b/src/parse_y.y
@@ -733,7 +733,7 @@ via_hi_format
 		: T_VIA '[' NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER STRING flags ']'
 			{
 				CreateNewVia(yyData, $3, $4, $5, $6, $7, $8, $9, $10);
-				SaveFree($9);
+				free ($9);
 			}
 		;
 
@@ -743,7 +743,7 @@ via_2.0_format
 			{
 				CreateNewVia(yyData, $3*100, $4*100, $5*100, $6*100, $7*100, $8*100, $9,
 					OldFlags($10));
-				SaveFree($9);
+				free ($9);
 			}
 		;
 
@@ -754,7 +754,7 @@ via_1.7_format
 			{
 				CreateNewVia(yyData, $3*100, $4*100, $5*100, $6*100,
 					     ($5 + $6)*100, $7*100, $8, OldFlags($9));
-				SaveFree($8);
+				free ($8);
 			}
 		;
 
@@ -764,7 +764,7 @@ via_newformat
 			{
 				CreateNewVia(yyData, $3*100, $4*100, $5*100, 200*GROUNDPLANEFRAME,
 					($5 + 2*MASKFRAME)*100,  $6*100, $7, OldFlags($8));
-				SaveFree($7);
+				free ($7);
 			}
 		;
 
@@ -781,7 +781,7 @@ via_oldformat
 
 				CreateNewVia(yyData, $3*100, $4*100, $5*100, 200*GROUNDPLANEFRAME,
 					($5 + 2*MASKFRAME)*100, hole, $6, OldFlags($7));
-				SaveFree($6);
+				free ($6);
 			}
 		;
 
@@ -1045,7 +1045,7 @@ text_oldformat
 			{
 					/* use a default scale of 100% */
 				CreateNewText(Layer,yyFont,$3*100, $4*100, $5, 100, $6, OldFlags($7));
-				SaveFree($6);
+				free ($6);
 			}
 		;
 
@@ -1064,7 +1064,7 @@ text_newformat
 				else
 					CreateNewText(Layer, yyFont, $3*100, $4*100, $5, $6, $7,
 						      OldFlags($8));
-				SaveFree($7);
+				free ($7);
 			}
 		;
 text_hi_format
@@ -1087,7 +1087,7 @@ text_hi_format
 				}
 				else
 					CreateNewText(Layer, yyFont, $3, $4, $5, $6, $7, $8);
-				SaveFree($7);
+				free ($7);
 			}
 		;
 
@@ -1258,8 +1258,8 @@ element_oldformat
 			{
 				yyElement = CreateNewElement(yyData, yyElement, yyFont, NoFlags(),
 					$3, $4, NULL, $5*100, $6*100, $7, 100, NoFlags(), false);
-				SaveFree($3);
-				SaveFree($4);
+				free ($3);
+				free ($4);
 				pin_num = 1;
 			}
 		  elementdefinitions ')'
@@ -1276,8 +1276,8 @@ element_1.3.4_format
 			{
 				yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3),
 					$4, $5, NULL, $6*100, $7*100, $8, $9, OldFlags($10), false);
-				SaveFree($4);
-				SaveFree($5);
+				free ($4);
+				free ($5);
 				pin_num = 1;
 			}
 		  elementdefinitions ')'
@@ -1294,9 +1294,9 @@ element_newformat
 			{
 				yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3),
 					$4, $5, $6, $7*100, $8*100, $9, $10, OldFlags($11), false);
-				SaveFree($4);
-				SaveFree($5);
-				SaveFree($6);
+				free ($4);
+				free ($5);
+				free ($6);
 				pin_num = 1;
 			}
 		  elementdefinitions ')'
@@ -1316,9 +1316,9 @@ element_1.7_format
 					$4, $5, $6, ($7+$9)*100, ($8+$10)*100, $11, $12, OldFlags($13), false);
 				yyElement->MarkX = $7*100;
 				yyElement->MarkY = $8*100;
-				SaveFree($4);
-				SaveFree($5);
-				SaveFree($6);
+				free ($4);
+				free ($5);
+				free ($6);
 			}
 		  relementdefs ')'
 			{
@@ -1337,9 +1337,9 @@ element_hi_format
 					$4, $5, $6, ($7+$9), ($8+$10), $11, $12, $13, false);
 				yyElement->MarkX = $7;
 				yyElement->MarkY = $8;
-				SaveFree($4);
-				SaveFree($5);
-				SaveFree($6);
+				free ($4);
+				free ($5);
+				free ($6);
 			}
 		  relementdefs ')'
 			{
@@ -1534,8 +1534,8 @@ pin_hi_format
 				CreateNewPin(yyElement, $3 + yyElement->MarkX,
 					$4 + yyElement->MarkY, $5, $6, $7, $8, $9,
 					$10, $11);
-				SaveFree($9);
-				SaveFree($10);
+				free ($9);
+				free ($10);
 			}
 		;
 pin_1.7_format
@@ -1546,8 +1546,8 @@ pin_1.7_format
 				CreateNewPin(yyElement, $3*100 + yyElement->MarkX,
 					$4*100 + yyElement->MarkY, $5*100, $6*100, $7*100, $8*100, $9,
 					$10, OldFlags($11));
-				SaveFree($9);
-				SaveFree($10);
+				free ($9);
+				free ($10);
 			}
 		;
 
@@ -1557,8 +1557,8 @@ pin_1.6.3_format
 			{
 				CreateNewPin(yyElement, $3*100, $4*100, $5*100, 200*GROUNDPLANEFRAME,
 					($5 + 2*MASKFRAME)*100, $6*100, $7, $8, OldFlags($9));
-				SaveFree($7);
-				SaveFree($8);
+				free ($7);
+				free ($8);
 			}
 		;
 
@@ -1572,7 +1572,7 @@ pin_newformat
 				CreateNewPin(yyElement, $3*100, $4*100, $5*100, 200*GROUNDPLANEFRAME,
 					($5 + 2*MASKFRAME)*100, $6*100, $7, p_number, OldFlags($8));
 
-				SaveFree($7);
+				free ($7);
 			}
 		;
 
@@ -1593,7 +1593,7 @@ pin_oldformat
 				sprintf(p_number, "%d", pin_num++);
 				CreateNewPin(yyElement, $3*100, $4*100, $5*100, 200*GROUNDPLANEFRAME,
 					($5 + 2*MASKFRAME)*100, hole, $6, p_number, OldFlags($7));
-				SaveFree($6);
+				free ($6);
 			}
 		;
 
@@ -1641,8 +1641,8 @@ pad_hi_format
 					$5 + yyElement->MarkX,
 					$6 + yyElement->MarkY, $7, $8, $9,
 					$10, $11, $12);
-				SaveFree($10);
-				SaveFree($11);
+				free ($10);
+				free ($11);
 			}
 		;
 
@@ -1654,8 +1654,8 @@ pad_1.7_format
 					$4*100 + yyElement->MarkY, $5*100 + yyElement->MarkX,
 					$6*100 + yyElement->MarkY, $7*100, $8*100, $9*100,
 					$10, $11, OldFlags($12));
-				SaveFree($10);
-				SaveFree($11);
+				free ($10);
+				free ($11);
 			}
 		;
 
@@ -1665,8 +1665,8 @@ pad_newformat
 			{
 				CreateNewPad(yyElement,$3*100,$4*100,$5*100,$6*100,$7*100, 200*GROUNDPLANEFRAME,
 					($7 + 2*MASKFRAME)*100, $8,$9, OldFlags($10));
-				SaveFree($8);
-				SaveFree($9);
+				free ($8);
+				free ($9);
 			}
 		;
 
@@ -1679,7 +1679,7 @@ pad
 				sprintf(p_number, "%d", pin_num++);
 				CreateNewPad(yyElement,$3*100,$4*100,$5*100,$6*100,$7*100, 200*GROUNDPLANEFRAME,
 					($7 + 2*MASKFRAME)*100, $8,p_number, OldFlags($9));
-				SaveFree($8);
+				free ($8);
 			}
 		;
 
@@ -1846,8 +1846,8 @@ net
 		: T_NET '(' STRING STRING ')' '('
 			{
 				Menu = CreateNewNet(&yyPCB->NetlistLib, $3, $4);
-				SaveFree($3);
-				SaveFree($4);
+				free ($3);
+				free ($4);
 			}
 		 connections ')'
 		;
@@ -1881,7 +1881,7 @@ conn
 		: T_CONN '(' STRING ')'
 			{
 				CreateNewConnection(Menu, $3);
-				SaveFree($3);
+				free ($3);
 			}
 		;
 
@@ -1914,8 +1914,8 @@ attribute
 		: T_ATTRIBUTE '(' STRING STRING ')'
 			{
 				CreateNewAttribute (attr_list, $3, $4 ? $4 : "");
-				SaveFree ($3);
-				SaveFree ($4);
+				free ($3);
+				free ($4);
 			}
 		;
 
diff --git a/src/rats.c b/src/rats.c
index 67a0efc..3c5ede1 100644
--- a/src/rats.c
+++ b/src/rats.c
@@ -228,15 +228,14 @@ ProcNetlist (LibraryTypePtr net_menu)
   if (!net_menu->MenuN)
     return (NULL);
   FreeNetListMemory (Wantlist);
-  SaveFree (Wantlist);
-  /*  MYFREE (Wantlist); *//* awkward */
+  free (Wantlist);
   badnet = false;
 
   /* find layer groups of the component side and solder side */
   SLayer = GetLayerGroupNumberByNumber (solder_silk_layer);
   CLayer = GetLayerGroupNumberByNumber (component_silk_layer);
 
-  Wantlist = MyCalloc (1, sizeof (NetListType), "ProcNetlist()");
+  Wantlist = calloc (1, sizeof (NetListType));
   if (Wantlist)
     {
       ALLPIN_LOOP (PCB->Data);
@@ -361,8 +360,7 @@ static bool
 CheckShorts (LibraryMenuTypePtr theNet)
 {
   bool new, warn = false;
-  PointerListTypePtr generic = MyCalloc (1, sizeof (PointerListType),
-					 "CheckShorts");
+  PointerListTypePtr generic = calloc (1, sizeof (PointerListType));
   /* the first connection was starting point so
    * the menu is always non-null
    */
@@ -442,7 +440,7 @@ CheckShorts (LibraryMenuTypePtr theNet)
   }
   ENDALL_LOOP;
   FreePointerListMemory (generic);
-  SaveFree (generic);
+  free (generic);
   return (warn);
 }
 
@@ -695,7 +693,7 @@ AddAllRats (bool SelectedOnly, void (*funcp) ())
   /* initialize finding engine */
   InitConnectionLookup ();
   SaveFindFlag (DRCFLAG);
-  Nets = MyCalloc (1, sizeof (NetListType), "AddAllRats()");
+  Nets = calloc (1, sizeof (NetListType));
   /* now we build another netlist (Nets) for each
    * net in Wantlist that shows how it actually looks now,
    * then fill in any missing connections with rat lines.
@@ -728,7 +726,7 @@ AddAllRats (bool SelectedOnly, void (*funcp) ())
   }
   END_LOOP;
   FreeNetListMemory (Nets);
-  MYFREE (Nets);
+  free (Nets);
   FreeConnectionLookupMemory ();
   RestoreFindFlag ();
   if (funcp)
diff --git a/src/remove.c b/src/remove.c
index 98b9ade..8defaf4 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -120,7 +120,7 @@ RemovePCB (PCBTypePtr Ptr)
 {
   ClearUndoList (true);
   FreePCBMemory (Ptr);
-  SaveFree (Ptr);
+  free (Ptr);
 }
 
 /* ---------------------------------------------------------------------------
@@ -130,7 +130,7 @@ static void *
 DestroyVia (PinTypePtr Via)
 {
   r_delete_entry (DestroyTarget->via_tree, (BoxTypePtr) Via);
-  MYFREE (Via->Name);
+  free (Via->Name);
   if (Via != &DestroyTarget->Via[--DestroyTarget->ViaN])
     {
       *Via = DestroyTarget->Via[DestroyTarget->ViaN];
@@ -149,7 +149,7 @@ static void *
 DestroyLine (LayerTypePtr Layer, LineTypePtr Line)
 {
   r_delete_entry (Layer->line_tree, (BoxTypePtr) Line);
-  MYFREE (Line->Number);
+  free (Line->Number);
   if (Line != &Layer->Line[--Layer->LineN])
     {
       *Line = Layer->Line[Layer->LineN];
@@ -243,7 +243,7 @@ DestroyPolygonPoint (LayerTypePtr Layer,
 static void *
 DestroyText (LayerTypePtr Layer, TextTypePtr Text)
 {
-  MYFREE (Text->TextString);
+  free (Text->TextString);
   r_delete_entry (Layer->text_tree, (BoxTypePtr) Text);
   if (Text != &Layer->Text[--Layer->TextN])
     {
diff --git a/src/report.c b/src/report.c
index dc01153..7af4358 100644
--- a/src/report.c
+++ b/src/report.c
@@ -104,7 +104,7 @@ ReportDrills (int argc, char **argv, int x, int y)
   /* create dialog box */
   gui->report_dialog ("Drill Report", stringlist);
 
-  SaveFree (stringlist);
+  free (stringlist);
   return 0;
 }
 
diff --git a/src/undo.c b/src/undo.c
index 68ea8ff..5226c53 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -223,8 +223,7 @@ GetUndoSlot (int CommandType, int ID, int Kind)
 
       UndoMax += STEP_UNDOLIST;
       size = UndoMax * sizeof (UndoListType);
-      UndoList = (UndoListTypePtr) MyRealloc (UndoList, size,
-					      "AddCommandToUndoList()");
+      UndoList = (UndoListTypePtr) realloc (UndoList, size);
       memset (&UndoList[UndoN], 0, STEP_REMOVELIST * sizeof (UndoListType));
 
       /* ask user to flush the table because of it's size */
@@ -242,7 +241,7 @@ GetUndoSlot (int CommandType, int ID, int Kind)
     switch (ptr->Type)
       {
       case UNDO_CHANGENAME:
-	SaveFree (ptr->Data.ChangeName.Name);
+	free (ptr->Data.ChangeName.Name);
 	break;
       case UNDO_REMOVE:
 	type =
@@ -1211,9 +1210,10 @@ ClearUndoList (bool Force)
       for (undo = UndoList; UndoN; undo++, UndoN--)
 	{
 	  if (undo->Type == UNDO_CHANGENAME)
-	    SaveFree (undo->Data.ChangeName.Name);
+	    free (undo->Data.ChangeName.Name);
 	}
-      MYFREE (UndoList);
+      free (UndoList);
+      UndoList = NULL;
       if (RemoveList)
 	{
           FreeDataMemory (RemoveList);

commit 277f9b937180093f38f2cdc2abc5a57ba22cb610
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Convet some "safe" usage of MyStrdup to plain strdup
    
    These cases are ones where we know the caller will not risk
    passing a NULL string to duplicate.

diff --git a/src/action.c b/src/action.c
index 9e1370b..f5e043a 100644
--- a/src/action.c
+++ b/src/action.c
@@ -5732,7 +5732,7 @@ ActionSaveTo (int argc, char **argv, int x, int y)
   if (strcasecmp (function, "LayoutAs") == 0)
     {
       MYFREE (PCB->Filename);
-      PCB->Filename = MyStrdup (name, __FUNCTION__);
+      PCB->Filename = strdup (name);
       SavePCB (PCB->Filename);
       return 0;
     }
@@ -5930,7 +5930,7 @@ ActionNew (int argc, char **argv, int x, int y)
   if (!PCB->Changed || gui->confirm_dialog (_("OK to clear layout data?"), 0))
     {
       if (name)
-	name = MyStrdup (name, "ActionNew");
+	name = strdup (name);
       else
 	name = gui->prompt_for (_("Enter the layout name:"), "");
 
@@ -7240,7 +7240,7 @@ ActionElementSetAttr (int argc, char **argv, int x, int y)
   if (attr && value)
     {
       MYFREE (attr->value);
-      attr->value = MyStrdup (value, "ElementSetAttr");
+      attr->value = strdup (value);
     }
   if (attr && ! value)
     {
diff --git a/src/buffer.c b/src/buffer.c
index f9d6f5a..c69fc39 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -153,7 +153,7 @@ AddLineToBuffer (LayerTypePtr Layer, LineTypePtr Line)
 			       MaskFlags (Line->Flags,
 					  FOUNDFLAG | ExtraFlag));
   if (line && Line->Number)
-    line->Number = MyStrdup (Line->Number, "AddLineToBuffer");
+    line->Number = strdup (Line->Number);
   return (line);
 }
 
@@ -1164,8 +1164,7 @@ ConvertBufferToElement (BufferTypePtr Buffer)
   LINE_LOOP (&Buffer->Data->SILKLAYER);
   {
     if (line->Number && !NAMEONPCB_NAME (Element))
-      NAMEONPCB_NAME (Element) = MyStrdup (line->Number,
-					   "ConvertBufferToElement");
+      NAMEONPCB_NAME (Element) = strdup (line->Number);
     CreateNewLineInElement (Element, line->Point1.X,
 			    line->Point1.Y, line->Point2.X,
 			    line->Point2.Y, line->Thickness);
diff --git a/src/copy.c b/src/copy.c
index c8244ed..ee831b9 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -220,7 +220,7 @@ CopyLine (LayerTypePtr Layer, LineTypePtr Line)
   if (!line)
     return (line);
   if (Line->Number)
-    line->Number = MyStrdup (Line->Number, "CopyLine");
+    line->Number = strdup (Line->Number);
   DrawLine (Layer, line, 0);
   AddObjectToCreateUndoList (LINE_TYPE, Layer, line, line);
   return (line);
diff --git a/src/create.c b/src/create.c
index 15c0099..735f20f 100644
--- a/src/create.c
+++ b/src/create.c
@@ -193,8 +193,7 @@ CreateNewPCB (bool SetDefaultNames)
   ptr->minRing = Settings.minRing;
 
   for (i = 0; i < MAX_LAYER; i++)
-    ptr->Data->Layer[i].Name = MyStrdup (Settings.DefaultLayerName[i],
-					 "CreateNewPCB()");
+    ptr->Data->Layer[i].Name = strdup (Settings.DefaultLayerName[i]);
 
   return (ptr);
 }
@@ -213,10 +212,8 @@ CreateNewPCBPost (PCBTypePtr pcb, int use_defaults)
       if (ParseGroupString (Settings.Groups, &pcb->LayerGroups, DEF_LAYER))
 	return 1;
 
-      pcb->Data->Layer[component_silk_layer].Name =
-	MyStrdup ("silk", "CreateNewPCB()");
-      pcb->Data->Layer[solder_silk_layer].Name =
-	MyStrdup ("silk", "CreateNewPCB()");
+      pcb->Data->Layer[component_silk_layer].Name = strdup ("silk");
+      pcb->Data->Layer[solder_silk_layer].Name = strdup ("silk");
     }
   return 0;
 }
@@ -901,8 +898,7 @@ AddTextToElement (TextTypePtr Text, FontTypePtr PCBFont,
   Text->Direction = Direction;
   Text->Flags = Flags;
   Text->Scale = Scale;
-  Text->TextString = (TextString && *TextString) ?
-    MyStrdup (TextString, "AddTextToElement()") : NULL;
+  Text->TextString = (TextString && *TextString) ? strdup (TextString) : NULL;
 
   /* calculate size of the bounding box */
   SetTextBoundingBox (PCBFont, Text);
@@ -981,12 +977,12 @@ CreateNewNet (LibraryTypePtr lib, char *name, char *style)
 
   sprintf (temp, "  %s", name);
   menu = GetLibraryMenuMemory (lib);
-  menu->Name = MyStrdup (temp, "CreateNewNet()");
+  menu->Name = strdup (temp);
   menu->flag = 1;		/* net is enabled by default */
   if (style == NULL || NSTRCMP ("(unknown)", style) == 0)
     menu->Style = NULL;
   else
-    menu->Style = MyStrdup (style, "CreateNewNet()");
+    menu->Style = strdup (style);
   return (menu);
 }
 
diff --git a/src/file.c b/src/file.c
index 8cbd95d..5a926f8 100644
--- a/src/file.c
+++ b/src/file.c
@@ -318,7 +318,7 @@ SavePCB (char *Filename)
        * first of all make a copy of the passed filename because
        * it might be identical to 'PCB->Filename'
        */
-      copy = MyStrdup (Filename, "SavePCB()");
+      copy = strdup (Filename);
       SaveFree (PCB->Filename);
       PCB->Filename = copy;
       SetChangedFlag (false);
@@ -390,7 +390,7 @@ LoadPCB (char *Filename)
 
       /* clear 'changed flag' */
       SetChangedFlag (false);
-      PCB->Filename = MyStrdup (Filename, "LoadPCB()");
+      PCB->Filename = strdup (Filename);
       /* just in case a bad file saved file is loaded */
 
       units_mm = (PCB->Grid != (int) PCB->Grid) ? true : false;
@@ -1185,7 +1185,7 @@ LoadNewlibFootprintsFromDir(char *libpath, char *toppath)
   /* Get pointer to memory holding menu */
   menu = GetLibraryMenuMemory (&Library);
   /* Populate menuname and path vars */
-  menu->Name = MyStrdup (pcb_basename(subdir), "Newlib");
+  menu->Name = strdup (pcb_basename(subdir));
   menu->directory = strdup (pcb_basename(toppath));
 
   /* Now loop over files in this directory looking for files.
@@ -1281,7 +1281,7 @@ ParseLibraryTree (void)
   /* Additional loop to allow for multiple 'newlib' style library directories 
    * called out in Settings.LibraryTree
    */
-  libpaths = MyStrdup (Settings.LibraryTree, "ParseLibraryTree");
+  libpaths = strdup (Settings.LibraryTree);
   for (p = strtok (libpaths, PCB_PATH_DELIMETER); p && *p; p = strtok (NULL, PCB_PATH_DELIMETER))
     {
       /* remove trailing path delimeter */
@@ -1422,8 +1422,7 @@ ReadLibraryContents (void)
       if (!strncmp (inputline, "TYPE=", 5))
 	{
 	  menu = GetLibraryMenuMemory (&Library);
-	  menu->Name = MyStrdup (UNKNOWN (&inputline[5]),
-				 "ReadLibraryDescription()");
+	  menu->Name = strdup (UNKNOWN (&inputline[5]));
 	  menu->directory = strdup (Settings.LibraryFilename);
 	}
       else
@@ -1432,13 +1431,11 @@ ReadLibraryContents (void)
 	  if (!menu)
 	    {
 	      menu = GetLibraryMenuMemory (&Library);
-	      menu->Name = MyStrdup (UNKNOWN ((char *) NULL),
-				     "ReadLibraryDescription()");
+	      menu->Name = strdup (UNKNOWN ((char *) NULL));
 	      menu->directory = strdup (Settings.LibraryFilename);
 	    }
 	  entry = GetLibraryEntryMemory (menu);
-	  entry->AllocatedMemory = MyStrdup (inputline,
-					     "ReadLibraryDescription()");
+	  entry->AllocatedMemory = strdup (inputline);
 
 	  /* now break the line into pieces separated by colons */
 	  if ((entry->Template = strtok (entry->AllocatedMemory, ":")) !=
@@ -1565,7 +1562,7 @@ ReadNetlist (char *filename)
 	  if (kind == 0)
 	    {
 	      menu = GetLibraryMenuMemory (&PCB->NetlistLib);
-	      menu->Name = MyStrdup (temp, "ReadNetlist()");
+	      menu->Name = strdup (temp);
 	      menu->flag = 1;
 	      kind++;
 	    }
@@ -1574,12 +1571,12 @@ ReadNetlist (char *filename)
 	      if (kind == 1 && strchr (temp, '-') == NULL)
 		{
 		  kind++;
-		  menu->Style = MyStrdup (temp, "ReadNetlist()");
+		  menu->Style = strdup (temp);
 		}
 	      else
 		{
 		  entry = GetLibraryEntryMemory (menu);
-		  entry->ListEntry = MyStrdup (temp, "ReadNetlist()");
+		  entry->ListEntry = strdup (temp);
 		}
 	    }
 	}
diff --git a/src/fontmode.c b/src/fontmode.c
index bd9fcee..4f7f5b8 100644
--- a/src/fontmode.c
+++ b/src/fontmode.c
@@ -94,10 +94,10 @@ FontEdit (int argc, char **argv, int Ux, int Uy)
   PCB->MaxWidth = CELL_SIZE * 18;
   PCB->MaxHeight = CELL_SIZE * ((MAX_FONTPOSITION + 15) / 16 + 2);
   PCB->Grid = 500.0;
-  PCB->Data->Layer[0].Name = MyStrdup ("Font", "FontEdit");
-  PCB->Data->Layer[1].Name = MyStrdup ("OrigFont", "FontEdit");
-  PCB->Data->Layer[2].Name = MyStrdup ("Width", "FontEdit");
-  PCB->Data->Layer[3].Name = MyStrdup ("Grid", "FontEdit");
+  PCB->Data->Layer[0].Name = strdup ("Font");
+  PCB->Data->Layer[1].Name = strdup ("OrigFont");
+  PCB->Data->Layer[2].Name = strdup ("Width");
+  PCB->Data->Layer[3].Name = strdup ("Grid");
   hid_action ("PCBChanged");
   hid_action ("LayersChanged");
 
diff --git a/src/main.c b/src/main.c
index 923e0ee..c23ae8b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -955,7 +955,7 @@ main (int argc, char *argv[])
     {
       char buf[20];
       sprintf (buf, "signal%d", i + 1);
-      Settings.DefaultLayerName[i] = MyStrdup (buf, "DefaultLayerNames");
+      Settings.DefaultLayerName[i] = strdup (buf);
       Settings.LayerColor[i] = "#c49350";
       Settings.LayerSelectedColor[i] = "#00ffff";
     }
@@ -1016,7 +1016,7 @@ main (int argc, char *argv[])
        * file might not exist
        */
       if (LoadPCB (command_line_pcb))
-	PCB->Filename = MyStrdup (command_line_pcb, "main()");
+	PCB->Filename = strdup (command_line_pcb);
     }
 
   if (Settings.InitialLayerStack
diff --git a/src/misc.c b/src/misc.c
index 34b18cb..9ab9f53 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -723,7 +723,7 @@ ParseRouteString (char *s, RouteStyleTypePtr routeStyle, int scale)
       for (i = 0; *s && *s != ','; i++)
         Name[i] = *s++;
       Name[i] = '\0';
-      routeStyle->Name = MyStrdup (Name, "ParseRouteString()");
+      routeStyle->Name = strdup (Name);
       if (!isdigit ((int) *++s))
         goto error;
       GetNum (&s, &routeStyle->Thick);
@@ -943,7 +943,7 @@ EvaluateFilename (char *Template, char *Path, char *Filename, char *Parameter)
   if (Settings.verbose)
     printf ("EvaluateFilename: \033[32m%s\033[0m\n", command.Data);
 
-  return (MyStrdup (command.Data, "EvaluateFilename()"));
+  return strdup (command.Data);
 }
 
 /* ---------------------------------------------------------------------------
diff --git a/src/move.c b/src/move.c
index cce6e19..cbb2e3d 100644
--- a/src/move.c
+++ b/src/move.c
@@ -970,7 +970,7 @@ MoveLayer (int old_index, int new_index)
       max_copper_layer++;
       memset (lp, 0, sizeof (LayerType));
       lp->On = 1;
-      lp->Name = MyStrdup ("New Layer", "MoveLayer");
+      lp->Name = strdup ("New Layer");
       lp->Color = Settings.LayerColor[new_index];
       lp->SelectedColor = Settings.LayerSelectedColor[new_index];
       for (l = 0; l < max_copper_layer; l++)
diff --git a/src/netlist.c b/src/netlist.c
index ade8326..459b08a 100644
--- a/src/netlist.c
+++ b/src/netlist.c
@@ -245,7 +245,7 @@ netlist_style (LibraryMenuType *net, const char *style)
   if (net->Style)
     MYFREE (net->Style);
   if (style)
-    net->Style = MyStrdup ((char *)style, "Netlist(Style)");
+    net->Style = strdup ((char *)style);
 }
 
 /* The primary purpose of this action is to rebuild a netlist from a
diff --git a/src/rats.c b/src/rats.c
index 46a18c8..67a0efc 100644
--- a/src/rats.c
+++ b/src/rats.c
@@ -912,7 +912,7 @@ AddNet (void)
 	  return (NULL);
 	}
       entry = GetLibraryEntryMemory (menu);
-      entry->ListEntry = MyStrdup (name2, "AddNet");
+      entry->ListEntry = strdup (name2);
       netnode_to_netname (name2);
       goto ratIt;
     }
@@ -921,7 +921,7 @@ AddNet (void)
   if (menu)
     {
       entry = GetLibraryEntryMemory (menu);
-      entry->ListEntry = MyStrdup (name1, "AddNet");
+      entry->ListEntry = strdup (name1);
       netnode_to_netname (name1);
       goto ratIt;
     }
@@ -939,11 +939,11 @@ AddNet (void)
     }
 
   menu = GetLibraryMenuMemory (&PCB->NetlistLib);
-  menu->Name = MyStrdup (ratname, "AddNet");
+  menu->Name = strdup (ratname);
   entry = GetLibraryEntryMemory (menu);
-  entry->ListEntry = MyStrdup (name1, "AddNet");
+  entry->ListEntry = strdup (name1);
   entry = GetLibraryEntryMemory (menu);
-  entry->ListEntry = MyStrdup (name2, "AddNet");
+  entry->ListEntry = strdup (name2);
   menu->flag = 1;
 
 ratIt:




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