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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-215-gbd149a6)



The branch, master has been updated
       via  bd149a6b4797272b362ecf48a7044f0bfbf0f4bf (commit)
       via  47bc5e1dcd9ed7e47c600567afe1862fa8c2a63d (commit)
       via  7188a0ad5b8ab28a5dd8c60141b5e5b36d1b0690 (commit)
      from  f5205cdb145a423012f446b16d0211005b55695e (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
=========

 libgeda/include/struct.h      |    1 -
 libgeda/src/a_basic.c         |  172 ++++++++++++++++++++---------------------
 libgeda/src/o_attrib.c        |    3 -
 libgeda/src/o_complex_basic.c |    2 +-
 libgeda/src/o_list.c          |    4 -
 libgeda/src/s_basic.c         |    6 +-
 6 files changed, 87 insertions(+), 101 deletions(-)


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

commit bd149a6b4797272b362ecf48a7044f0bfbf0f4bf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 21:57:47 2008 +0100

    Remove un-necessary "attribute" flag of OBJECT structure.
    
    Attributes can be detected just as well by looking at the
    OBJECT->attached_to pointer.

:100644 100644 3636802... 087c3eb... M	libgeda/include/struct.h
:100644 100644 8b418e8... cbc5be5... M	libgeda/src/a_basic.c
:100644 100644 a967339... f2a6ffa... M	libgeda/src/o_attrib.c
:100644 100644 45061cb... 26e4f8b... M	libgeda/src/o_complex_basic.c
:100644 100644 b498b8f... 64b78c0... M	libgeda/src/s_basic.c

commit 47bc5e1dcd9ed7e47c600567afe1862fa8c2a63d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 21:55:47 2008 +0100

    libgeda: o_save_objects(): Don't make un-needed casts of return values
    
    Casting just hides real bugs. The return values, and the type being
    assigned are the same - no need to cast.

:100644 100644 5d50f26... 8b418e8... M	libgeda/src/a_basic.c

commit 7188a0ad5b8ab28a5dd8c60141b5e5b36d1b0690
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 21:30:05 2008 +0100

    When copying text in o_list_copy_to(), there is no need to set visibility.
    
    o_text_copy() copies the visibility of the object being copied, so the code
    following the call to o_text_copy() was a NOP:
    
      if (selected->attribute &&
          selected->visibility == INVISIBLE) {
        new_obj->visibility = INVISIBLE;
      }

:100644 100644 caeaa2f... 4e54b59... M	libgeda/src/o_list.c

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

commit bd149a6b4797272b362ecf48a7044f0bfbf0f4bf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 21:57:47 2008 +0100

    Remove un-necessary "attribute" flag of OBJECT structure.
    
    Attributes can be detected just as well by looking at the
    OBJECT->attached_to pointer.

diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index 3636802..087c3eb 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -291,7 +291,6 @@ struct st_object {
   int pin_type;    /* for pins only, either NET or BUS */
 
   GList *attribs;       /* attribute stuff */
-  int attribute;
   int show_name_value;
   int visibility;
   OBJECT *attached_to;  /* when object is an attribute */
diff --git a/libgeda/src/a_basic.c b/libgeda/src/a_basic.c
index 8b418e8..cbc5be5 100644
--- a/libgeda/src/a_basic.c
+++ b/libgeda/src/a_basic.c
@@ -102,102 +102,100 @@ gchar *o_save_objects (OBJECT *object_list)
 
   while ( o_current != NULL ) {
 
-    if (o_current->type != OBJ_HEAD) {
+    if (o_current->type != OBJ_HEAD &&
+        o_current->attached_to == NULL) {
 
-      if (o_current->attribute == 0) {
+      switch (o_current->type) {
 
-        switch (o_current->type) {
+        case(OBJ_LINE):
+          out = o_line_save(o_current);
+          break;
 
-          case(OBJ_LINE):
-            out = o_line_save(o_current);
-            break;
-	
-          case(OBJ_NET):
-            out = o_net_save(o_current);
-            break;
+        case(OBJ_NET):
+          out = o_net_save(o_current);
+          break;
 
-          case(OBJ_BUS):
-            out = o_bus_save(o_current);
-            break;
-	
-          case(OBJ_BOX):
-            out = o_box_save(o_current);
-            break;
-			
-          case(OBJ_CIRCLE):
-            out = o_circle_save(o_current);
-            break;
-
-          case(OBJ_COMPLEX):
-            out = o_complex_save(o_current);
-            g_string_append_printf(acc, "%s\n", out);
-            already_wrote = TRUE;
-	    g_free(out); /* need to free here because of the above flag */
-
-            if (o_complex_is_embedded(o_current)) {
-              g_string_append(acc, "[\n");
-	      
-              out = o_save_objects(o_current->complex->prim_objs);
-              g_string_append (acc, out);
-              g_free(out);
-
-              g_string_append(acc, "]\n");
-            }
-            break;
-
-          case(OBJ_PLACEHOLDER):  /* new type by SDB 1.20.2005 */
-            out = o_complex_save(o_current);
-            break;
-
-          case(OBJ_TEXT):
-            out = o_text_save(o_current);
-            break;
-
-          case(OBJ_PATH):
-            out = o_path_save(o_current);
-            break;
-
-          case(OBJ_PIN):
-            out = o_pin_save(o_current);
-            break;
-	
-          case(OBJ_ARC):
-            out = o_arc_save(o_current);
-            break;
-
-          case(OBJ_PICTURE):
-            out = o_picture_save(o_current);
-            break;
-
-          default:
-            /*! \todo Maybe we can continue instead of just failing
-             *  completely? In any case, failing gracefully is better
-             *  than killing the program, which is what this used to
-             *  do... */
-            g_critical (_("o_save_objects: object %p has unknown type '%c'\n"),
-                        o_current, o_current->type);
-            /* Dump string built so far */
-            g_string_free (acc, TRUE);
-            return NULL;
-        }
+        case(OBJ_BUS):
+          out = o_bus_save(o_current);
+          break;
+
+        case(OBJ_BOX):
+          out = o_box_save(o_current);
+          break;
+
+        case(OBJ_CIRCLE):
+          out = o_circle_save(o_current);
+          break;
 
-        /* output the line */
-        if (!already_wrote) {
+        case(OBJ_COMPLEX):
+          out = o_complex_save(o_current);
           g_string_append_printf(acc, "%s\n", out);
-	  g_free(out);
-        } else {
-          already_wrote = FALSE;
-        }
+          already_wrote = TRUE;
+          g_free(out); /* need to free here because of the above flag */
+
+          if (o_complex_is_embedded(o_current)) {
+            g_string_append(acc, "[\n");
+
+            out = o_save_objects(o_current->complex->prim_objs);
+            g_string_append (acc, out);
+            g_free(out);
+
+            g_string_append(acc, "]\n");
+          }
+          break;
+
+        case(OBJ_PLACEHOLDER):  /* new type by SDB 1.20.2005 */
+          out = o_complex_save(o_current);
+          break;
+
+        case(OBJ_TEXT):
+          out = o_text_save(o_current);
+          break;
+
+        case(OBJ_PATH):
+          out = o_path_save(o_current);
+          break;
+
+        case(OBJ_PIN):
+          out = o_pin_save(o_current);
+          break;
+
+        case(OBJ_ARC):
+          out = o_arc_save(o_current);
+          break;
+
+        case(OBJ_PICTURE):
+          out = o_picture_save(o_current);
+          break;
+
+        default:
+          /*! \todo Maybe we can continue instead of just failing
+           *  completely? In any case, failing gracefully is better
+           *  than killing the program, which is what this used to
+           *  do... */
+          g_critical (_("o_save_objects: object %p has unknown type '%c'\n"),
+                      o_current, o_current->type);
+          /* Dump string built so far */
+          g_string_free (acc, TRUE);
+          return NULL;
+      }
 
-        /* save any attributes */
-        if (o_current->attribs != NULL) {
-          out = o_save_attribs(o_current->attribs);
-          g_string_append(acc, out);
-          g_free (out);
-        }
+      /* output the line */
+      if (!already_wrote) {
+        g_string_append_printf(acc, "%s\n", out);
+        g_free(out);
+      } else {
+        already_wrote = FALSE;
+      }
 
+      /* save any attributes */
+      if (o_current->attribs != NULL) {
+        out = o_save_attribs(o_current->attribs);
+        g_string_append(acc, out);
+        g_free (out);
       }
-    } 
+
+    }
     o_current = o_current->next;
   }
 
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index a967339..f2a6ffa 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -92,7 +92,6 @@ OBJECT *o_attrib_search(GList *list, OBJECT *item)
  */
 void o_attrib_add(TOPLEVEL *toplevel, OBJECT *object, OBJECT *item)
 {
-  item->attribute = 1; /* Set the attribute to true, hack define */
   /* Show that that item is an attribute */
   item->color = toplevel->attribute_color;
 
@@ -127,7 +126,6 @@ void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current)
     return;
 
   /* \todo this makes me nervous... very nervous */
-  current->attribute = 0;
   current->attached_to=NULL;
   current->color = toplevel->detachedattr_color;
 
@@ -275,7 +273,6 @@ void o_attrib_remove(GList **list, OBJECT *remove)
 {
   g_return_if_fail (remove != NULL);
 
-  remove->attribute = 0;
   remove->attached_to = NULL;
 
   *list = g_list_remove (*list, remove);
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 45061cb..26e4f8b 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -236,7 +236,7 @@ static int o_complex_is_eligible_attribute (TOPLEVEL *toplevel, OBJECT *object)
 
   g_return_val_if_fail(object != NULL, FALSE);
 
-  if (object->type != OBJ_TEXT || object->attribute || object->attached_to)
+  if (object->type != OBJ_TEXT || object->attached_to)
     return FALSE; /* not a text item or is already attached */
 
   /* Make sure text item is an attribute */
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index b498b8f..64b78c0 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -176,7 +176,6 @@ OBJECT *s_basic_init_object(OBJECT *new_node, int type, char const *name)
   new_node->attribs = NULL;
   new_node->attached_to = NULL;
   new_node->copied_to = NULL;
-  new_node->attribute = 0; 
   new_node->show_name_value = SHOW_NAME_VALUE;
   new_node->visibility = VISIBLE;
 
@@ -314,11 +313,8 @@ s_delete_object(TOPLEVEL *toplevel, OBJECT *o_current)
 {
   if (o_current != NULL) {
     s_conn_remove(toplevel, o_current);
-	
-    /* second half of if is odd that we need it? hack */
-    /* need to do this early so we can do the printfs */
-    if (o_current->attached_to != NULL && o_current->attribute == 1) {
 
+    if (o_current->attached_to != NULL) {
       /* do the actual remove */
       o_attrib_remove(&o_current->attached_to->attribs, o_current);
     }

commit 47bc5e1dcd9ed7e47c600567afe1862fa8c2a63d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 21:55:47 2008 +0100

    libgeda: o_save_objects(): Don't make un-needed casts of return values
    
    Casting just hides real bugs. The return values, and the type being
    assigned are the same - no need to cast.

diff --git a/libgeda/src/a_basic.c b/libgeda/src/a_basic.c
index 5d50f26..8b418e8 100644
--- a/libgeda/src/a_basic.c
+++ b/libgeda/src/a_basic.c
@@ -109,27 +109,27 @@ gchar *o_save_objects (OBJECT *object_list)
         switch (o_current->type) {
 
           case(OBJ_LINE):
-            out = (char *) o_line_save(o_current);
+            out = o_line_save(o_current);
             break;
 	
           case(OBJ_NET):
-            out = (char *) o_net_save(o_current);
+            out = o_net_save(o_current);
             break;
 
           case(OBJ_BUS):
-            out = (char *) o_bus_save(o_current);
+            out = o_bus_save(o_current);
             break;
 	
           case(OBJ_BOX):
-            out = (char *) o_box_save(o_current);
+            out = o_box_save(o_current);
             break;
 			
           case(OBJ_CIRCLE):
-            out = (char *) o_circle_save(o_current);
+            out = o_circle_save(o_current);
             break;
 
           case(OBJ_COMPLEX):
-            out = (char *) o_complex_save(o_current);
+            out = o_complex_save(o_current);
             g_string_append_printf(acc, "%s\n", out);
             already_wrote = TRUE;
 	    g_free(out); /* need to free here because of the above flag */
@@ -146,28 +146,28 @@ gchar *o_save_objects (OBJECT *object_list)
             break;
 
           case(OBJ_PLACEHOLDER):  /* new type by SDB 1.20.2005 */
-            out = (char *) o_complex_save(o_current);
+            out = o_complex_save(o_current);
             break;
 
           case(OBJ_TEXT):
-            out = (char *) o_text_save(o_current);
+            out = o_text_save(o_current);
             break;
 
           case(OBJ_PATH):
-            out = (char *) o_path_save(o_current);
+            out = o_path_save(o_current);
             break;
 
           case(OBJ_PIN):
-            out = (char *) o_pin_save(o_current);
+            out = o_pin_save(o_current);
             break;
 	
           case(OBJ_ARC):
-            out = (char *) o_arc_save(o_current);
+            out = o_arc_save(o_current);
             break;
 
-  	  case(OBJ_PICTURE):
-	    out = (char *) o_picture_save(o_current); 
-	    break;
+          case(OBJ_PICTURE):
+            out = o_picture_save(o_current);
+            break;
 
           default:
             /*! \todo Maybe we can continue instead of just failing

commit 7188a0ad5b8ab28a5dd8c60141b5e5b36d1b0690
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 21:30:05 2008 +0100

    When copying text in o_list_copy_to(), there is no need to set visibility.
    
    o_text_copy() copies the visibility of the object being copied, so the code
    following the call to o_text_copy() was a NOP:
    
      if (selected->attribute &&
          selected->visibility == INVISIBLE) {
        new_obj->visibility = INVISIBLE;
      }

diff --git a/libgeda/src/o_list.c b/libgeda/src/o_list.c
index caeaa2f..4e54b59 100644
--- a/libgeda/src/o_list.c
+++ b/libgeda/src/o_list.c
@@ -95,10 +95,6 @@ OBJECT *o_list_copy_to(TOPLEVEL *toplevel, OBJECT *list_head,
 
     case(OBJ_TEXT):
       new_obj = o_text_copy (toplevel, selected);
-      if (selected->attribute && 
-          selected->visibility == INVISIBLE) {
-        new_obj->visibility = INVISIBLE;
-      }
       break;
 
     case(OBJ_PATH):




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