[dia] Remove unused facility of named connection points



commit a8193caffd0bfca7b3a324784705a6b5a5e1d2b4
Author: Hans Breuer <hans breuer org>
Date:   Sat Aug 1 15:22:42 2009 +0200

    Remove unused facility of named connection points
    
    They sneaked in around 2004-05-21 but non of the connection points of
    any object got a name since than. So let's spare some memory.

 app/load_save.c            |   16 +---------------
 lib/connectionpoint.h      |    3 +--
 lib/object.c               |    4 ----
 objects/Misc/grid_object.c |    1 -
 4 files changed, 2 insertions(+), 22 deletions(-)
---
diff --git a/app/load_save.c b/app/load_save.c
index 2f37452..f545fe6 100644
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -302,16 +302,6 @@ read_connections(GList *objects, xmlNodePtr layer_node,
 			    handle, to->type->name);
 	    broken = TRUE;
 	  } else {
-	    if (conn == -1) { /* Find named connpoint */
-	      int i;
-	      for (i = 0; i < to->num_connections; i++) {
-		if (to->connections[i]->name != NULL &&
-		    strcmp(to->connections[i]->name, connstr) == 0) {
-		  conn = i;
-		  break;
-		}
-	      }
-	    }
 	    if (conn >= 0 && conn < to->num_connections) {
 	      object_connect(obj, obj->handles[handle],
 			     to->connections[conn]);
@@ -809,11 +799,7 @@ write_connections(GList *objects, xmlNodePtr layer_node,
 
 	  xmlSetProp(connection, (const xmlChar *)"to", (xmlChar *) buffer);
 	  /* to what connection_point on that object */
-	  if (other_obj->connections[con_point_nr]->name != NULL) {
-	    g_snprintf(buffer, 30, "%s", other_obj->connections[con_point_nr]->name);
-	  } else {
-	    g_snprintf(buffer, 30, "%d", con_point_nr);
-	  }
+	  g_snprintf(buffer, 30, "%d", con_point_nr);
 	  xmlSetProp(connection, (const xmlChar *)"connection", (xmlChar *) buffer);
 	}
       }
diff --git a/lib/connectionpoint.h b/lib/connectionpoint.h
index 7f3ba5f..eb4c2a5 100644
--- a/lib/connectionpoint.h
+++ b/lib/connectionpoint.h
@@ -65,8 +65,7 @@ struct _ConnectionPoint {
   Point last_pos;    /*!< Used by update_connections_xxx only. */
   DiaObject *object; /*!< pointer to the object having this point */
   GList *connected;  /*!< list of 'DiaObject *' connected to this point*/
-  gchar directions;  /*!< Directions that this connection point is open to */
-  gchar *name;       /*!< Name of this connpoint, NULL means uses number only.*/
+  guint8 directions; /*!< Directions that this connection point is open to */
   guint8 flags;      /*!< Flags set for this connpoint.  See CP_FLAGS_* above. */
 };
 
diff --git a/lib/object.c b/lib/object.c
index b8a2145..fdf5cc7 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -988,10 +988,6 @@ dia_object_sanity_check(const DiaObject *obj, const gchar *msg) {
 	dia_assert_true((cp->flags & CP_FLAGS_MAIN) == cp->flags,
 			"%s: Object %p CP %d (%p) has illegal flags %d\n",
 			msg, obj, i, cp, cp->flags);
-	dia_assert_true(cp->name == NULL 
-			|| g_utf8_validate(cp->name, -1, NULL),
-			"%s: Object %p CP %d (%p) has non-UTF8 name %s\n",
-			msg, obj, i, cp, cp->name);
 	j = 0;
 	for (connected = cp->connected; connected != NULL;
 	     connected = g_list_next(connected)) {
diff --git a/objects/Misc/grid_object.c b/objects/Misc/grid_object.c
index bf6537a..73f6734 100644
--- a/objects/Misc/grid_object.c
+++ b/objects/Misc/grid_object.c
@@ -417,7 +417,6 @@ connectionpoint_init (ConnectionPoint* cp, DiaObject* obj)
   cp->object = obj;
   cp->connected = NULL;
   cp->directions = DIR_ALL;
-  cp->name = NULL;
   cp->flags = 0;
 }
 



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