Author: rfm
Date: Fri May 22 17:11:59 2015
New Revision: 38520

URL: http://svn.gna.org/viewcvs/gnustep?rev=38520&view=rev
Log:
slight optimisation

Modified:
    libs/webservices/trunk/GWSElement.m

Modified: libs/webservices/trunk/GWSElement.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/webservices/trunk/GWSElement.m?rev=38520&r1=38519&r2=38520&view=diff
==============================================================================
--- libs/webservices/trunk/GWSElement.m (original)
+++ libs/webservices/trunk/GWSElement.m Fri May 22 17:11:59 2015
@@ -77,6 +77,7 @@
 
 - (void) addChild: (GWSElement*)child
 {
+#if     defined(DEBUG)
   if (NO == [child isKindOfClass: GWSElementClass])
     {
       [NSException raise: NSInvalidArgumentException
@@ -87,8 +88,13 @@
       [NSException raise: NSInvalidArgumentException
                  format: @"-addChild: child is ancestor"];
     }
+#endif
+
   [child retain];
-  [child remove];
+  if (child->_parent)
+    {
+      [child remove];
+    }
   if (nil == _first)
     {
       _first = child;
@@ -591,6 +597,7 @@
 
 - (void) insertChild: (GWSElement*)child atIndex: (NSUInteger)index
 {
+#if     defined(DEBUG)
   if (NO == [child isKindOfClass: GWSElementClass])
     {
       [NSException raise: NSInvalidArgumentException
@@ -606,7 +613,6 @@
       [NSException raise: NSInvalidArgumentException
                  format: @"-insertChild:atIndex: child is ancestor"];
     }
-
   if (child->_parent == self)
     {
       if (index >= _children)
@@ -615,9 +621,13 @@
                       format: @"-insertChild:atIndex: index out of range"];
         }
     }
+#endif
 
   [child retain];
-  [child remove];
+  if (child->_parent)
+    {
+      [child remove];
+    }
   if (nil == _first)
     {
       _first = child;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to