axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r490400 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp: BeanParamWriter.java literal/ClientStubWriter.java
Date Tue, 26 Dec 2006 23:32:39 GMT
Author: nadiramra
Date: Tue Dec 26 15:32:39 2006
New Revision: 490400

URL: http://svn.apache.org/viewvc?view=rev&rev=490400
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
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.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=490400&r1=490399&r2=490400
==============================================================================
--- 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 15:32:39 2006
@@ -871,9 +871,7 @@
                             + attribs[i].getParamNameAsSOAPElement()
                             + "\",0);\n");
                     writer.write("\tif(param->" + attribs[i].getParamNameAsMember() +
" == NULL)\n");
-                    writer.write("\t{\n");
                     writer.write("\t\tparam->" + attribs[i].getParamNameAsMember() + "
= new " + attribs[i].getTypeName() + "_Array();\n");
-                    writer.write("\t}\n");
                     writer.write("\tparam->" + attribs[i].getParamNameAsMember() + "->clone(
*array" + arrayCount + ");\n");
                     writer.write("\tAxis::AxisDelete((void*) array" + arrayCount + ", XSD_ARRAY);\n\n");
                 }
@@ -1190,13 +1188,9 @@
                 {
                     anyCounter++;
                     writer.write("\tif (original." + attribs[i].getParamName() + anyCounter
+ " != NULL)\n");
-                    writer.write("\t{\n");
                     writer.write("\t\t" + attribs[i].getParamName() + anyCounter + " = new
" + attribs[i].getTypeName() + "(*(original." + attribs[i].getParamName() + anyCounter + "));\n");
-                    writer.write("\t}\n");
                     writer.write("\telse\n");
-                    writer.write("\t{\n");
                     writer.write("\t\t" + attribs[i].getParamName() + anyCounter + " = NULL;\n");
-                    writer.write("\t}\n");
                 }
                 else
                 {
@@ -1221,15 +1215,11 @@
                     else
                     {
                         writer.write("\tif (original." + attribs[i].getParamName() + " !=
NULL)\n");
-                        writer.write("\t{\n");
                         writer.write("\t\t" + attribs[i].getParamName() + " = new " 
                                 + attribs[i].getTypeName() + "(*(original." 
                                 + attribs[i].getParamName() + "));\n");
-                        writer.write("\t}\n");
                         writer.write("\telse\n");
-                        writer.write("\t{\n");
                         writer.write("\t\t" + attribs[i].getParamName() + " = NULL;\n");
-                        writer.write("\t}\n");
                     }
                 }
             }
@@ -1341,47 +1331,27 @@
                     isPointerType = CUtils.isPointerType(typename);
                 
                 if(attribs[i].isArray())
-                {
-                    writer.write("\tif (" + name + "!= NULL)\n");
-                    writer.write("\t{\n");
-                    writer.write("\t\tdelete " + name + ";\n");
-                    writer.write("\t\t" + name + " = NULL;\n");
-                    writer.write("\t}\n");
-                }
+                    writer.write("\tdelete " + name + ";\n");
                 else if (attribs[i].isAnyType())
                 {
                     anyCounter += 1;
                     name = name + Integer.toString(anyCounter);
                     writer.write("\tif ("+name+") \n\t{\n");
-                    writer.write("\t\tfor (int i=0; i<"+name+"->_size; i++)\n\t\t{\n");
-                    writer.write("\t\t\tif ("+name+"->_array[i]) delete [] "+name+"->_array[i];\n");
-                    writer.write("\t\t}\n");
+                    writer.write("\t\tfor (int i=0; i<"+name+"->_size; i++)\n");
+                    writer.write("\t\t\tdelete [] "+name+"->_array[i];\n");
                     writer.write("\t\tdelete "+name+";\n");
                     writer.write("\t}\n");
-                    
                 }
                 else if (!(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
-                {
-                    writer.write("\tif (" + name + "!= NULL)\n");
-                    writer.write("\t{\n");
-                    writer.write("\t\tdelete " + name + ";\n");
-                    writer.write("\t\t" + name + " = NULL;\n");
-                    writer.write("\t}\n");
-                }
+                    writer.write("\tdelete " + name + ";\n");
                 else if (isPointerType || isElementNillable(i) || isElementOptional(i) ||
attribs[i].getChoiceElement() || attribs[i].getAllElement())
                 {
                     // found pointer type
-                    writer.write("\tif (" + name + " != NULL)\n");
-                    writer.write("\t{\n");
-                    writer.write("\t\tif(__axis_deepcopy_" + name + ")\n");
-                    writer.write("\t\t{\n");
-                    writer.write("\t\t\tdelete ");
+                    writer.write("\tif(__axis_deepcopy_" + name + ")\n");
+                    writer.write("\t\tdelete ");
                     if (isPointerType)
                         writer.write("[] ");
                     writer.write(name + ";\n");
-                    writer.write("\t\t}\n");
-                    writer.write("\t\t" + name + " = NULL;\n");
-                    writer.write("\t}\n");
                 }
             }
             writer.write("}\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java?view=diff&rev=490400&r1=490399&r2=490400
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
Tue Dec 26 15:32:39 2006
@@ -669,14 +669,9 @@
                         writer.write("\t\t\tif( pReturn" + i + " != NULL && OutValue"
+ i + " != NULL)\n");
                         writer.write("\t\t\t{\n");
                         writer.write("\t\t\t\tif( *OutValue" + i + " == NULL)\n");
-                        writer.write("\t\t\t\t{\n");
-                        writer.write("\t\t\t\t\t*OutValue" + i + " = new " + currentParaType

-                            + "();\n");
-                        writer.write("\t\t\t\t}\n");
+                        writer.write("\t\t\t\t\t*OutValue" + i + " = new " + currentParaType
+ "();\n");
                         writer.write("\t\t\t\telse\n");
-                        writer.write("\t\t\t\t{\n");
                         writer.write("\t\t\t\t\t(*OutValue" + i + ")->clear();\n");
-                        writer.write("\t\t\t\t}\n\n");
                         writer.write("\t\t\t\t(*OutValue" + i + ")->clone(*pReturn" +
i + ");\n");
                         writer.write("\t\t\t}\n\n");
                         writer.write("\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ",
XSD_ARRAY);\n");
@@ -761,12 +756,11 @@
                         writer.write( "\n");
                         writer.write( "\t\t\tif( pReturn" + i + " != NULL && OutValue"
+ i + " != NULL)\n");
                         writer.write( "\t\t\t{\n");
+                        
                         if (currentType.isNillable() || currentType.isOptional())
                         {
                             writer.write( "\t\t\t\tif( *OutValue" + i + " == NULL)\n");
-                            writer.write( "\t\t\t\t{\n");
                             writer.write( "\t\t\t\t\t*OutValue" + i + " = new " + currentParaType
+ "();\n");
-                            writer.write( "\t\t\t\t}\n");
                             writer.write( "\n");
                             writer.write( "\t\t\t\t*");
                         }



---------------------------------------------------------------------
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