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

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



The branch, master has been updated
       via  ef685c5ef4914b6c84cefd12c165e9234070cf4c (commit)
      from  977ca3709a6eed4413a4cf3e98323cedd0feb02c (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/buffer.c   |   48 +++++++++++++------
 src/create.c   |    4 ++
 src/polygon1.c |    2 +-
 src/rats.c     |    1 +
 src/remove.c   |  142 +++++++++++++++++++++++++++++++-------------------------
 src/search.c   |   16 +++++--
 6 files changed, 131 insertions(+), 82 deletions(-)


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

commit ef685c5ef4914b6c84cefd12c165e9234070cf4c
Author: harry <harry@harry-laptop.(none)>
Commit: harry <harry@harry-laptop.(none)>

    Fix several errors, some more point-boxes that weren't half open
    and several found with valgrind.
    valgrind is your friend!

:100644 100644 8acbfce... e498f26... M	src/buffer.c
:100644 100644 fa0a394... fc6b863... M	src/create.c
:100644 100644 c9a350f... fdb816d... M	src/polygon1.c
:100644 100644 6e8d369... 35047b5... M	src/rats.c
:100644 100644 de88abe... a82b478... M	src/remove.c
:100644 100644 6e3f4c5... 07015f0... M	src/search.c

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

commit ef685c5ef4914b6c84cefd12c165e9234070cf4c
Author: harry <harry@harry-laptop.(none)>
Commit: harry <harry@harry-laptop.(none)>

    Fix several errors, some more point-boxes that weren't half open
    and several found with valgrind.
    valgrind is your friend!

diff --git a/src/buffer.c b/src/buffer.c
index 8acbfce..e498f26 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -218,12 +218,12 @@ AddElementToBuffer (ElementTypePtr Element)
       END_LOOP;
       PIN_LOOP (element);
       {
-	CLEAR_FLAG (ExtraFlag, pin);
+	CLEAR_FLAG (FOUNDFLAG | ExtraFlag, pin);
       }
       END_LOOP;
       PAD_LOOP (element);
       {
-	CLEAR_FLAG (ExtraFlag, pad);
+	CLEAR_FLAG (FOUNDFLAG | ExtraFlag, pad);
       }
       END_LOOP;
     }
@@ -242,10 +242,13 @@ MoveViaToBuffer (PinTypePtr Via)
   r_delete_entry (Source->via_tree, (BoxType *) Via);
   via = GetViaMemory (Dest);
   *via = *Via;
-  *Via = Source->Via[--Source->ViaN];
+  CLEAR_FLAG (WARNFLAG | FOUNDFLAG, via);
+  if (Via != &Source->Via[--Source->ViaN])
+  {
+  *Via = Source->Via[Source->ViaN];
   r_substitute (Source->via_tree, (BoxType *) & Source->Via[Source->ViaN],
 		(BoxType *) Via);
-  CLEAR_FLAG (WARNFLAG | FOUNDFLAG, via);
+  }
   memset (&Source->Via[Source->ViaN], 0, sizeof (PinType));
   if (!Dest->via_tree)
     Dest->via_tree = r_create_tree (NULL, 0, 0);
@@ -262,13 +265,16 @@ MoveRatToBuffer (RatTypePtr Rat)
 {
   RatTypePtr rat;
 
+  r_delete_entry (Source->rat_tree, &Rat->BoundingBox);
   rat = GetRatMemory (Dest);
   *rat = *Rat;
-  r_delete_entry (Source->rat_tree, &Rat->BoundingBox);
-  *Rat = Source->Rat[--Source->RatN];
+  CLEAR_FLAG (FOUNDFLAG, rat);
+  if (Rat != &Source->Rat[--Source->RatN])
+  {
+  *Rat = Source->Rat[Source->RatN];
   r_substitute (Source->rat_tree, &Source->Rat[Source->RatN].BoundingBox,
 		&Rat->BoundingBox);
-  CLEAR_FLAG (FOUNDFLAG, Rat);
+  }
   memset (&Source->Rat[Source->RatN], 0, sizeof (RatType));
   if (!Dest->rat_tree)
     Dest->rat_tree = r_create_tree (NULL, 0, 0);
@@ -292,9 +298,12 @@ MoveLineToBuffer (LayerTypePtr Layer, LineTypePtr Line)
   *line = *Line;
   CLEAR_FLAG (FOUNDFLAG, line);
   /* line pointers being shuffled */
-  *Line = Layer->Line[--Layer->LineN];
+  if (Line != &Layer->Line[--Layer->LineN])
+  {
+  *Line = Layer->Line[Layer->LineN];
   r_substitute (Layer->line_tree, (BoxTypePtr) & Layer->Line[Layer->LineN],
 		(BoxTypePtr) Line);
+  }
   memset (&Layer->Line[Layer->LineN], 0, sizeof (LineType));
   if (!lay->line_tree)
     lay->line_tree = r_create_tree (NULL, 0, 0);
@@ -319,9 +328,12 @@ MoveArcToBuffer (LayerTypePtr Layer, ArcTypePtr Arc)
   *arc = *Arc;
   CLEAR_FLAG (FOUNDFLAG, arc);
   /* arc pointers being shuffled */
-  *Arc = Layer->Arc[--Layer->ArcN];
+  if (Arc != &Layer->Arc[--Layer->ArcN])
+  {
+  *Arc = Layer->Arc[Layer->ArcN];
   r_substitute (Layer->arc_tree, (BoxTypePtr) & Layer->Arc[Layer->ArcN],
 		(BoxTypePtr) Arc);
+  }
   memset (&Layer->Arc[Layer->ArcN], 0, sizeof (ArcType));
   if (!lay->arc_tree)
     lay->arc_tree = r_create_tree (NULL, 0, 0);
@@ -344,9 +356,12 @@ MoveTextToBuffer (LayerTypePtr Layer, TextTypePtr Text)
   lay = &Dest->Layer[GetLayerNumber (Source, Layer)];
   text = GetTextMemory (lay);
   *text = *Text;
-  *Text = Layer->Text[--Layer->TextN];
+  if (Text != &Layer->Text[--Layer->TextN])
+  {
+  *Text = Layer->Text[Layer->TextN];
   r_substitute (Layer->text_tree, (BoxTypePtr) & Layer->Text[Layer->TextN],
 		(BoxTypePtr) Text);
+  }
   memset (&Layer->Text[Layer->TextN], 0, sizeof (TextType));
   if (!lay->text_tree)
     lay->text_tree = r_create_tree (NULL, 0, 0);
@@ -369,10 +384,13 @@ MovePolygonToBuffer (LayerTypePtr Layer, PolygonTypePtr Polygon)
   polygon = GetPolygonMemory (lay);
   *polygon = *Polygon;
   CLEAR_FLAG (FOUNDFLAG, polygon);
-  *Polygon = Layer->Polygon[--Layer->PolygonN];
+  if (Polygon != &Layer->Polygon[--Layer->PolygonN])
+  {
+  *Polygon = Layer->Polygon[Layer->PolygonN];
   r_substitute (Layer->polygon_tree,
 		(BoxTypePtr) & Layer->Polygon[Layer->PolygonN],
 		(BoxTypePtr) Polygon);
+  }
   memset (&Layer->Polygon[Layer->PolygonN], 0, sizeof (PolygonType));
   if (!lay->polygon_tree)
     lay->polygon_tree = r_create_tree (NULL, 0, 0);
@@ -438,8 +456,9 @@ MoveElementToBuffer (ElementTypePtr Element)
    * particular relation to this removal) becomes `Element' while the
    * original Element is now in `element'.
    */
-  *Element = Source->Element[--Source->ElementN];
-  memset (&Source->Element[Source->ElementN], 0, sizeof (ElementType));
+  if (Element != &Source->Element[--Source->ElementN])
+    {
+  *Element = Source->Element[Source->ElementN];
   r_substitute (Source->element_tree,
 		(BoxType *) & Source->Element[Source->ElementN],
 		(BoxType *) Element);
@@ -462,7 +481,8 @@ MoveElementToBuffer (ElementTypePtr Element)
     pad->Element = Element;
   }
   END_LOOP;
-
+  }
+  memset (&Source->Element[Source->ElementN], 0, sizeof (ElementType));
   return (element);
 }
 
diff --git a/src/create.c b/src/create.c
index fa0a394..fc6b863 100644
--- a/src/create.c
+++ b/src/create.c
@@ -395,6 +395,10 @@ CreateDrawnLineOnLayer (LayerTypePtr Layer,
   search.X2 = MAX (X1, X2);
   search.Y1 = MIN (Y1, Y2);
   search.Y2 = MAX (Y1, Y2);
+  if (search.Y2 == search.Y1)
+    search.Y2++;
+  if (search.X2 == search.X1)
+    search.X2++;
   info.X1 = X1;
   info.X2 = X2;
   info.Y1 = Y1;
diff --git a/src/polygon1.c b/src/polygon1.c
index c9a350f..fdb816d 100644
--- a/src/polygon1.c
+++ b/src/polygon1.c
@@ -1458,7 +1458,7 @@ Collect (jmp_buf * e, PLINE * a, POLYAREA ** contours, PLINE ** holes,
   cur = &a->head;
   do
    {
-    if (cur->Flags.mark == 0 && s_rule (cur, &dir))
+    if (s_rule (cur, &dir) && cur->Flags.mark == 0)
         Collect1(e, cur, dir, contours, holes, j_rule);
     other = cur;
     if ((other->cvc_prev && jump(&other, &dir, j_rule)))
diff --git a/src/rats.c b/src/rats.c
index 6e8d369..35047b5 100644
--- a/src/rats.c
+++ b/src/rats.c
@@ -728,6 +728,7 @@ AddAllRats (Boolean SelectedOnly, void (*funcp) ())
   }
   END_LOOP;
   FreeNetListMemory (Nets);
+  MYFREE (Nets);
   FreeConnectionLookupMemory ();
   RestoreFindFlag ();
   if (funcp)
diff --git a/src/remove.c b/src/remove.c
index de88abe..a82b478 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -130,10 +130,13 @@ DestroyVia (PinTypePtr Via)
 {
   r_delete_entry (DestroyTarget->via_tree, (BoxTypePtr) Via);
   MYFREE (Via->Name);
-  *Via = DestroyTarget->Via[--DestroyTarget->ViaN];
-  r_substitute (DestroyTarget->via_tree, (BoxTypePtr)
-                (BoxType *) & DestroyTarget->Via[DestroyTarget->ViaN],
-                (BoxType *) Via);
+  if (Via != &DestroyTarget->Via[--DestroyTarget->ViaN])
+    {
+      *Via = DestroyTarget->Via[DestroyTarget->ViaN];
+      r_substitute (DestroyTarget->via_tree, (BoxTypePtr)
+		    (BoxType *) & DestroyTarget->Via[DestroyTarget->ViaN],
+		    (BoxType *) Via);
+    }
   memset (&DestroyTarget->Via[DestroyTarget->ViaN], 0, sizeof (PinType));
   return (NULL);
 }
@@ -146,10 +149,13 @@ DestroyLine (LayerTypePtr Layer, LineTypePtr Line)
 {
   r_delete_entry (Layer->line_tree, (BoxTypePtr) Line);
   MYFREE (Line->Number);
-  *Line = Layer->Line[--Layer->LineN];
-  /* tricky - line pointers are moved around */
-  r_substitute (Layer->line_tree, (BoxType *) & Layer->Line[Layer->LineN],
-                (BoxType *) Line);
+  if (Line != &Layer->Line[--Layer->LineN])
+    {
+      *Line = Layer->Line[Layer->LineN];
+      /* tricky - line pointers are moved around */
+      r_substitute (Layer->line_tree, (BoxType *) & Layer->Line[Layer->LineN],
+		    (BoxType *) Line);
+    }
   memset (&Layer->Line[Layer->LineN], 0, sizeof (LineType));
   return (NULL);
 }
@@ -161,9 +167,12 @@ static void *
 DestroyArc (LayerTypePtr Layer, ArcTypePtr Arc)
 {
   r_delete_entry (Layer->arc_tree, (BoxTypePtr) Arc);
-  *Arc = Layer->Arc[--Layer->ArcN];
-  r_substitute (Layer->arc_tree, (BoxType *) & Layer->Arc[Layer->ArcN],
-                (BoxType *) Arc);
+  if (Arc != &Layer->Arc[--Layer->ArcN])
+    {
+      *Arc = Layer->Arc[Layer->ArcN];
+      r_substitute (Layer->arc_tree, (BoxType *) & Layer->Arc[Layer->ArcN],
+		    (BoxType *) Arc);
+    }
   memset (&Layer->Arc[Layer->ArcN], 0, sizeof (ArcType));
   return (NULL);
 }
@@ -176,10 +185,13 @@ DestroyPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
 {
   r_delete_entry (Layer->polygon_tree, (BoxTypePtr) Polygon);
   FreePolygonMemory (Polygon);
-  *Polygon = Layer->Polygon[--Layer->PolygonN];
-  r_substitute (Layer->polygon_tree,
-                (BoxType *) & Layer->Polygon[Layer->PolygonN],
-                (BoxType *) Polygon);
+  if (Polygon != &Layer->Polygon[--Layer->PolygonN])
+    {
+      *Polygon = Layer->Polygon[Layer->PolygonN];
+      r_substitute (Layer->polygon_tree,
+		    (BoxType *) & Layer->Polygon[Layer->PolygonN],
+		    (BoxType *) Polygon);
+    }
   memset (&Layer->Polygon[Layer->PolygonN], 0, sizeof (PolygonType));
   return (NULL);
 }
@@ -189,12 +201,12 @@ DestroyPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
  */
 static void *
 DestroyPolygonPoint (LayerTypePtr Layer,
-                     PolygonTypePtr Polygon, PointTypePtr Point)
+		     PolygonTypePtr Polygon, PointTypePtr Point)
 {
   PointTypePtr ptr;
 
   if (Polygon->PointN <= 3)
-    return RemovePolygon(Layer, Polygon);
+    return RemovePolygon (Layer, Polygon);
   r_delete_entry (Layer->polygon_tree, (BoxType *) Polygon);
   for (ptr = Point + 1; ptr != &Polygon->Points[Polygon->PointN]; ptr++)
     {
@@ -216,9 +228,12 @@ DestroyText (LayerTypePtr Layer, TextTypePtr Text)
 {
   MYFREE (Text->TextString);
   r_delete_entry (Layer->text_tree, (BoxTypePtr) Text);
-  *Text = Layer->Text[--Layer->TextN];
-  r_substitute (Layer->text_tree, (BoxType *) & Layer->Text[Layer->TextN],
-                (BoxType *) Text);
+  if (Text != &Layer->Text[--Layer->TextN])
+    {
+      *Text = Layer->Text[Layer->TextN];
+      r_substitute (Layer->text_tree, (BoxType *) & Layer->Text[Layer->TextN],
+		    (BoxType *) Text);
+    }
   memset (&Layer->Text[Layer->TextN], 0, sizeof (TextType));
   return (NULL);
 }
@@ -235,7 +250,7 @@ DestroyElement (ElementTypePtr Element)
     {
       PIN_LOOP (Element);
       {
-        r_delete_entry (DestroyTarget->pin_tree, (BoxType *) pin);
+	r_delete_entry (DestroyTarget->pin_tree, (BoxType *) pin);
       }
       END_LOOP;
     }
@@ -243,7 +258,7 @@ DestroyElement (ElementTypePtr Element)
     {
       PAD_LOOP (Element);
       {
-        r_delete_entry (DestroyTarget->pad_tree, (BoxType *) pad);
+	r_delete_entry (DestroyTarget->pad_tree, (BoxType *) pad);
       }
       END_LOOP;
     }
@@ -254,11 +269,15 @@ DestroyElement (ElementTypePtr Element)
   }
   END_LOOP;
   FreeElementMemory (Element);
-  *Element = DestroyTarget->Element[--DestroyTarget->ElementN];
-  /* deal with changed element pointer */
-  r_substitute (DestroyTarget->element_tree,
-                (BoxType *) & DestroyTarget->Element[DestroyTarget->ElementN],
-                (BoxType *) Element);
+  if (Element != &DestroyTarget->Element[--DestroyTarget->ElementN])
+    {
+      *Element = DestroyTarget->Element[DestroyTarget->ElementN];
+      /* deal with changed element pointer */
+      r_substitute (DestroyTarget->element_tree,
+		    (BoxType *) & DestroyTarget->Element[DestroyTarget->
+							 ElementN],
+		    (BoxType *) Element);
+    }
   PIN_LOOP (Element);
   {
     pin->Element = Element;
@@ -272,14 +291,14 @@ DestroyElement (ElementTypePtr Element)
   ELEMENTTEXT_LOOP (Element);
   {
     r_substitute (DestroyTarget->name_tree[n],
-                  (BoxType *) & DestroyTarget->Element[DestroyTarget->
-                                                       ElementN].Name[n],
-                  (BoxType *) text);
+		  (BoxType *) & DestroyTarget->Element[DestroyTarget->
+						       ElementN].Name[n],
+		  (BoxType *) text);
     text->Element = Element;
   }
   END_LOOP;
   memset (&DestroyTarget->Element[DestroyTarget->ElementN], 0,
-          sizeof (ElementType));
+	  sizeof (ElementType));
   return (NULL);
 }
 
@@ -291,10 +310,13 @@ DestroyRat (RatTypePtr Rat)
 {
   if (DestroyTarget->rat_tree)
     r_delete_entry (DestroyTarget->rat_tree, &Rat->BoundingBox);
-  *Rat = DestroyTarget->Rat[--DestroyTarget->RatN];
-  r_substitute (DestroyTarget->rat_tree,
-                &DestroyTarget->Rat[DestroyTarget->RatN].BoundingBox,
-                &Rat->BoundingBox);
+  if (Rat != &DestroyTarget->Rat[--DestroyTarget->RatN])
+    {
+      *Rat = DestroyTarget->Rat[DestroyTarget->RatN];
+      r_substitute (DestroyTarget->rat_tree,
+		    &DestroyTarget->Rat[DestroyTarget->RatN].BoundingBox,
+		    &Rat->BoundingBox);
+    }
   memset (&DestroyTarget->Rat[DestroyTarget->RatN], 0, sizeof (RatType));
   return (NULL);
 }
@@ -311,7 +333,7 @@ RemoveVia (PinTypePtr Via)
     {
       EraseVia (Via);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   MoveObjectToRemoveUndoList (VIA_TYPE, Via, Via, Via);
   return (NULL);
@@ -328,7 +350,7 @@ RemoveRat (RatTypePtr Rat)
     {
       EraseRat (Rat);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   MoveObjectToRemoveUndoList (RATLINE_TYPE, Rat, Rat, Rat);
   return (NULL);
@@ -340,13 +362,11 @@ struct rlp_info
   LineTypePtr line;
   PointTypePtr point;
 };
-
 static int
 remove_point (const BoxType * b, void *cl)
 {
   LineType *line = (LineType *) b;
   struct rlp_info *info = (struct rlp_info *) cl;
-
   if (line == info->line)
     return 0;
   if ((line->Point1.X == info->point->X)
@@ -356,8 +376,9 @@ remove_point (const BoxType * b, void *cl)
       info->point = &line->Point1;
       longjmp (info->env, 1);
     }
-  else if ((line->Point2.X == info->point->X)
-           && (line->Point2.Y == info->point->Y))
+  else
+    if ((line->Point2.X == info->point->X)
+	&& (line->Point2.Y == info->point->Y))
     {
       info->line = line;
       info->point = &line->Point2;
@@ -374,7 +395,6 @@ RemoveLinePoint (LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point)
 {
   PointType other;
   struct rlp_info info;
-
   if (&Line->Point1 == Point)
     other = Line->Point2;
   else
@@ -384,11 +404,11 @@ RemoveLinePoint (LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point)
   if (setjmp (info.env) == 0)
     {
       r_search (Layer->line_tree, (const BoxType *) Point, NULL, remove_point,
-                &info);
-      return RemoveLine(Layer, Line);
+		&info);
+      return RemoveLine (Layer, Line);
     }
   MoveObject (LINEPOINT_TYPE, Layer, info.line, info.point,
-              other.X - Point->X, other.Y - Point->Y);
+	      other.X - Point->X, other.Y - Point->Y);
   return (RemoveLine (Layer, Line));
 }
 
@@ -403,7 +423,7 @@ RemoveLine (LayerTypePtr Layer, LineTypePtr Line)
     {
       EraseLine (Line);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   MoveObjectToRemoveUndoList (LINE_TYPE, Layer, Line, Line);
   return (NULL);
@@ -420,7 +440,7 @@ RemoveArc (LayerTypePtr Layer, ArcTypePtr Arc)
     {
       EraseArc (Arc);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   MoveObjectToRemoveUndoList (ARC_TYPE, Layer, Arc, Arc);
   return (NULL);
@@ -437,7 +457,7 @@ RemoveText (LayerTypePtr Layer, TextTypePtr Text)
     {
       EraseText (Layer, Text);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   MoveObjectToRemoveUndoList (TEXT_TYPE, Layer, Text, Text);
   return (NULL);
@@ -454,7 +474,7 @@ RemovePolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
     {
       ErasePolygon (Polygon);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   MoveObjectToRemoveUndoList (POLYGON_TYPE, Layer, Polygon, Polygon);
   return (NULL);
@@ -465,13 +485,12 @@ RemovePolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
  */
 static void *
 RemovePolygonPoint (LayerTypePtr Layer,
-                    PolygonTypePtr Polygon, PointTypePtr Point)
+		    PolygonTypePtr Polygon, PointTypePtr Point)
 {
   PointTypePtr ptr;
   Cardinal index = 0;
-
   if (Polygon->PointN <= 3)
-    return RemovePolygon(Layer, Polygon);
+    return RemovePolygon (Layer, Polygon);
   if (Layer->On)
     ErasePolygon (Polygon);
   /* insert the polygon-point into the undo list */
@@ -479,15 +498,13 @@ RemovePolygonPoint (LayerTypePtr Layer,
   {
     if (point == Point)
       {
-        index = n;
-        break;
+	index = n;
+	break;
       }
   }
   END_LOOP;
-
   AddObjectToRemovePointUndoList (POLYGONPOINT_TYPE, Layer, Polygon, index);
   r_delete_entry (Layer->polygon_tree, (BoxType *) Polygon);
-
   /* remove point from list, keep point order */
   for (ptr = Point + 1; ptr != &Polygon->Points[Polygon->PointN]; ptr++)
     {
@@ -504,7 +521,7 @@ RemovePolygonPoint (LayerTypePtr Layer,
     {
       DrawPolygon (Layer, Polygon, 0);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   return (NULL);
 }
@@ -521,7 +538,7 @@ RemoveElement (ElementTypePtr Element)
     {
       EraseElement (Element);
       if (!Bulk)
-        Draw ();
+	Draw ();
     }
   MoveObjectToRemoveUndoList (ELEMENT_TYPE, Element, Element, Element);
   return (NULL);
@@ -566,14 +583,13 @@ Boolean
 DeleteRats (Boolean selected)
 {
   Boolean changed = False;
-
   Bulk = True;
   RAT_LOOP (PCB->Data);
   {
     if ((!selected) || TEST_FLAG (SELECTEDFLAG, line))
       {
-        changed = True;
-        RemoveRat (line);
+	changed = True;
+	RemoveRat (line);
       }
   }
   END_LOOP;
@@ -591,8 +607,8 @@ DeleteRats (Boolean selected)
  * allocated memory is destroyed assumed to already be erased
  */
 void *
-DestroyObject (DataTypePtr Target, int Type, void *Ptr1, void *Ptr2,
-               void *Ptr3)
+DestroyObject (DataTypePtr Target, int Type, void *Ptr1,
+	       void *Ptr2, void *Ptr3)
 {
   DestroyTarget = Target;
   return (ObjectOperation (&DestroyFunctions, Type, Ptr1, Ptr2, Ptr3));
diff --git a/src/search.c b/src/search.c
index 6e3f4c5..07015f0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -40,6 +40,7 @@
 
 #include "global.h"
 
+#include "box.h"
 #include "data.h"
 #include "draw.h"
 #include "error.h"
@@ -1143,10 +1144,17 @@ SearchObjectByLocation (int Type,
   PosX = X;
   PosY = Y;
   SearchRadius = Radius;
-  SearchBox.X1 = X - Radius;
-  SearchBox.Y1 = Y - Radius;
-  SearchBox.X2 = X + Radius;
-  SearchBox.Y2 = Y + Radius;
+  if (Radius)
+    {
+      SearchBox.X1 = X - Radius;
+      SearchBox.Y1 = Y - Radius;
+      SearchBox.X2 = X + Radius;
+      SearchBox.Y2 = Y + Radius;
+    }
+  else
+    {
+      SearchBox = point_box (X, Y);
+    }
 
   if (TEST_FLAG (LOCKNAMESFLAG, PCB)
       || TEST_FLAG (HIDENAMESFLAG, PCB))




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