axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r490407 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
Date Wed, 27 Dec 2006 00:02:04 GMT
Author: nadiramra
Date: Tue Dec 26 16:02:04 2006
New Revision: 490407

URL: http://svn.apache.org/viewvc?view=rev&rev=490407
Log:
Simplify code generator and code that is generated by removing unnecessary braces
and checks prior to issuing "delete" to release memory (the operation is allowed
against a null pointer).  In addition, remove the null'ing of pointers in the 
destructor.  No reason to do that. 

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java?view=diff&rev=490407&r1=490406&r2=490407
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
Tue Dec 26 16:02:04 2006
@@ -127,19 +127,18 @@
                             + methodName + "(" + parameterTypeName + " pInValue)\n{\n");
 
                     writer.write("\tif(" + parameterName + " == NULL)\n");
-                    writer.write("\t{\n");
                     
                     if (attribs[i].getChoiceElement() || attribs[i].getAllElement())
                     {
+                        writer.write("\t{\n");
                         writer.write("\t\t// This object is a 'choice' or 'all', so need
to ensure that any\n");
                         writer.write("\t\t// other objects belonging to this union of elements
are empty.\n");
                         writer.write("\t\t// NB: Hasn't been implemented yet!\n");
                         writer.write("\t\t" + parameterName + " = new " + type + "_Array();\n");
+                        writer.write("\t}\n");
                     }
                     else
-                        writer.write("\t\t" + parameterName + " = new " + properParamName
+ "();\n");
-                    
-                    writer.write("\t}\n");
+                        writer.write("\t\t" + parameterName + " = new " + properParamName
+ "();\n");                   
                     
                     if (attribs[i].getChoiceElement() || attribs[i].getAllElement())
                         writer.write("\t" + parameterName + "->clone( *pInValue);\n");
@@ -190,15 +189,11 @@
                                 + methodName + "(" + properParamName
                                 + " * pInValue, bool deep)\n{\n");
                     }
-                    
-                    writer.write("\tif (" + parameterName + " != NULL)\n");
-                    writer.write("\t{\n");
-                    writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
-                    writer.write("\t\t{\n");
-                    writer.write("\t\t\tdelete " + parameterName + ";\n");
-                    writer.write("\t\t}\n");
-                    writer.write("\t\t" + parameterName + " = NULL;\n");
-                    writer.write("\t}\n");
+
+                    writer.write("\tif (__axis_deepcopy_" + parameterName + ")\n");
+                    writer.write("\t\tdelete " + parameterName + ";\n");
+                    writer.write("\t" + parameterName + " = NULL;\n");
+
                     writer.write("\tif (pInValue != NULL)\n");
                     writer.write("\t{\n");
                     writer.write("\t\tif (deep)\n");
@@ -217,14 +212,9 @@
                     writer.write("\t\t\t*" + parameterName + " = *pInValue;\n");
                     writer.write("\t\t}\n");
                     writer.write("\t\telse\n");
-                    writer.write("\t\t{\n");
                     writer.write("\t\t\t" + parameterName + " = pInValue;\n");
-                    writer.write("\t\t}\n");
-                    writer.write("\t}\n");
-                    writer.write("\telse\n");
-                    writer.write("\t{\n");
-                    writer.write("\t\t" + parameterName + " = NULL;\n");
                     writer.write("\t}\n");
+
                     writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
 
                     if (attribs[i].getChoiceElement())
@@ -293,14 +283,10 @@
                     
                     if(isPointerType)
                     {
-                        writer.write("\tif (" + parameterName + " != NULL)\n");
-                        writer.write("\t{\n");
-                        writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
-                        writer.write("\t\t{\n");
-                        writer.write("\t\t\tdelete [] " + parameterName + ";\n");
-                        writer.write("\t\t}\n");
-                        writer.write("\t\t" + parameterName + " = NULL;\n");
-                        writer.write("\t}\n\n");
+                        writer.write("\tif (__axis_deepcopy_" + parameterName + ")\n");
+                        writer.write("\t\tdelete [] " + parameterName + ";\n");
+                        writer.write("\t" + parameterName + " = NULL;\n");
+                        
                         writer.write("\tif(InValue != NULL)\n");
                         writer.write("\t{\n");
                         writer.write("\t\tif (deep)\n");
@@ -309,27 +295,18 @@
                         writer.write("\t\t\tstrcpy(" + parameterName + ", InValue);\n");
                         writer.write("\t\t}\n");
                         writer.write("\t\telse\n");
-                        writer.write("\t\t{\n");
                         writer.write("\t\t\t" + parameterName + " = InValue;\n");
-                        writer.write("\t\t}\n");
-                        writer.write("\t}\n");
-                        writer.write("\telse\n");
-                        writer.write("\t{\n");
-                        writer.write("\t\t" + parameterName + " = NULL;\n");
                         writer.write("\t}\n");
+
                         writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
                     }
                     else if ((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType())

                                 && (attribs[i].getAllElement() || attribs[i].getChoiceElement()))
                     {
-                        writer.write("\tif (" + parameterName + " != NULL)\n");
-                        writer.write("\t{\n");
-                        writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
-                        writer.write("\t\t{\n");
-                        writer.write("\t\t\tdelete " + parameterName + ";\n");
-                        writer.write("\t\t}\n");
-                        writer.write("\t\t" + parameterName + " = NULL;\n");
-                        writer.write("\t}\n");
+                        writer.write("\tif (__axis_deepcopy_" + parameterName + ")\n");
+                        writer.write("\t\tdelete " + parameterName + ";\n");
+                        writer.write("\t" + parameterName + " = NULL;\n");
+
                         writer.write("\tif (InValue != NULL)\n");
                         writer.write("\t{\n");
                         writer.write("\t\tif (deep)\n");
@@ -338,14 +315,9 @@
                         writer.write("\t\t\t*" + parameterName + " = *InValue;\n");
                         writer.write("\t\t}\n");
                         writer.write("\t\telse\n");
-                        writer.write("\t\t{\n");
                         writer.write("\t\t\t" + parameterName + " = InValue;\n");
-                        writer.write("\t\t}\n");
-                        writer.write("\t}\n");
-                        writer.write("\telse\n");
-                        writer.write("\t{\n");
-                        writer.write("\t\t" + parameterName + " = NULL;\n");
                         writer.write("\t}\n");
+
                         writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
                     }
                     else



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message