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

gEDA-cvs: pcb.git: branch: master updated (149ff2e16560e85e2f060c89020da121eb83f1b6)



The branch, master has been updated
       via  149ff2e16560e85e2f060c89020da121eb83f1b6 (commit)
      from  13f7bcf0494cfa18815667af1c22debef51425a3 (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/file.c    |    1 +
 src/global.h  |    1 +
 src/mymem.c   |   20 ++++++++++++++++++++
 src/parse_y.y |    3 ++-
 4 files changed, 24 insertions(+), 1 deletions(-)


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

commit 149ff2e16560e85e2f060c89020da121eb83f1b6
Author: Ineiev <ineiev@xxxxxxxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    add attributes to layers
    
    Fix memory leaks of attributes

:100644 100644 b6c67b9... db167c8... M	src/file.c
:100644 100644 4cf489a... fa9f55e... M	src/global.h
:100644 100644 c3663d6... 4118cf0... M	src/mymem.c
:100644 100644 dba2603... 646ef77... M	src/parse_y.y

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

commit 149ff2e16560e85e2f060c89020da121eb83f1b6
Author: Ineiev <ineiev@xxxxxxxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    add attributes to layers
    
    Fix memory leaks of attributes

diff --git a/src/file.c b/src/file.c
index b6c67b9..db167c8 100644
--- a/src/file.c
+++ b/src/file.c
@@ -781,6 +781,7 @@ WriteLayerData (FILE * FP, Cardinal Number, LayerTypePtr layer)
       fprintf (FP, "Layer(%i ", (int) Number + 1);
       PrintQuotedString (FP, EMPTY (layer->Name));
       fputs (")\n(\n", FP);
+      WriteAttributeList (FP, &layer->Attributes, "\t");
 
       for (n = 0; n < layer->LineN; n++)
 	{
diff --git a/src/global.h b/src/global.h
index 4cf489a..fa9f55e 100644
--- a/src/global.h
+++ b/src/global.h
@@ -281,6 +281,7 @@ typedef struct			/* holds information about one layer */
   Boolean On;			/* visible flag */
   char *Color,			/* color */
    *SelectedColor;
+  AttributeListType Attributes;
 }
 LayerType, *LayerTypePtr;
 
diff --git a/src/mymem.c b/src/mymem.c
index c3663d6..4118cf0 100644
--- a/src/mymem.c
+++ b/src/mymem.c
@@ -802,6 +802,23 @@ FreeNetMemory (NetTypePtr Net)
       memset (Net, 0, sizeof (NetType));
     }
 }
+/* ---------------------------------------------------------------------------
+ * frees memory used by an attribute list
+ */
+static void
+FreeAttributeListMemory (AttributeListTypePtr list)
+{
+  int i;
+
+  for (i = 0; i < list->Number; i++)
+    {
+      SaveFree (list->List[i].name);
+      SaveFree (list->List[i].value);
+    }
+  SaveFree (list->List);
+  list->List = NULL;
+  list->Max = 0;
+}
 
 /* ---------------------------------------------------------------------------
  * frees memory used by an element
@@ -832,6 +849,7 @@ FreeElementMemory (ElementTypePtr Element)
       MYFREE (Element->Pad);
       MYFREE (Element->Line);
       MYFREE (Element->Arc);
+      FreeAttributeListMemory (&Element->Attributes);
       memset (Element, 0, sizeof (ElementType));
     }
 }
@@ -856,6 +874,7 @@ FreePCBMemory (PCBTypePtr PCBPtr)
       for (i = 0; i <= MAX_FONTPOSITION; i++)
 	MYFREE (PCBPtr->Font.Symbol[i].Line);
       FreeLibraryMemory (&PCBPtr->NetlistLib);
+      FreeAttributeListMemory (&PCBPtr->Attributes);
       /* clear struct */
       memset (PCBPtr, 0, sizeof (PCBType));
     }
@@ -889,6 +908,7 @@ FreeDataMemory (DataTypePtr Data)
 
       for (layer = Data->Layer, i = 0; i < MAX_LAYER + 2; layer++, i++)
 	{
+	  FreeAttributeListMemory (&layer->Attributes);
 	  TEXT_LOOP (layer);
 	  {
 	    MYFREE (text->TextString);
diff --git a/src/parse_y.y b/src/parse_y.y
index dba2603..646ef77 100644
--- a/src/parse_y.y
+++ b/src/parse_y.y
@@ -837,7 +837,7 @@ component-side silk, in that order.
 @item Name
 The layer name.
 @item contents
-The contents of the layer, which may include lines, arcs, rectangles,
+The contents of the layer, which may include attributes, lines, arcs, rectangles,
 text, and polygons.
 @end table
 
@@ -894,6 +894,7 @@ layerdefinition
 		| text_hi_format
 		| text_newformat
 		| text_oldformat
+		| { attr_list = & Layer->Attributes; } attributes
 			/* flags are passed in */
 		| T_POLYGON '(' flags ')' '('
 			{




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