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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-398-g6e8f757)



The branch, master has been updated
       via  6e8f757d3aa23219bb0259064dbed5ffa64fb341 (commit)
      from  5ac7d324af0630fc8ad6f8692bcd80fe3d7b81d1 (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
=========

 gschem/src/o_move.c         |  215 ++++++++++++++++++++-----------------------
 libgeda/include/prototype.h |   13 +--
 libgeda/include/struct.h    |    6 +-
 libgeda/src/s_page.c        |    4 +-
 libgeda/src/s_stretch.c     |  217 ++++++++-----------------------------------
 5 files changed, 144 insertions(+), 311 deletions(-)


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

commit 6e8f757d3aa23219bb0259064dbed5ffa64fb341
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Dec 19 00:59:52 2008 +0000

    Remove next/prev linking from the STRETCH structure. Use GLists instead.
    
    The PAGE now maintains a GList of STRETCH objects instead. This keeps the
    code a lot simpler and allows us to use more standard GList functions.

:100644 100644 90b976c... 1782b7c... M	gschem/src/o_move.c
:100644 100644 c2dcba9... f6d4249... M	libgeda/include/prototype.h
:100644 100644 c9a5d85... 5683897... M	libgeda/include/struct.h
:100644 100644 e889d27... 98cedf1... M	libgeda/src/s_page.c
:100644 100644 0b75b1d... b70ed27... M	libgeda/src/s_stretch.c

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

commit 6e8f757d3aa23219bb0259064dbed5ffa64fb341
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Dec 19 00:59:52 2008 +0000

    Remove next/prev linking from the STRETCH structure. Use GLists instead.
    
    The PAGE now maintains a GList of STRETCH objects instead. This keeps the
    code a lot simpler and allows us to use more standard GList functions.

diff --git a/gschem/src/o_move.c b/gschem/src/o_move.c
index 90b976c..1782b7c 100644
--- a/gschem/src/o_move.c
+++ b/gschem/src/o_move.c
@@ -35,7 +35,7 @@
 void o_move_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  STRETCH *st_current;
+  GList *s_iter;
 
   if (o_select_selected (w_current)) {
 
@@ -56,10 +56,10 @@ void o_move_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
       /* Set the dont_redraw flag on rubberbanded objects.
        * This ensures that they are not drawn (in their
        * un-stretched position) during screen updates. */
-      st_current = toplevel->page_current->stretch_head->next;
-      while (st_current != NULL) {
-        st_current->object->dont_redraw = TRUE;
-        st_current = st_current->next;
+      for (s_iter = toplevel->page_current->stretch_list;
+           s_iter != NULL; s_iter = g_list_next (s_iter)) {
+        STRETCH *stretch = s_iter->data;
+        stretch->object->dont_redraw = TRUE;
       }
     }
 
@@ -136,11 +136,11 @@ void o_move_end_lowlevel (GSCHEM_TOPLEVEL *w_current,
 void o_move_end(GSCHEM_TOPLEVEL *w_current)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  STRETCH *st_current;
   GList *s_current = NULL;
   OBJECT *object;
   int diff_x, diff_y;
   int left, top, right, bottom;
+  GList *s_iter;
   GList *other_objects = NULL;
   GList *connected_objects = NULL;
   GList *rubbernet_objects = NULL; 
@@ -170,10 +170,10 @@ void o_move_end(GSCHEM_TOPLEVEL *w_current)
 
   /* Unset the dont_redraw flag on rubberbanded objects.
    * We set this above, in o_move_start(). */
-  st_current = toplevel->page_current->stretch_head->next;
-  while (st_current != NULL) {
-    st_current->object->dont_redraw = FALSE;
-    st_current = st_current->next;
+  for (s_iter = toplevel->page_current->stretch_list;
+       s_iter != NULL; s_iter = g_list_next (s_iter)) {
+    STRETCH *stretch = s_iter->data;
+    stretch->object->dont_redraw = FALSE;
   }
 
   s_current = geda_list_get_glist( toplevel->page_current->selection_list );
@@ -262,8 +262,8 @@ void o_move_end(GSCHEM_TOPLEVEL *w_current)
   g_list_free(toplevel->page_current->place_list);
   toplevel->page_current->place_list = NULL;
 
-  s_stretch_remove_most(toplevel, toplevel->page_current->stretch_head);
-  toplevel->page_current->stretch_tail = toplevel->page_current->stretch_head;
+  s_stretch_destroy_all (toplevel->page_current->stretch_list);
+  toplevel->page_current->stretch_list = NULL;
 }
 
 
@@ -275,21 +275,21 @@ void o_move_end(GSCHEM_TOPLEVEL *w_current)
 void o_move_cancel (GSCHEM_TOPLEVEL *w_current)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  STRETCH *st_current;
+  GList *s_iter;
 
   /* Unset the dont_redraw flag on rubberbanded objects.
    * We set this above, in o_move_start(). */
-  st_current = toplevel->page_current->stretch_head->next;
-  while (st_current != NULL) {
-    st_current->object->dont_redraw = FALSE;
-    st_current = st_current->next;
+  for (s_iter = toplevel->page_current->stretch_list;
+       s_iter != NULL; s_iter = g_list_next (s_iter)) {
+    STRETCH *stretch = s_iter->data;
+    stretch->object->dont_redraw = FALSE;
   }
   g_list_free(w_current->toplevel->page_current->place_list);
   w_current->toplevel->page_current->place_list = NULL;
   o_undo_callback(w_current, UNDO_ACTION);
 
-  s_stretch_remove_most(toplevel, toplevel->page_current->stretch_head);
-  toplevel->page_current->stretch_tail = toplevel->page_current->stretch_head;
+  s_stretch_destroy_all (toplevel->page_current->stretch_list);
+  toplevel->page_current->stretch_list = NULL;
 }
 
 
@@ -401,10 +401,10 @@ void o_move_check_endpoint(GSCHEM_TOPLEVEL *w_current, OBJECT * object)
 #endif
 
     if (whichone >= 0 && whichone <= 1) {
-      toplevel->page_current->stretch_tail =
-        s_stretch_add(toplevel->page_current->stretch_head,
-                      c_current->other_object,
-                      c_current, whichone);
+      toplevel->page_current->stretch_list =
+        s_stretch_add (toplevel->page_current->stretch_list,
+                       c_current->other_object,
+                       c_current, whichone);
 
       o_erase_single(w_current, c_current->other_object);
     }
@@ -427,7 +427,7 @@ void o_move_prep_rubberband(GSCHEM_TOPLEVEL *w_current)
 
 #if DEBUG
   printf("\n\n\n");
-  s_stretch_print_all(toplevel->page_current->stretch_head);
+  s_stretch_print_all (toplevel->page_current->stretch_list);
   printf("\n\n\n");
 #endif
 
@@ -464,7 +464,7 @@ void o_move_prep_rubberband(GSCHEM_TOPLEVEL *w_current)
 
 #if DEBUG
   printf("\n\n\n\nfinished building scretch list:\n");
-  s_stretch_print_all(toplevel->page_current->stretch_head);
+  s_stretch_print_all (toplevel->page_current->stretch_list);
 #endif
 }
 
@@ -500,106 +500,98 @@ void o_move_end_rubberband(GSCHEM_TOPLEVEL *w_current, int world_diff_x,
 			   GList** other_objects, GList** connected_objects)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  STRETCH *s_current;
-  OBJECT *object;
+  GList *s_iter;
   int x, y;
-  int whichone;
 
-  /* skip over head */
-  s_current = toplevel->page_current->stretch_head->next;
+  for (s_iter = toplevel->page_current->stretch_list;
+       s_iter != NULL; s_iter = g_list_next (s_iter)) {
+    STRETCH *s_current = s_iter->data;
+    OBJECT *object = s_current->object;
+    int whichone = s_current->whichone;
 
-  while (s_current != NULL) {
-    
-    object = s_current->object;
-    if (object) {
-      whichone = s_current->whichone;
+    switch (object->type) {
 
-      switch (object->type) {
-        
-        case (OBJ_NET):
-          
-          /* save the other objects and remove object's connections */
-          *other_objects =
-            s_conn_return_others(*other_objects, object);
-          s_conn_remove_object (toplevel, object);
+      case (OBJ_NET):
 
-          x = object->line->x[whichone];
-          y = object->line->y[whichone];
+        /* save the other objects and remove object's connections */
+        *other_objects =
+          s_conn_return_others(*other_objects, object);
+        s_conn_remove_object (toplevel, object);
+
+        x = object->line->x[whichone];
+        y = object->line->y[whichone];
 
 #if DEBUG
-          printf("OLD: %d, %d\n", x, y);
-          printf("diff: %d, %d\n", world_diff_x, world_diff_y);
+        printf("OLD: %d, %d\n", x, y);
+        printf("diff: %d, %d\n", world_diff_x, world_diff_y);
 #endif
 
-          x = x + world_diff_x;
-          y = y + world_diff_y;
+        x = x + world_diff_x;
+        y = y + world_diff_y;
 
 #if DEBUG
-          printf("NEW: %d, %d\n", x, y);
+        printf("NEW: %d, %d\n", x, y);
 #endif
 
-          object->line->x[whichone] = x;
-          object->line->y[whichone] = y;
+        object->line->x[whichone] = x;
+        object->line->y[whichone] = y;
 
 
-          if (o_move_zero_length(object)) {
-            o_delete(w_current, object);
-          } else {
-            o_recalc_single_object(toplevel, object);
-            s_tile_update_object(toplevel, object);
-            s_conn_update_object (toplevel, object);
-            *connected_objects =
-              s_conn_return_others(*connected_objects, object);
-            *objects = g_list_append(*objects, object);
-          }
+        if (o_move_zero_length(object)) {
+          o_delete(w_current, object);
+        } else {
+          o_recalc_single_object(toplevel, object);
+          s_tile_update_object(toplevel, object);
+          s_conn_update_object (toplevel, object);
+          *connected_objects =
+            s_conn_return_others(*connected_objects, object);
+          *objects = g_list_append(*objects, object);
+        }
 
-          break;
+        break;
 
-        case (OBJ_PIN):
+      case (OBJ_PIN):
 
-          /* not valid to do with pins */
+        /* not valid to do with pins */
 
-          break;
+        break;
 
-        case (OBJ_BUS):
+      case (OBJ_BUS):
 
-          /* save the other objects and remove object's connections */
-          *other_objects =
-            s_conn_return_others(*other_objects, object);
-          s_conn_remove_object (toplevel, object);
+        /* save the other objects and remove object's connections */
+        *other_objects =
+          s_conn_return_others(*other_objects, object);
+        s_conn_remove_object (toplevel, object);
 
-          x = object->line->x[whichone];
-          y = object->line->y[whichone];
+        x = object->line->x[whichone];
+        y = object->line->y[whichone];
 
 #if DEBUG
-          printf("OLD: %d, %d\n", x, y);
-          printf("diff: %d, %d\n", world_diff_x, world_diff_y);
+        printf("OLD: %d, %d\n", x, y);
+        printf("diff: %d, %d\n", world_diff_x, world_diff_y);
 #endif
-          x = x + world_diff_x;
-          y = y + world_diff_y;
+        x = x + world_diff_x;
+        y = y + world_diff_y;
 
 #if DEBUG
-          printf("NEW: %d, %d\n", x, y);
+        printf("NEW: %d, %d\n", x, y);
 #endif
-          object->line->x[whichone] = x;
-          object->line->y[whichone] = y;
-
-          if (o_move_zero_length(object)) {
-            o_delete(w_current, object);
-          } else {
-            o_recalc_single_object(toplevel, object);
-            s_tile_update_object(toplevel, object);
-            s_conn_update_object (toplevel, object);
-            *connected_objects =
-              s_conn_return_others(*connected_objects, object);
-            *objects = g_list_append(*objects, object);
-          }
+        object->line->x[whichone] = x;
+        object->line->y[whichone] = y;
+
+        if (o_move_zero_length(object)) {
+          o_delete(w_current, object);
+        } else {
+          o_recalc_single_object(toplevel, object);
+          s_tile_update_object(toplevel, object);
+          s_conn_update_object (toplevel, object);
+          *connected_objects =
+            s_conn_return_others(*connected_objects, object);
+          *objects = g_list_append(*objects, object);
+        }
 
-          break;
-      }
+        break;
     }
-    
-    s_current = s_current->next;
   }
 
 #if DEBUG
@@ -619,33 +611,26 @@ void o_move_end_rubberband(GSCHEM_TOPLEVEL *w_current, int world_diff_x,
 void o_move_stretch_rubberband(GSCHEM_TOPLEVEL *w_current)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  STRETCH *s_current;
-  OBJECT *object;
+  GList *s_iter;
   int diff_x, diff_y;
-  int whichone;
 
   diff_x = w_current->second_wx - w_current->first_wx;
   diff_y = w_current->second_wy - w_current->first_wy;
 
-  /* skip over head */
-  s_current = toplevel->page_current->stretch_head->next;
-  while (s_current != NULL) {
+  for (s_iter = toplevel->page_current->stretch_list;
+       s_iter != NULL; s_iter = g_list_next (s_iter)) {
+    STRETCH *s_current = s_iter->data;
+    OBJECT *object = s_current->object;
+    int whichone = s_current->whichone;
 
-    object = s_current->object;
-    if (object) {
-      whichone = s_current->whichone;
-      switch (object->type) {
-        case (OBJ_NET):
-          o_net_draw_xor_single(w_current,
-                                diff_x, diff_y, whichone, object);
-          break;
+    switch (object->type) {
+      case (OBJ_NET):
+        o_net_draw_xor_single(w_current, diff_x, diff_y, whichone, object);
+        break;
 
-        case (OBJ_BUS):
-          o_bus_draw_xor_single(w_current,
-                                diff_x, diff_y, whichone, object);
-          break;
-      }
+      case (OBJ_BUS):
+        o_bus_draw_xor_single(w_current, diff_x, diff_y, whichone, object);
+        break;
     }
-    s_current = s_current->next;
   }
 }
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index c2dcba9..f6d4249 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -448,15 +448,10 @@ int s_slib_uniq(char *path);
 void s_slib_print_dirs(void);
 
 /* s_stretch.c */
-STRETCH *s_stretch_return_tail(STRETCH *head);
-STRETCH *s_stretch_return_head(STRETCH *tail);
-STRETCH *s_stretch_new_head(void);
-void s_stretch_destroy_head(STRETCH *s_head);
-STRETCH *s_stretch_add(STRETCH *head, OBJECT *object, CONN *connection, int whichone);
-void s_stretch_remove(STRETCH *head, OBJECT *object);
-void s_stretch_remove_most(TOPLEVEL *toplevel, STRETCH *head);
-void s_stretch_print_all(STRETCH *head);
-void s_stretch_destroy_all(STRETCH *head);
+GList *s_stretch_add(GList *list, OBJECT *object, CONN *connection, int whichone);
+GList *s_stretch_remove(GList *list, OBJECT *object);
+void s_stretch_print_all(GList *list);
+void s_stretch_destroy_all(GList *list);
 
 /* s_tile.c */
 void s_tile_init(TOPLEVEL *toplevel, PAGE *p_current);
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index c9a5d85..5683897 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -341,9 +341,6 @@ struct st_stretch
   CONN *connection;
 
   int whichone;
-
-  STRETCH *prev;
-  STRETCH *next;
 };
 
 struct st_bounds {
@@ -405,8 +402,7 @@ struct st_page {
   SELECTION *selection_list; /* new selection mechanism */
   GList *place_list;
   OBJECT *object_lastplace; /* the last found item */
-  STRETCH *stretch_head; 
-  STRETCH *stretch_tail; 
+  GList *stretch_list;
 
   char *page_filename; 
   int CHANGED;			/* changed flag */
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index e889d27..98cedf1 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -103,7 +103,7 @@ PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
   page->selection_list = o_selection_new();
 
   /* net/pin/bus stretch when doing moves */
-  page->stretch_head = page->stretch_tail = s_stretch_new_head();
+  page->stretch_list = NULL;
 
   page->place_list = NULL;
 
@@ -201,7 +201,7 @@ void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
 #endif
   s_tile_free_all (page);
 
-  s_stretch_destroy_all (page->stretch_head);
+  s_stretch_destroy_all (page->stretch_list);
 
   /* free current page undo structs */
   s_undo_free_all (toplevel, page); 
diff --git a/libgeda/src/s_stretch.c b/libgeda/src/s_stretch.c
index 0b75b1d..b70ed27 100644
--- a/libgeda/src/s_stretch.c
+++ b/libgeda/src/s_stretch.c
@@ -31,227 +31,97 @@
 #include <dmalloc.h>
 #endif
 
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-STRETCH *s_stretch_return_tail(STRETCH *head)
-{
-  STRETCH *s_current=NULL;
-  STRETCH *ret_struct=NULL;
-
-  s_current = head;
-  while ( s_current != NULL ) { /* goto end of list */
-    ret_struct = s_current;
-    s_current = s_current->next;
-  }
-
-  return(ret_struct);
-}
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-STRETCH *s_stretch_return_head(STRETCH *tail)
-{
-  STRETCH *s_current=NULL;
-  STRETCH *ret_struct=NULL;
-
-  s_current = tail;
-  while ( s_current != NULL ) { /* goto end of list */
-    ret_struct = s_current;
-    s_current = s_current->prev;
-  }
-
-  return(ret_struct);
-}
 
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
  *
  */
-STRETCH *s_stretch_new_head(void)
+GList *s_stretch_add (GList *list, OBJECT *object,
+                      CONN *connection, int whichone)
 {
+  GList *s_iter;
   STRETCH *s_new;
 
-  s_new = (STRETCH *) g_malloc(sizeof(STRETCH));
-
-  s_new->object = NULL;
-  s_new->connection = NULL;
-  s_new->whichone = -1;
-
-  s_new->prev = NULL;
-  s_new->next = NULL;
-
-  return(s_new);
-}
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-void s_stretch_destroy_head(STRETCH *s_head)
-{
-  g_free(s_head);
-}
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-/*! \todo also does the needed work to make the object visually selected */
-STRETCH *s_stretch_add(STRETCH *head, OBJECT *object,
-		       CONN *connection, int whichone)
-{
-  STRETCH *tail;
-  STRETCH *s_new;
-  STRETCH *s_current;
-	
-  s_current = head;
-  while (s_current != NULL) {
-    if (s_current->object) {
-      /*printf("%d %d\n", s_current->object->sid, object->sid);*/
-      if (s_current->object->sid == object->sid) {
-				/* printf("already inside\n");*/
-        return(s_stretch_return_tail(head));
-      }
+  /* Check if the object is already in the stretch list */
+  for (s_iter = list; s_iter != NULL; s_iter = g_list_next (s_iter)) {
+    STRETCH *s_current = s_iter->data;
+    if (s_current->object->sid == object->sid) {
+      return list;
     }
-		
-    s_current = s_current->next;
   }
-  /*printf("Adding: %s\n", object->name);*/
 
-  s_new = (STRETCH *) g_malloc(sizeof(STRETCH));
+  s_new = g_malloc (sizeof (STRETCH));
   s_new->object = object;
   s_new->connection = connection;
   s_new->whichone = whichone;
 
-  if (head == NULL) {
-    s_new->prev = NULL; /* setup previous link */
-    s_new->next = NULL;
-    return(s_new);
-  } else {
-    tail = s_stretch_return_tail(head);
-    s_new->prev = tail; /* setup previous link */
-    s_new->next = NULL;
-    tail->next = s_new;
-    return(tail->next);
-  }
+  return g_list_append (list, s_new);
 }
 
-/*! \todo Finish function documentation!!!
+
+/*! \brief Test if a STRETCH structure points at a given OBJECT
+ *
  *  \brief
  *  \par Function Description
+ *  Compares if (STRETCH *)a->object == (OBJECT *)b
  *
+ * \param [in] a  The STRETCH structure
+ * \param [in] b  The OBJECT to test for
+ * \returns 0 if STRETCH *a points to OBJECT *b, otherwise 1.
  */
-/*! \note
- *  it's okay to call this with an o_selected which is not necessarily
- *  selected
- */
-void s_stretch_remove(STRETCH *head, OBJECT *object)
+static gint find_object (gconstpointer a, gconstpointer b)
 {
-  STRETCH *s_current;
-
-  if (object == NULL) {
-    fprintf(stderr, "Got NULL for s_stretch in s_stretch_remove\n");
-    return;
-  }
-
-  s_current = head;	
-
-  while (s_current != NULL) {
-    if (s_current->object == object) {
-      if (s_current->next)
-        s_current->next->prev = s_current->prev;
-      else
-        s_current->next = NULL;
-
-      if (s_current->prev)
-        s_current->prev->next = s_current->next;
-      else
-        s_current->prev = NULL;
-
-      s_current->object = NULL;
-      s_current->connection = NULL;
-      s_current->whichone = -1;
-
-      g_free(s_current);
-      return;
-    }
-    s_current = s_current->next;
-  }
+  return (((STRETCH *)a)->object == (OBJECT *)b) ? 0 : 1;
 }
 
+
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
  *
  */
-/*! \note removes all but the head node */
-void s_stretch_remove_most(TOPLEVEL *toplevel, STRETCH *head)
+GList *s_stretch_remove (GList *list, OBJECT *object)
 {
-  STRETCH *s_current;
-  STRETCH *s_prev;
+  GList *item;
 
-  s_current = s_stretch_return_tail(head);
+  g_return_val_if_fail (object != NULL, list);
 
-  while (s_current != NULL) {
-    if (s_current->object != NULL) {
-      s_prev = s_current->prev;	
+  item = g_list_find_custom (list, object, find_object);
+  g_free (item->data);
 
-      s_current->object = NULL;
-      s_current->connection = NULL;
-      s_current->whichone = -1;
-	
-      g_free(s_current);
-      s_current = s_prev;
-    } else {
-      break;
-    }
-  }
-
-  /* clear out any dangling pointers */
-  head->next=NULL;
+  return g_list_delete_link (list, item);
 }
 
+
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
  *
  */
-void s_stretch_print_all( STRETCH *head )
+void s_stretch_print_all (GList *list)
 {
-  STRETCH *s_current;
-
-  s_current = head;
+  GList *iter;
 
   printf("START printing stretch ********************\n");
-  while(s_current != NULL) {
+  for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+    STRETCH *s_current = iter->data;
+
     if (s_current->object) {
       printf("Object: %s\n", s_current->object->name);
     } else {
       printf("Object is NULL\n");
     }
 
-    if (s_current->object) {
+    if (s_current->connection) {
       printf("Connection type: %d\n", s_current->connection->type);
     } else {
       printf("Connection is NULL\n");
     }
 
     printf("which one: %d\n", s_current->whichone);
-
-    s_current = s_current->next;
   }
-  printf("DONE printing stretch ********************\n");
-  printf("\n");
-
+  printf("DONE printing stretch ********************\n\n");
 }
 
 /*! \todo Finish function documentation!!!
@@ -259,21 +129,8 @@ void s_stretch_print_all( STRETCH *head )
  *  \par Function Description
  *
  */
-void s_stretch_destroy_all(STRETCH *head) 
+void s_stretch_destroy_all (GList *list)
 {
-  STRETCH *s_current;
-  STRETCH *s_prev;
-
-  s_current = s_stretch_return_tail(head);
-
-  while (s_current != NULL) {
-    s_prev = s_current->prev;	
-
-    s_current->object = NULL;
-    s_current->connection = NULL;
-    s_current->whichone = -1;
-
-    g_free(s_current);
-    s_current = s_prev;
-  }
+  g_list_foreach (list, (GFunc)g_free, NULL);
+  g_list_free (list);
 }




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