axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r395780 [2/4] - in /webservices/axis2/trunk/c: include/ include/xml_schema/ modules/xml/om/ modules/xml/soap/ modules/xml/xml_schema/
Date Fri, 21 Apr 2006 05:01:04 GMT
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/validation_event_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/validation_event_handler.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/validation_event_handler.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/validation_event_handler.c Thu Apr 20 22:00:55 2006
@@ -14,82 +14,90 @@
  * limitations under the License.
  */
  
-#include <xml_schema/axis2_validation_event_handler.h>
+#include <axis2_validation_event_handler.h>
 #include <axis2_hash.h>
 
-typedef struct axis2_xml_schema_validation_event_handler_impl axis2_xml_schema_validation_event_handler_impl_t;
+typedef struct axis2_validation_event_handler_impl 
+                axis2_validation_event_handler_impl_t;
 
 /** 
  * @brief Xml Schema Validation Event Handler Struct Impl
  *	Axis2 Xml Schema Validation Event Handler  
  */ 
-struct axis2_xml_schema_validation_event_handler_impl
+struct axis2_validation_event_handler_impl
 {
-    axis2_xml_schema_validation_event_handler_t axis2_validation_event_handler;
+    axis2_validation_event_handler_t veh;
 };
 
-#define INTF_TO_IMPL(axis2_validation_event_handler) ((axis2_xml_schema_validation_event_handler_impl_t *) axis2_validation_event_handler)
+#define AXIS2_INTF_TO_IMPL(veh) \
+        ((axis2_validation_event_handler_impl_t *) veh)
 
 axis2_status_t AXIS2_CALL 
-axis2_xml_schema_validation_event_handler_free(void *axis2_validation_event_handler,
-                axis2_env_t **env);
+axis2_validation_event_handler_free(axis2_validation_event_handler_t *veh,
+                                    axis2_env_t **env);
 
-AXIS2_DECLARE(axis2_xml_schema_validation_event_handler_t *)
-axis2_xml_schema_validation_event_handler_create(axis2_env_t **env)
+AXIS2_DECLARE(axis2_validation_event_handler_t *)
+axis2_validation_event_handler_create(axis2_env_t **env)
 {
-    axis2_xml_schema_validation_event_handler_impl_t *axis2_validation_event_handler_impl = NULL;
+    axis2_validation_event_handler_impl_t *veh_impl = NULL;
     
-    axis2_validation_event_handler_impl = AXIS2_MALLOC((*env)->allocator, 
-                    sizeof(axis2_xml_schema_validation_event_handler_impl_t));
-
-    axis2_validation_event_handler_impl->axis2_validation_event_handler.ops = AXIS2_MALLOC((*env)->allocator, 
-                    sizeof(axis2_xml_schema_validation_event_handler_ops_t)); 
+    veh_impl = AXIS2_MALLOC((*env)->allocator, 
+                    sizeof(axis2_validation_event_handler_impl_t));
+    if(!veh_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    veh_impl->veh.ops = NULL;
+    
+    veh_impl->veh.ops = AXIS2_MALLOC((*env)->allocator, 
+                    sizeof(axis2_validation_event_handler_ops_t)); 
 
 
-    axis2_validation_event_handler_impl->axis2_validation_event_handler.ops->free = axis2_xml_schema_validation_event_handler_free;
+    veh_impl->veh.ops->free = axis2_validation_event_handler_free;
 
-    return &(axis2_validation_event_handler_impl->axis2_validation_event_handler);
+    return &(veh_impl->veh);
 }
 
 
 axis2_status_t AXIS2_CALL
-axis2_xml_schema_validation_event_handler_free(void *axis2_validation_event_handler,
+axis2_validation_event_handler_free(axis2_validation_event_handler_t *veh,
                 axis2_env_t **env)
 {
-    axis2_xml_schema_validation_event_handler_impl_t *axis2_validation_event_handler_impl = NULL;
+    axis2_validation_event_handler_impl_t *veh_impl = NULL;
 
-    axis2_validation_event_handler_impl = INTF_TO_IMPL(axis2_validation_event_handler);
+    veh_impl = AXIS2_INTF_TO_IMPL(veh);
 
-    if((&(axis2_validation_event_handler_impl->axis2_validation_event_handler))->ops)
+    if(NULL != veh_impl->veh.ops)
     {
-        AXIS2_FREE((*env)->allocator ,((&(axis2_validation_event_handler_impl->axis2_validation_event_handler))->ops));
-        (&(axis2_validation_event_handler_impl->axis2_validation_event_handler))->ops = NULL;
+        AXIS2_FREE((*env)->allocator, veh_impl->veh.ops);
+        veh_impl->veh.ops = NULL;
     }
 
-    if(axis2_validation_event_handler_impl)
+    if(NULL != veh_impl)
     {
-        free(axis2_validation_event_handler_impl);
-        axis2_validation_event_handler_impl = NULL;
+        AXIS2_FREE((*env)->allocator, veh_impl);
+        veh_impl = NULL;
     }
     return AXIS2_SUCCESS;
 }
 
 AXIS2_DECLARE(axis2_status_t)
-axis2_xml_schema_validation_event_handler_resolve_methods(axis2_xml_schema_validation_event_handler_t *axis2_validation_event_handler,
+axis2_validation_event_handler_resolve_methods(axis2_validation_event_handler_t *axis2_validation_event_handler,
                                         axis2_env_t **env,
-                                        axis2_xml_schema_validation_event_handler_t *axis2_validation_event_handler_impl,
+                                        axis2_validation_event_handler_t *axis2_validation_event_handler_impl,
                                         axis2_hash_t *methods)
 {    
-    axis2_xml_schema_validation_event_handler_impl_t *axis2_validation_event_handler_impl_l = NULL;
+    axis2_validation_event_handler_impl_t *axis2_validation_event_handler_impl_l = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, axis2_validation_event_handler_impl, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
     
-    axis2_validation_event_handler_impl_l = (axis2_xml_schema_validation_event_handler_impl_t *) axis2_validation_event_handler_impl;
+    axis2_validation_event_handler_impl_l = (axis2_validation_event_handler_impl_t *) axis2_validation_event_handler_impl;
     
     axis2_validation_event_handler->ops = AXIS2_MALLOC((*env)->allocator, 
-            sizeof(axis2_xml_schema_validation_event_handler_ops_t));
+            sizeof(axis2_validation_event_handler_ops_t));
     axis2_validation_event_handler->ops->free = axis2_hash_get(methods, "free", 
             AXIS2_HASH_KEY_STRING);
     return AXIS2_SUCCESS;    

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema.c Thu Apr 20 22:00:55 2006
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema.h>
-#include <xml_schema/axis2_xml_schema_collection.h>
-#include <xml_schema/axis2_xml_schema_form.h>
-#include <xml_schema/axis2_xml_schema_obj_table.h>
-#include <xml_schema/axis2_xml_schema_derivation_method.h>
-#include <xml_schema/axis2_xml_schema_type.h>
-#include <xml_schema/axis2_xml_schema_obj_collection.h>
-#include <xml_schema/axis2_validation_event_handler.h>
-#include <xml_schema/axis2_xml_schema_element.h>
+#include <axis2_xml_schema.h>
+#include <axis2_xml_schema_collection.h>
+#include <axis2_xml_schema_form.h>
+#include <axis2_xml_schema_obj_table.h>
+#include <axis2_xml_schema_derivation_method.h>
+#include <axis2_xml_schema_type.h>
+#include <axis2_xml_schema_obj_collection.h>
+#include <axis2_validation_event_handler.h>
+#include <axis2_xml_schema_element.h>
 
 typedef struct axis2_xml_schema_impl axis2_xml_schema_impl_t;
 /** 
@@ -54,7 +54,7 @@
     axis2_xml_schema_collection_t *parent;
 };
 
-#define INTF_TO_IMPL(schema) ((axis2_xml_schema_impl_t *) schema)
+#define AXIS2_INTF_TO_IMPL(schema) ((axis2_xml_schema_impl_t *) schema)
 
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_free(void *schema,
@@ -167,7 +167,7 @@
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_compile(void *schema,
                             axis2_env_t **env,
-                            axis2_xml_schema_validation_event_handler_t *eh);
+                            axis2_validation_event_handler_t *eh);
 
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_write_a_out(void *schema,
@@ -371,7 +371,7 @@
     axis2_xml_schema_impl_t *schema_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    schema_impl = INTF_TO_IMPL(schema);
+    schema_impl = AXIS2_INTF_TO_IMPL(schema);
 
     if(schema_impl->methods)
     {
@@ -406,7 +406,7 @@
     axis2_xml_schema_impl_t *schema_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    schema_impl = INTF_TO_IMPL(schema);
+    schema_impl = AXIS2_INTF_TO_IMPL(schema);
 
     return schema_impl->annotated;
 }
@@ -511,7 +511,7 @@
     axis2_xml_schema_impl_t *schema_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    schema_impl = INTF_TO_IMPL(schema);
+    schema_impl = AXIS2_INTF_TO_IMPL(schema);
     
     return NULL;
 }
@@ -524,7 +524,7 @@
     axis2_xml_schema_impl_t *schema_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    schema_impl = INTF_TO_IMPL(schema);
+    schema_impl = AXIS2_INTF_TO_IMPL(schema);
     
     return AXIS2_SUCCESS;
 }
@@ -536,7 +536,7 @@
     axis2_xml_schema_impl_t *schema_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    schema_impl = INTF_TO_IMPL(schema);
+    schema_impl = AXIS2_INTF_TO_IMPL(schema);
     
     return NULL;
 }
@@ -548,7 +548,7 @@
     axis2_xml_schema_impl_t *schema_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    schema_impl = INTF_TO_IMPL(schema);
+    schema_impl = AXIS2_INTF_TO_IMPL(schema);
     
     return NULL;
 }
@@ -689,7 +689,7 @@
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_compile(void *schema,
                             axis2_env_t **env,
-                            axis2_xml_schema_validation_event_handler_t *eh) 
+                            axis2_validation_event_handler_t *veh) 
 {
     return AXIS2_SUCCESS;
 

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_all.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_all.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_all.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_all.c Thu Apr 20 22:00:55 2006
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema_all.h>
-#include <xml_schema/axis2_xml_schema_group_base.h>
+#include <axis2_xml_schema_all.h>
+#include <axis2_xml_schema_group_base.h>
 
 typedef struct axis2_xml_schema_all_impl axis2_xml_schema_all_impl_t;
 
@@ -31,7 +31,7 @@
     axis2_xml_schema_obj_collection_t *items;
 };
 
-#define INTF_TO_IMPL(all) ((axis2_xml_schema_all_impl_t *) all)
+#define AXIS2_INTF_TO_IMPL(all) ((axis2_xml_schema_all_impl_t *) all)
 
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_all_free(void *all,
@@ -93,7 +93,7 @@
     axis2_xml_schema_all_impl_t *all_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    all_impl = INTF_TO_IMPL(all);
+    all_impl = AXIS2_INTF_TO_IMPL(all);
 
     if(all_impl->items)
     {
@@ -134,7 +134,7 @@
     axis2_xml_schema_all_impl_t *all_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    all_impl = INTF_TO_IMPL(all);
+    all_impl = AXIS2_INTF_TO_IMPL(all);
 
     return all_impl->base;
 }
@@ -171,7 +171,7 @@
 axis2_xml_schema_all_get_items(void *all,
                                     axis2_env_t **env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    return INTF_TO_IMPL(all)->items;
+    AXIS2_ENV_CHECK(env, NULL);
+    return AXIS2_INTF_TO_IMPL(all)->items;
 }
 

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotated.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotated.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotated.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotated.c Thu Apr 20 22:00:55 2006
@@ -14,10 +14,11 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema_annotated.h>
-#include <xml_schema/axis2_xml_schema_annotation.h>
+#include <axis2_xml_schema_annotated.h>
+#include <axis2_xml_schema_annotation.h>
 
-typedef struct axis2_xml_schema_annotated_impl axis2_xml_schema_annotated_impl_t;
+typedef struct axis2_xml_schema_annotated_impl 
+                    axis2_xml_schema_annotated_impl_t;
 
 /** 
  * @brief Other Extension Struct Impl
@@ -26,14 +27,22 @@
 struct axis2_xml_schema_annotated_impl
 {
     axis2_xml_schema_annotated_t annotated;
+    
     axis2_xml_schema_obj_t *schema_obj;
+    
     axis2_hash_t *methods;
+    
     axis2_xml_schema_annotation_t *annotation;
+    
     axis2_char_t *id;
+    
     axis2_array_list_t *unhandled_attrs;
 };
 
-#define INTF_TO_IMPL(annotated) ((axis2_xml_schema_annotated_impl_t *) annotated)
+#define AXIS2_INTF_TO_IMPL(annotated) \
+        ((axis2_xml_schema_annotated_impl_t *) annotated)
+
+/*************** function prototypes *****************************************/
 
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_annotated_free(void *annotated,
@@ -77,20 +86,35 @@
 {
     axis2_xml_schema_annotated_impl_t *annotated_impl = NULL;
     axis2_status_t status = AXIS2_FAILURE;
+    AXIS2_ENV_CHECK(env, NULL);
 
     annotated_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_annotated_impl_t));
-
+    if(!annotated_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
     annotated_impl->schema_obj = NULL;
     annotated_impl->methods = NULL;
     annotated_impl->id = NULL;
     annotated_impl->annotation = NULL;
     annotated_impl->unhandled_attrs = NULL;
-
+    annotated_impl->annotated.ops = NULL;
+    annotated_impl->annotated.base.ops = NULL;
+    
     annotated_impl->annotated.ops = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_annotated_ops_t));
-
-    annotated_impl->annotated.ops->free = axis2_xml_schema_annotated_free;
+    if(!annotated_impl->annotated.ops)
+    {
+        axis2_xml_schema_annotated_free(&(annotated_impl->annotated), env);
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    annotated_impl->annotated.ops->free = 
+            axis2_xml_schema_annotated_free;
     annotated_impl->annotated.ops->get_base_impl = 
             axis2_xml_schema_annotated_get_base_impl;
     annotated_impl->annotated.ops->get_id = 
@@ -128,10 +152,15 @@
        AXIS2_HASH_KEY_STRING, axis2_xml_schema_annotated_set_unhandled_attrs);
 
     annotated_impl->schema_obj = axis2_xml_schema_obj_create(env);
+    if(!annotated_impl->schema_obj)
+    {
+        axis2_xml_schema_annotated_free(&(annotated_impl->annotated), env);
+        return NULL;
+    }
     status = axis2_xml_schema_obj_resolve_methods(
             &(annotated_impl->annotated.base), env, annotated_impl->schema_obj, 
             annotated_impl->methods);
-
+            
     return &(annotated_impl->annotated);
 }
 
@@ -142,49 +171,52 @@
     axis2_xml_schema_annotated_impl_t *annotated_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    annotated_impl = INTF_TO_IMPL(annotated);
+    annotated_impl = AXIS2_INTF_TO_IMPL(annotated);
 
-    if(annotated_impl->id)
+    if(NULL != annotated_impl->id)
     {
         AXIS2_FREE((*env)->allocator, annotated_impl->id);
         annotated_impl->id = NULL;
     }
 
-    if(annotated_impl->annotation)
+    if(NULL != annotated_impl->annotation)
     {
         AXIS2_XML_SCHEMA_ANNOTATION_FREE(annotated_impl->annotation, env);
         annotated_impl->annotation = NULL;
     }
  
-    if(annotated_impl->unhandled_attrs)
+    if(NULL != annotated_impl->unhandled_attrs)
     {
+        /* TODO need to iterate and free attributes */
         AXIS2_ARRAY_LIST_FREE(annotated_impl->unhandled_attrs, env);
         annotated_impl->unhandled_attrs = NULL;
     }  
 
-    if(annotated_impl->methods)
+    if(NULL != annotated_impl->methods)
     {
         axis2_hash_free(annotated_impl->methods, env);
         annotated_impl->methods = NULL;
     }
     
-    if(annotated_impl->schema_obj)
+    if(NULL != annotated_impl->schema_obj)
     {
         AXIS2_XML_SCHEMA_OBJ_FREE(annotated_impl->schema_obj, env);
         annotated_impl->schema_obj = NULL;
     }
     
-    if((&(annotated_impl->annotated))->ops)
+    if(NULL != annotated_impl->annotated.ops)
     {
-        AXIS2_FREE((*env)->allocator, (&(annotated_impl->annotated))->ops);
-        (&(annotated_impl->annotated))->ops = NULL;
+        AXIS2_FREE((*env)->allocator, annotated_impl->annotated.ops);
+        annotated_impl->annotated.ops = NULL;
     }
-
-    if(annotated_impl)
+    if(NULL != annotated_impl->annotated.base.ops)
     {
-        AXIS2_FREE((*env)->allocator, annotated_impl);
-        annotated_impl = NULL;
+        AXIS2_FREE((*env)->allocator, annotated_impl->annotated.base.ops);
+        annotated_impl->annotated.base.ops = NULL;
     }
+
+    AXIS2_FREE((*env)->allocator, annotated_impl);
+    annotated_impl = NULL;
     return AXIS2_SUCCESS;
 }
 
@@ -193,10 +225,7 @@
                                 axis2_env_t **env)
 {
     axis2_xml_schema_annotated_impl_t *annotated_impl = NULL;
-
-    AXIS2_ENV_CHECK(env, NULL);
-    annotated_impl = INTF_TO_IMPL(annotated);
-
+    annotated_impl = AXIS2_INTF_TO_IMPL(annotated);
     return annotated_impl->schema_obj;
 }
 
@@ -217,6 +246,12 @@
     
     annotated->ops = AXIS2_MALLOC((*env)->allocator, 
             sizeof(axis2_xml_schema_annotated_ops_t));
+    
+    if(!annotated->ops)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
     annotated->ops->free = axis2_hash_get(methods, "free", 
             AXIS2_HASH_KEY_STRING);
     annotated->ops->get_base_impl = 
@@ -233,7 +268,7 @@
             annotated_impl_l->annotated.ops->get_unhandled_attrs;
     annotated->ops->set_unhandled_attrs = 
             annotated_impl_l->annotated.ops->set_unhandled_attrs;
-    
+
     return axis2_xml_schema_obj_resolve_methods(&(annotated->base), 
             env, annotated_impl_l->schema_obj, methods);
 }
@@ -243,7 +278,7 @@
                                         axis2_env_t **env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return INTF_TO_IMPL(annotated)->id;
+    return AXIS2_INTF_TO_IMPL(annotated)->id;
 }
 
 axis2_status_t AXIS2_CALL
@@ -254,7 +289,7 @@
     axis2_xml_schema_annotated_impl_t *annotated_impl = NULL;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    annotated_impl = INTF_TO_IMPL(annotated);
+    annotated_impl = AXIS2_INTF_TO_IMPL(annotated);
     if(annotated_impl->id)
     {
         AXIS2_FREE((*env)->allocator, annotated_impl->id);
@@ -270,7 +305,7 @@
                                         axis2_env_t **env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return INTF_TO_IMPL(annotated)->annotation;
+    return AXIS2_INTF_TO_IMPL(annotated)->annotation;
 }
 
 axis2_status_t AXIS2_CALL
@@ -282,10 +317,11 @@
     axis2_xml_schema_annotated_impl_t *annotated_impl = NULL;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    annotated_impl = INTF_TO_IMPL(annotated);
-    if(annotated_impl->annotation)
+    annotated_impl = AXIS2_INTF_TO_IMPL(annotated);
+    if(NULL != annotated_impl->annotation)
     {
         /* TODO Free annotation */
+        AXIS2_XML_SCHEMA_ANNOTATED_FREE(annotated_impl->annotation, env);
     }
     annotated_impl->annotation = annotation;
     return AXIS2_SUCCESS;
@@ -297,7 +333,7 @@
                                                 axis2_env_t **env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return INTF_TO_IMPL(annotated)->unhandled_attrs;
+    return AXIS2_INTF_TO_IMPL(annotated)->unhandled_attrs;
 }
 
 axis2_status_t AXIS2_CALL
@@ -309,7 +345,7 @@
     axis2_xml_schema_annotated_impl_t *annotated_impl = NULL;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    annotated_impl = INTF_TO_IMPL(annotated);
+    annotated_impl = AXIS2_INTF_TO_IMPL(annotated);
     if(annotated_impl->unhandled_attrs)
     {
         /* TODO Free unhandled_attrs */

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotation.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotation.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotation.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_annotation.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema_annotation.h>
+#include <axis2_xml_schema_annotation.h>
 
-typedef struct axis2_xml_schema_annotation_impl axis2_xml_schema_annotation_impl_t;
+typedef struct axis2_xml_schema_annotation_impl 
+                axis2_xml_schema_annotation_impl_t;
 
 /** 
  * @brief Other Extension Struct Impl
@@ -25,13 +26,18 @@
 struct axis2_xml_schema_annotation_impl
 {
     axis2_xml_schema_annotation_t annotation;
+    
     axis2_xml_schema_obj_t *schema_obj;
+    
     axis2_hash_t *items;
+    
     axis2_hash_t *methods;
 };
 
-#define INTF_TO_IMPL(annotation) ((axis2_xml_schema_annotation_impl_t *) annotation)
+#define AXIS2_INTF_TO_IMPL(annotation) \
+        ((axis2_xml_schema_annotation_impl_t *) annotation)
 
+/*************** function prototypes *****************************************/
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_annotation_free(void *annotation,
                         axis2_env_t **env);
@@ -44,6 +50,8 @@
 axis2_xml_schema_annotation_get_items(void *annotation,
                         axis2_env_t **env);
 
+/********************** end **************************************************/
+
 AXIS2_DECLARE(axis2_xml_schema_annotation_t *)
 axis2_xml_schema_annotation_create(axis2_env_t **env)
 {
@@ -52,29 +60,45 @@
     
     annotation_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_annotation_impl_t));
-
+    if(!annotation_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
     annotation_impl->schema_obj = NULL;
     annotation_impl->methods = NULL;
     annotation_impl->items = NULL;
+    annotation_impl->annotation.base.ops = NULL;
+    annotation_impl->annotation.ops      = NULL;
+    
     annotation_impl->annotation.ops = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_annotation_ops_t));
-
-    annotation_impl->annotation.ops->free = axis2_xml_schema_annotation_free;
+     if(!annotation_impl->annotation.ops)
+    {
+        axis2_xml_schema_annotation_free(&(annotation_impl->annotation), env);
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    annotation_impl->annotation.ops->free = 
+        axis2_xml_schema_annotation_free;
     annotation_impl->annotation.ops->get_base_impl = 
-            axis2_xml_schema_annotation_get_base_impl;
+        axis2_xml_schema_annotation_get_base_impl;
     annotation_impl->annotation.ops->get_items = 
-            axis2_xml_schema_annotation_get_items;
+        axis2_xml_schema_annotation_get_items;
    
+    annotation_impl->items = axis2_hash_make(env);
     if(!annotation_impl->items)
     {
-        annotation_impl->items = axis2_hash_make(env);
-        if(!annotation_impl->items)
-            return NULL;
-    }
-    
+        axis2_xml_schema_annotation_free(&(annotation_impl->annotation), env);
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    } 
+       
     annotation_impl->methods = axis2_hash_make(env);
     if(!annotation_impl->methods) 
     {
+        axis2_xml_schema_annotation_free(&(annotation_impl->annotation), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
@@ -84,45 +108,55 @@
             AXIS2_HASH_KEY_STRING, axis2_xml_schema_annotation_get_items);
 
     annotation_impl->schema_obj = axis2_xml_schema_obj_create(env);
-    status = 
-        axis2_xml_schema_obj_resolve_methods(&(annotation_impl->annotation.base), 
+    
+    if(!annotation_impl->schema_obj) 
+    {
+        axis2_xml_schema_annotation_free(&(annotation_impl->annotation), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    status =  axis2_xml_schema_obj_resolve_methods(&(annotation_impl->annotation.base), 
             env, annotation_impl->schema_obj, annotation_impl->methods);
     return &(annotation_impl->annotation);
 }
 
 axis2_status_t AXIS2_CALL
 axis2_xml_schema_annotation_free(void *annotation,
-                                    axis2_env_t **env)
+                                 axis2_env_t **env)
 {
     axis2_xml_schema_annotation_impl_t *annotation_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    annotation_impl = INTF_TO_IMPL(annotation);
+    annotation_impl = AXIS2_INTF_TO_IMPL(annotation);
 
-    if(annotation_impl->items)
+    if(NULL != annotation_impl->items)
     {
         axis2_hash_free(annotation_impl->items, env);
         annotation_impl->items = NULL;
     }
     
-    if(annotation_impl->methods)
+    if(NULL != annotation_impl->methods)
     {
         axis2_hash_free(annotation_impl->methods, env);
         annotation_impl->methods = NULL;
     }
 
-    if(annotation_impl->schema_obj)
+    if(NULL != annotation_impl->schema_obj)
     {
         AXIS2_XML_SCHEMA_OBJ_FREE(annotation_impl->schema_obj, env);
         annotation_impl->schema_obj = NULL;
     }
     
-    if((&(annotation_impl->annotation))->ops)
+    if(NULL != annotation_impl->annotation.ops)
     {
-        AXIS2_FREE((*env)->allocator, (&(annotation_impl->annotation))->ops);
-        (&(annotation_impl->annotation))->ops = NULL;
+        AXIS2_FREE((*env)->allocator, annotation_impl->annotation.ops);
+        annotation_impl->annotation.ops = NULL;
+    }
+    if(NULL != annotation_impl->annotation.base.ops)
+    {
+        AXIS2_FREE((*env)->allocator, annotation_impl->annotation.base.ops);
+        annotation_impl->annotation.base.ops = NULL;
     }
-
     if(annotation_impl)
     {
         AXIS2_FREE((*env)->allocator, annotation_impl);
@@ -138,7 +172,7 @@
     axis2_xml_schema_annotation_impl_t *annotation_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    annotation_impl = INTF_TO_IMPL(annotation);
+    annotation_impl = AXIS2_INTF_TO_IMPL(annotation);
 
     return annotation_impl->schema_obj;
 }
@@ -162,6 +196,7 @@
             sizeof(axis2_xml_schema_annotation_ops_t));
     annotation->ops->free = axis2_hash_get(methods, "free", 
             AXIS2_HASH_KEY_STRING);
+            
     annotation->ops->get_base_impl = 
             annotation_impl_l->annotation.ops->get_base_impl;
     annotation->ops->get_items = 
@@ -175,6 +210,6 @@
 axis2_xml_schema_annotation_get_items(void *annotation,
                                         axis2_env_t **env)
 {
-    return INTF_TO_IMPL(annotation)->items;
+    return AXIS2_INTF_TO_IMPL(annotation)->items;
 }
 

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_any.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_any.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_any.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_any.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema_any.h>
+#include <axis2_xml_schema_any.h>
 
-typedef struct axis2_xml_schema_any_impl axis2_xml_schema_any_impl_t;
+typedef struct axis2_xml_schema_any_impl 
+                axis2_xml_schema_any_impl_t;
 
 /** 
  * @brief Other Extension Struct Impl
@@ -25,17 +26,21 @@
 struct axis2_xml_schema_any_impl
 {
     axis2_xml_schema_any_t any;
+    
     axis2_xml_schema_particle_t *particle;
+    
     axis2_hash_t *methods;
+    
     axis2_xml_schema_content_processing_t *process_content;
     /**
      * Namespaces containing the elements that can be used.
      */
-    axis2_char_t *namespc;
+    axis2_char_t *ns;
 };
 
-#define INTF_TO_IMPL(any) ((axis2_xml_schema_any_impl_t *) any)
+#define AXIS2_INTF_TO_IMPL(any) ((axis2_xml_schema_any_impl_t *) any)
 
+/******************* function prototypes **********************************/
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_any_free(void *any,
                         axis2_env_t **env);
@@ -62,6 +67,8 @@
                                             axis2_env_t **env,
                                             axis2_xml_schema_content_processing_t *
                                                 process_content);
+                                                
+ /************************ end function prototypes ******************************/
  
 AXIS2_DECLARE(axis2_xml_schema_any_t *)
 axis2_xml_schema_any_create(axis2_env_t **env)
@@ -71,25 +78,47 @@
     
     any_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_any_impl_t));
-
+    if(!any_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    any_impl->any.base.ops = NULL;
+    any_impl->any.ops = NULL;
+    any_impl->ns = NULL;
     any_impl->particle = NULL;
-    any_impl->namespc = NULL;
     any_impl->process_content = NULL;
     any_impl->methods = NULL;
     any_impl->any.ops = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_any_ops_t));
 
+    if(!any_impl->any.ops)
+    {
+        axis2_xml_schema_any_free(&(any_impl->any), env);
+        AXIS2_ERROR_SET((*env)->error , 
+            AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
     any_impl->process_content = axis2_xml_schema_content_processing_create(env, 
             "None");
-    any_impl->any.ops->free = axis2_xml_schema_any_free;
-    any_impl->any.ops->get_base_impl = axis2_xml_schema_any_get_base_impl;
-    any_impl->any.ops->get_namespace = axis2_xml_schema_any_get_namespace;
-    any_impl->any.ops->set_namespace = axis2_xml_schema_any_set_namespace;
+    if(!any_impl->process_content)
+    {
+        axis2_xml_schema_any_free(&(any_impl->any), env);
+        return NULL;
+    }            
+    any_impl->any.ops->free = 
+        axis2_xml_schema_any_free;
+    any_impl->any.ops->get_base_impl = 
+        axis2_xml_schema_any_get_base_impl;
+    any_impl->any.ops->get_namespace = 
+        axis2_xml_schema_any_get_namespace;
+    any_impl->any.ops->set_namespace = 
+        axis2_xml_schema_any_set_namespace;
     any_impl->any.ops->get_process_content = 
-            axis2_xml_schema_any_get_process_content;
+        axis2_xml_schema_any_get_process_content;
     any_impl->any.ops->set_process_content = 
-            axis2_xml_schema_any_set_process_content;
-   
+        axis2_xml_schema_any_set_process_content;
+
     any_impl->methods = axis2_hash_make(env);
     if(!any_impl->methods)
     {
@@ -108,6 +137,12 @@
             AXIS2_HASH_KEY_STRING, axis2_xml_schema_any_set_process_content);
     
     any_impl->particle = axis2_xml_schema_particle_create(env);
+    if(!any_impl->methods)
+    {
+        axis2_xml_schema_any_free(&(any_impl->any), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
     status = axis2_xml_schema_particle_resolve_methods(
             &(any_impl->any.base), env, any_impl->particle, 
             any_impl->methods); 
@@ -121,43 +156,45 @@
     axis2_xml_schema_any_impl_t *any_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    any_impl = INTF_TO_IMPL(any);
+    any_impl = AXIS2_INTF_TO_IMPL(any);
 
-    if(any_impl->namespc)
+    if(NULL != any_impl->ns)
     {
-        AXIS2_FREE((*env)->allocator, any_impl->namespc);
-        any_impl->namespc = NULL;
+        AXIS2_FREE((*env)->allocator, any_impl->ns);
+        any_impl->ns = NULL;
     }
     
-    if(any_impl->process_content)
+    if(NULL != any_impl->process_content)
     {
         AXIS2_XML_SCHEMA_CONTENT_PROCESSING_FREE(any_impl->process_content, env);
         any_impl->process_content = NULL;
     }
  
-    if(any_impl->methods)
+    if(NULL != any_impl->methods)
     {
         axis2_hash_free(any_impl->methods, env);
         any_impl->methods = NULL;
     }
    
-    if(any_impl->particle)
+    if(NULL != any_impl->particle)
     {
-        AXIS2_XML_SCHEMA_OBJ_FREE(any_impl->particle, env);
+        AXIS2_XML_SCHEMA_PARTICLE_FREE(any_impl->particle, env);
         any_impl->particle = NULL;
     }
     
-    if((&(any_impl->any))->ops)
+    if(NULL != any_impl->any.ops)
     {
-        AXIS2_FREE((*env)->allocator, (&(any_impl->any))->ops);
-        (&(any_impl->any))->ops = NULL;
+        AXIS2_FREE((*env)->allocator, any_impl->any.ops);
+        any_impl->any.ops = NULL;
     }
-
-    if(any_impl)
+    if(NULL != any_impl->any.base.ops)
     {
-        AXIS2_FREE((*env)->allocator, any_impl);
-        any_impl = NULL;
+        AXIS2_FREE((*env)->allocator, any_impl->any.base.ops);
+        any_impl->any.base.ops = NULL;    
     }
+
+    AXIS2_FREE((*env)->allocator, any_impl);
+    any_impl = NULL;
     return AXIS2_SUCCESS;
 }
 
@@ -168,8 +205,7 @@
     axis2_xml_schema_any_impl_t *any_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    any_impl = INTF_TO_IMPL(any);
-
+    any_impl = AXIS2_INTF_TO_IMPL(any);
     return any_impl->particle;
 }
 
@@ -211,7 +247,7 @@
 axis2_xml_schema_any_get_namespace(void *any,
                                     axis2_env_t **env)
 {
-    return INTF_TO_IMPL(any)->namespc;
+    return AXIS2_INTF_TO_IMPL(any)->ns;
 }
 
 axis2_status_t AXIS2_CALL
@@ -222,14 +258,14 @@
     axis2_xml_schema_any_impl_t *any_impl = NULL;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    any_impl = INTF_TO_IMPL(any);
+    any_impl = AXIS2_INTF_TO_IMPL(any);
     
-    if(!any_impl->namespc)
+    if(!any_impl->ns)
     {
-        AXIS2_FREE((*env)->allocator, any_impl->namespc);
-        any_impl->namespc = NULL;
+        AXIS2_FREE((*env)->allocator, any_impl->ns);
+        any_impl->ns = NULL;
     }
-    any_impl->namespc = AXIS2_STRDUP(any_impl->namespc, env);
+    any_impl->ns = AXIS2_STRDUP(any_impl->ns, env);
     return AXIS2_SUCCESS;
 }
 
@@ -237,7 +273,7 @@
 axis2_xml_schema_any_get_process_content(void *any,
                                             axis2_env_t **env)
 {
-    return INTF_TO_IMPL(any)->process_content;
+    return AXIS2_INTF_TO_IMPL(any)->process_content;
 }
 
 axis2_status_t AXIS2_CALL
@@ -249,7 +285,7 @@
     axis2_xml_schema_any_impl_t *any_impl = NULL;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    any_impl = INTF_TO_IMPL(any);
+    any_impl = AXIS2_INTF_TO_IMPL(any);
     
     if(!any_impl->process_content)
     {

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_app_info.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_app_info.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_app_info.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_app_info.c Thu Apr 20 22:00:55 2006
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema_app_info.h>
+#include <axis2_xml_schema_app_info.h>
 
 typedef struct axis2_xml_schema_app_info_impl axis2_xml_schema_app_info_impl_t;
 
@@ -25,16 +25,20 @@
 struct axis2_xml_schema_app_info_impl
 {
     axis2_xml_schema_app_info_t app_info;
+    
     axis2_xml_schema_obj_t *schema_obj;
+    
     axis2_hash_t *methods;
     /**
      * Provides the source of the application information.
      */
     axis2_char_t *source;
+    
     void *markup; /* TODO Replace (void *) with node list */
 };
 
-#define INTF_TO_IMPL(app_info) ((axis2_xml_schema_app_info_impl_t *) app_info)
+#define AXIS2_INTF_TO_IMPL(app_info) \
+        ((axis2_xml_schema_app_info_impl_t *) app_info)
 
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_app_info_free(void *app_info,
@@ -63,6 +67,7 @@
 axis2_xml_schema_app_info_set_markup(void *app_info,
                                         axis2_env_t **env,
                                         void *markup);
+/****************** end macros ***********************************************/
 
 AXIS2_DECLARE(axis2_xml_schema_app_info_t *)
 axis2_xml_schema_app_info_create(axis2_env_t **env)
@@ -72,29 +77,44 @@
     
     app_info_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_app_info_impl_t));
-
+    if(!app_info_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
     app_info_impl->schema_obj = NULL;
+    app_info_impl->app_info.base.ops = NULL;
+    app_info_impl->app_info.ops = NULL;
     app_info_impl->methods = NULL;
     app_info_impl->source = NULL;
     app_info_impl->markup = NULL;
+    
     app_info_impl->app_info.ops = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_app_info_ops_t));
-
-    app_info_impl->app_info.ops->free = axis2_xml_schema_app_info_free;
+    
+    if(!app_info_impl->app_info.ops)
+    {
+        axis2_xml_schema_app_info_free(&(app_info_impl->app_info), env);
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    app_info_impl->app_info.ops->free = 
+        axis2_xml_schema_app_info_free;
     app_info_impl->app_info.ops->get_base_impl = 
-            axis2_xml_schema_app_info_get_base_impl;
+        axis2_xml_schema_app_info_get_base_impl;
     app_info_impl->app_info.ops->get_source = 
-            axis2_xml_schema_app_info_get_source;
+        axis2_xml_schema_app_info_get_source;
     app_info_impl->app_info.ops->set_source = 
-            axis2_xml_schema_app_info_set_source;
+        axis2_xml_schema_app_info_set_source;
     app_info_impl->app_info.ops->get_markup = 
-            axis2_xml_schema_app_info_get_markup;
+        axis2_xml_schema_app_info_get_markup;
     app_info_impl->app_info.ops->set_markup = 
-            axis2_xml_schema_app_info_set_markup;
+        axis2_xml_schema_app_info_set_markup;
    
     app_info_impl->methods = axis2_hash_make(env);
     if(!app_info_impl->methods) 
     {
+        axis2_xml_schema_app_info_free(&(app_info_impl->app_info), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
@@ -110,6 +130,11 @@
             AXIS2_HASH_KEY_STRING, axis2_xml_schema_app_info_set_markup);
 
     app_info_impl->schema_obj = axis2_xml_schema_obj_create(env);
+    if(!app_info_impl->schema_obj) 
+    {
+        axis2_xml_schema_app_info_free(&(app_info_impl->app_info), env);
+        return NULL;
+    }
     status = 
         axis2_xml_schema_obj_resolve_methods(&(app_info_impl->app_info.base), 
             env, app_info_impl->schema_obj, app_info_impl->methods);
@@ -123,9 +148,9 @@
     axis2_xml_schema_app_info_impl_t *app_info_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    app_info_impl = INTF_TO_IMPL(app_info);
+    app_info_impl = AXIS2_INTF_TO_IMPL(app_info);
 
-    if(app_info_impl->source)
+    if(NULL != app_info_impl->source)
     {
         AXIS2_FREE((*env)->allocator, app_info_impl->source);
         app_info_impl->source = NULL;
@@ -133,25 +158,29 @@
 
     /* TODO Free markup */
     
-    if(app_info_impl->methods)
+    if(NULL != app_info_impl->methods)
     {
         axis2_hash_free(app_info_impl->methods, env);
         app_info_impl->methods = NULL;
     }
 
-    if(app_info_impl->schema_obj)
+    if(NULL != app_info_impl->schema_obj)
     {
         AXIS2_XML_SCHEMA_OBJ_FREE(app_info_impl->schema_obj, env);
         app_info_impl->schema_obj = NULL;
     }
     
-    if((&(app_info_impl->app_info))->ops)
+    if(NULL != app_info_impl->app_info.ops)
     {
-        AXIS2_FREE((*env)->allocator, (&(app_info_impl->app_info))->ops);
-        (&(app_info_impl->app_info))->ops = NULL;
+        AXIS2_FREE((*env)->allocator, app_info_impl->app_info.ops);
+        app_info_impl->app_info.ops = NULL;
     }
-
-    if(app_info_impl)
+    if(NULL != app_info_impl->app_info.base.ops)
+    {
+        AXIS2_FREE((*env)->allocator, app_info_impl->app_info.base.ops);
+        app_info_impl->app_info.base.ops = NULL;    
+    }
+    if(NULL != app_info_impl)
     {
         AXIS2_FREE((*env)->allocator, app_info_impl);
         app_info_impl = NULL;
@@ -166,7 +195,7 @@
     axis2_xml_schema_app_info_impl_t *app_info_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    app_info_impl = INTF_TO_IMPL(app_info);
+    app_info_impl = AXIS2_INTF_TO_IMPL(app_info);
 
     return app_info_impl->schema_obj;
 }
@@ -188,6 +217,12 @@
     
     app_info->ops = AXIS2_MALLOC((*env)->allocator, 
             sizeof(axis2_xml_schema_app_info_ops_t));
+            
+     if(!app_info_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }        
     app_info->ops->free = axis2_hash_get(methods, "free", 
             AXIS2_HASH_KEY_STRING);
     app_info->ops->get_base_impl = 
@@ -210,7 +245,7 @@
                                         axis2_env_t **env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return INTF_TO_IMPL(app_info)->source;
+    return AXIS2_INTF_TO_IMPL(app_info)->source;
 }
 
 axis2_status_t AXIS2_CALL
@@ -221,9 +256,9 @@
     axis2_xml_schema_app_info_impl_t *app_info_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, source, AXIS2_FAILURE);
-    app_info_impl = INTF_TO_IMPL(app_info);
+    app_info_impl = AXIS2_INTF_TO_IMPL(app_info);
     
-    if(app_info_impl->source)
+    if(NULL != app_info_impl->source)
     {
         AXIS2_FREE((*env)->allocator, app_info_impl->source);
         app_info_impl->source = NULL;
@@ -243,7 +278,7 @@
                                         axis2_env_t **env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return INTF_TO_IMPL(app_info)->markup;
+    return AXIS2_INTF_TO_IMPL(app_info)->markup;
 }
 
 /* TODO replace (void *) mark up with node list */
@@ -255,7 +290,7 @@
     axis2_xml_schema_app_info_impl_t *app_info_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, markup, AXIS2_FAILURE);
-    app_info_impl = INTF_TO_IMPL(app_info);
+    app_info_impl = AXIS2_INTF_TO_IMPL(app_info);
     
     app_info_impl->markup = markup;
     return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_choice.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_choice.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_choice.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_choice.c Thu Apr 20 22:00:55 2006
@@ -14,10 +14,11 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema_choice.h>
-#include <xml_schema/axis2_xml_schema_group_base.h>
+#include <axis2_xml_schema_choice.h>
+#include <axis2_xml_schema_group_base.h>
 
-typedef struct axis2_xml_schema_choice_impl axis2_xml_schema_choice_impl_t;
+typedef struct axis2_xml_schema_choice_impl 
+                axis2_xml_schema_choice_impl_t;
 
 /** 
  * @brief Other Extension Struct Impl
@@ -26,12 +27,18 @@
 struct axis2_xml_schema_choice_impl
 {
     axis2_xml_schema_choice_t choice;
+    
     axis2_xml_schema_group_base_t *base;
+    
     axis2_hash_t *methods;
+    
     axis2_xml_schema_obj_collection_t *items;
 };
 
-#define INTF_TO_IMPL(choice) ((axis2_xml_schema_choice_impl_t *) choice)
+#define AXIS2_INTF_TO_IMPL(choice) \
+        ((axis2_xml_schema_choice_impl_t *) choice)
+
+/********************* function prototypes ************************************/
 
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_choice_free(void *choice,
@@ -45,6 +52,7 @@
 axis2_xml_schema_choice_get_items(void *choice,
                                 axis2_env_t **env);
 
+/******************** end function prototypes ********************************/
 
 AXIS2_DECLARE(axis2_xml_schema_choice_t *)
 axis2_xml_schema_choice_create(axis2_env_t **env)
@@ -54,35 +62,58 @@
 
     choice_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_choice_impl_t));
-
+    if(!choice_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error , 
+            AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
     choice_impl->base = NULL;
     choice_impl->methods = NULL;
     choice_impl->items = NULL;
+    choice_impl->choice.base.ops = NULL;
+    choice_impl->choice.ops = NULL;
+    
     choice_impl->choice.ops = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_choice_ops_t));
-
-    choice_impl->choice.ops->free = axis2_xml_schema_choice_free;
+    if(!choice_impl->choice.ops)
+    {
+        axis2_xml_schema_choice_free(&(choice_impl->choice), env);
+        AXIS2_ERROR_SET((*env)->error , 
+            AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    choice_impl->choice.ops->free = 
+        axis2_xml_schema_choice_free;
     choice_impl->choice.ops->get_base_impl = 
-            axis2_xml_schema_choice_get_base_impl;
+        axis2_xml_schema_choice_get_base_impl;
     choice_impl->choice.ops->get_items = 
-            axis2_xml_schema_choice_get_items;
+        axis2_xml_schema_choice_get_items;
    
     choice_impl->methods = axis2_hash_make(env);
     if(!choice_impl->methods)
     {
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        axis2_xml_schema_choice_free(&(choice_impl->choice), env);
+        AXIS2_ERROR_SET((*env)->error, 
+            AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+    
     axis2_hash_set(choice_impl->methods, "free", AXIS2_HASH_KEY_STRING, 
-            axis2_xml_schema_choice_free);
+       axis2_xml_schema_choice_free);
     axis2_hash_set(choice_impl->methods, "get_items", 
-            AXIS2_HASH_KEY_STRING, axis2_xml_schema_choice_get_items);
+       AXIS2_HASH_KEY_STRING, axis2_xml_schema_choice_get_items);
     
     choice_impl->base = axis2_xml_schema_group_base_create(env);
+    if(!choice_impl->base)
+    {
+        axis2_xml_schema_choice_free(&(choice_impl->choice), env);
+        return NULL;
+    }
     status = axis2_xml_schema_group_base_resolve_methods(
             &(choice_impl->choice.base), env, choice_impl->base, 
             choice_impl->methods);
-    
     return &(choice_impl->choice);
 }
 
@@ -93,33 +124,37 @@
     axis2_xml_schema_choice_impl_t *choice_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    choice_impl = INTF_TO_IMPL(choice);
+    choice_impl = AXIS2_INTF_TO_IMPL(choice);
 
-    if(choice_impl->items)
+    if(NULL != choice_impl->items)
     {
         AXIS2_XML_SCHEMA_OBJ_COLLECTION_FREE(choice_impl->items, env);
         choice_impl->items = NULL;
     }
     
-    if(choice_impl->methods)
+    if(NULL != choice_impl->methods)
     {
         axis2_hash_free(choice_impl->methods, env);
         choice_impl->methods = NULL;
     }
 
-    if(choice_impl->base)
+    if(NULL != choice_impl->base)
     {
         AXIS2_XML_SCHEMA_GROUP_BASE_FREE(choice_impl->base, env);
         choice_impl->base = NULL;
     }
     
-    if((&(choice_impl->choice))->ops)
+    if(NULL != choice_impl->choice.ops)
     {
-        AXIS2_FREE((*env)->allocator, (&(choice_impl->choice))->ops);
-        (&(choice_impl->choice))->ops = NULL;
+        AXIS2_FREE((*env)->allocator, choice_impl->choice.ops);
+        choice_impl->choice.ops = NULL;
     }
-
-    if(choice_impl)
+    if(NULL != choice_impl->choice.base.ops)
+    {
+        AXIS2_FREE((*env)->allocator, choice_impl->choice.base.ops);
+        choice_impl->choice.base.ops = NULL;
+    }
+    if(NULL != choice_impl)
     {
         AXIS2_FREE((*env)->allocator, choice_impl);
         choice_impl = NULL;
@@ -134,8 +169,7 @@
     axis2_xml_schema_choice_impl_t *choice_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    choice_impl = INTF_TO_IMPL(choice);
-
+    choice_impl = AXIS2_INTF_TO_IMPL(choice);
     return choice_impl->base;
 }
 
@@ -171,7 +205,7 @@
 axis2_xml_schema_choice_get_items(void *choice,
                                     axis2_env_t **env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    return INTF_TO_IMPL(choice)->items;
+    AXIS2_ENV_CHECK(env, NULL);
+    return AXIS2_INTF_TO_IMPL(choice)->items;
 }
 

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_collection.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_collection.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_collection.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_collection.c Thu Apr 20 22:00:55 2006
@@ -14,17 +14,18 @@
  * limitations under the License.
  */
  
-#include <xml_schema/axis2_xml_schema_collection.h>
-#include <xml_schema/axis2_xml_schema_element.h>
-#include <xml_schema/axis2_xml_schema_type.h>
-#include <xml_schema/axis2_xml_schema.h>
-#include <xml_schema/axis2_validation_event_handler.h> 
+#include <axis2_xml_schema_collection.h>
+#include <axis2_xml_schema_element.h>
+#include <axis2_xml_schema_type.h>
+#include <axis2_xml_schema.h>
+#include <axis2_validation_event_handler.h> 
 #include <axis2_hash.h>
-#include <xml_schema/axis2_xml_schema_type.h>
-#include <xml_schema/axis2_xml_schema_type_receiver.h>
-#include <xml_schema/axis2_xml_schema_element.h>
+#include <axis2_xml_schema_type.h>
+#include <axis2_xml_schema_type_receiver.h>
+#include <axis2_xml_schema_element.h>
 
-typedef struct axis2_xml_schema_collection_impl axis2_xml_schema_collection_impl_t;
+typedef struct axis2_xml_schema_collection_impl 
+                axis2_xml_schema_collection_impl_t;
 
 /** 
  * @brief Xml Schema Obj Struct Impl
@@ -34,9 +35,8 @@
 {
     axis2_xml_schema_collection_t collection;
     /**
-     * Namespaces we know about.  Each one has an equivalent XmlSchema.
      */
-    axis2_hash_t *namespcs;
+    axis2_hash_t *namespaces;
     /**
      * base URI is used as the base for loading the
      * imports
@@ -45,127 +45,126 @@
     /**
      * In-scope namespaces for XML processing
      */
-    axis2_hash_t *in_scope_namespcs;
+    axis2_hash_t *in_scope_namespaces;
+    
     axis2_xml_schema_t *xml_schema;
+    
     axis2_hash_t *unresolved_types;
 };
 
-#define INTF_TO_IMPL(collection) ((axis2_xml_schema_collection_impl_t *) collection)
+#define AXIS2_INTF_TO_IMPL(collection) \
+        ((axis2_xml_schema_collection_impl_t *) collection)
 
-axis2_status_t AXIS2_CALL 
-axis2_xml_schema_collection_free(void *collection,
-                axis2_env_t **env);
 
-/**
- * Set the base URI. This is used when schemas need to be
- * loaded from relative locations
- * @param base_uri
- */
-axis2_status_t AXIS2_CALL 
-axis2_xml_schema_collection_set_base_uri(void *collection,
-                                            axis2_env_t **env,
-                                            axis2_char_t *base_uri);
+/************* function prototypes *******************************************/
 
-/**
- * This section should comply to the XMLSchema specification
- * @see http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes
- *
- * This needs to be inspected by another pair of eyes
- */
-axis2_status_t AXIS2_CALL 
-axis2_xml_schema_collection_init(void *collection,
-                                    axis2_env_t **env);
 
-static axis2_status_t add_simple_type(void *collection,
-                                        axis2_env_t **env,
-                                        axis2_xml_schema_t *schema,
-                                        axis2_char_t *type_name);
+axis2_status_t AXIS2_CALL
+axis2_xml_schema_collection_free(axis2_xml_schema_collection_t* collection,
+                                 axis2_env_t **env);
 
-axis2_xml_schema_t *AXIS2_CALL
-axis2_xml_schema_collection_read_a_reader_and_validation_event_handler(
-                                            void *collection,
-                                            axis2_env_t **env,
-                                            void *reader, 
-                                            axis2_xml_schema_validation_event_handler_t *veh); 
+axis2_status_t AXIS2_CALL
+axis2_xml_schema_collection_set_base_uri
+                  (axis2_xml_schema_collection_t* collection,
+                   axis2_env_t **env,
+                   axis2_char_t *base_uri);
+                   
+axis2_status_t AXIS2_CALL
+axis2_xml_schema_collection_init(axis2_xml_schema_collection_t* collection,
+                                 axis2_env_t **env);
 
-axis2_xml_schema_t *AXIS2_CALL
+
+struct axis2_xml_schema* AXIS2_CALL
+axis2_xml_schema_collection_read_a_reader_and_validation_event_handler(
+                            axis2_xml_schema_collection_t* collection,
+                            axis2_env_t **env,
+                            void *reader, 
+                            axis2_validation_event_handler_t *veh); 
+                            
+struct axis2_xml_schema* AXIS2_CALL
 axis2_xml_schema_collection_read_a_input_source_and_validation_event_handler(
-                                            void *collection,
-                                            axis2_env_t **env,
-                                            void *input_source, 
-                                            axis2_xml_schema_validation_event_handler_t *veh);
+                                axis2_xml_schema_collection_t* collection,
+                                axis2_env_t **env,
+                                void *input_source, 
+                                axis2_validation_event_handler_t *veh);
 
-axis2_xml_schema_t *AXIS2_CALL
+struct axis2_xml_schema *   AXIS2_CALL
 axis2_xml_schema_collection_read_a_source_and_validation_event_handler(
-                                            void *collection,
-                                            axis2_env_t **env,
-                                            void *source, 
-                                            axis2_xml_schema_validation_event_handler_t *veh); 
-
-axis2_xml_schema_t *AXIS2_CALL
-axis2_xml_schema_collection_read_a_document_and_validation_event_handler(
-                                            void *collection,
-                                            axis2_env_t **env,
-                                            void *source, 
-                                            axis2_xml_schema_validation_event_handler_t *veh);
-
-axis2_xml_schema_t *AXIS2_CALL
-axis2_xml_schema_collection_read_a_element(
-                                            void *collection,
-                                            axis2_env_t **env,
-                                            axis2_om_element_t *element, 
-                                            axis2_om_node_t *node);
-
-axis2_xml_schema_t *AXIS2_CALL
-axis2_xml_schema_collection_read_a_document_and_uri_and_validation_event_handler(
-                                            void *collection,
-                                            axis2_env_t **env,
-                                            void *document,
-                                            axis2_char_t *uri,
-                                            axis2_xml_schema_validation_event_handler_t *veh); 
-
-axis2_xml_schema_t *AXIS2_CALL
-axis2_xml_schema_collection_read_a_element_and_uri(
-                                            void *collection,
-                                            axis2_env_t **env,
-                                            axis2_om_element_t *element,
-                                            axis2_om_node_t *node,
-                                            axis2_char_t *uri);
-
-axis2_xml_schema_element_t *AXIS2_CALL
-axis2_xml_schema_collection_get_element_by_qname(void *collection,
-                                                 axis2_env_t **env,
-                                                 axis2_qname_t *qname);
+                                axis2_xml_schema_collection_t* collection,
+                                axis2_env_t **env,
+                                void *source, 
+                                axis2_validation_event_handler_t *veh); 
+
+struct axis2_xml_schema * AXIS2_CALL
+axis2_xml_schema_collection_read_a_document_and_validation_event_handler (
+                                axis2_xml_schema_collection_t* collection,
+                                axis2_env_t **env,
+                                void *document, 
+                                axis2_validation_event_handler_t *veh);
+
+struct axis2_xml_schema * AXIS2_CALL
+axis2_xml_schema_collection_read_a_element
+                    (axis2_xml_schema_collection_t* collection,
+                     axis2_env_t **env,
+                     struct axis2_om_node *node);
+
+struct axis2_xml_schema* AXIS2_CALL
+axis2_xml_schema_collection_read_a_document_uri_and_validation_event_handler
+                         (axis2_xml_schema_collection_t* collection,
+                        axis2_env_t **env,
+                        void *document,
+                        axis2_char_t *uri,
+                        axis2_validation_event_handler_t *veh); 
+
+struct axis2_xml_schema * AXIS2_CALL
+axis2_xml_schema_collection_read_a_element_and_uri
+                           (axis2_xml_schema_collection_t* collection,
+                             axis2_env_t **env,
+                             struct axis2_om_node *node,
+                             axis2_char_t *uri);
+
+struct axis2_xml_schema_element * AXIS2_CALL
+axis2_xml_schema_collection_get_element_by_qname
+                       (axis2_xml_schema_collection_t* collection,
+                        axis2_env_t **env,
+                        axis2_qname_t *qname);
 
-axis2_xml_schema_type_t *AXIS2_CALL
-axis2_xml_schema_collection_get_type_by_qname(void *collection,
-                                             axis2_env_t **env,
-                                             axis2_qname_t *schema_type_qname);
+struct axis2_xml_schema_type * AXIS2_CALL
+axis2_xml_schema_collection_get_type_by_qname
+                   (axis2_xml_schema_collection_t* collection,
+                    axis2_env_t **env,
+                    axis2_qname_t *schema_type_qname);
 
 
 axis2_status_t AXIS2_CALL
-axis2_xml_schema_collection_add_unresolved_type(void *collection,
-                                                axis2_env_t **env,
-                                                axis2_qname_t *qtype, 
-                                                axis2_xml_schema_type_receiver_t *receiver); 
-
-axis2_status_t AXIS2_CALL
-axis2_xml_schema_collection_resolve_type(void *collection,
-                                            axis2_env_t **env,
-                                            axis2_qname_t *type_qame, 
-                                         struct axis2_xml_schema_type *type); 
+axis2_xml_schema_collection_add_unresolved_type
+                       (axis2_xml_schema_collection_t* collection,
+                        axis2_env_t **env,
+                        axis2_qname_t *qtype, 
+                        struct axis2_xml_schema_type_receiver *receiver); 
 
-axis2_char_t *AXIS2_CALL 
-axis2_xml_schema_collection_get_namespace_for_prefix(void *collection,
-                                                    axis2_env_t **env,
-                                                    axis2_char_t *prefix); 
+axis2_status_t AXIS2_CALL 
+axis2_xml_schema_collection_resolve_type
+               (axis2_xml_schema_collection_t* collection,
+                axis2_env_t **env,
+                axis2_qname_t *type_qame, 
+                struct axis2_xml_schema_type *type); 
+
+axis2_char_t * AXIS2_CALL
+axis2_xml_schema_collection_get_namespace_for_prefix
+                (axis2_xml_schema_collection_t *collection,
+                 axis2_env_t **env,
+                 axis2_char_t *prefix); 
+                     
 
 axis2_status_t AXIS2_CALL
-axis2_xml_schema_collection_map_namespace(void *collection,
-                                            axis2_env_t **env,
-                                            axis2_char_t *prefix, 
-                                            axis2_char_t *namespc_uri);
-
+axis2_xml_schema_collection_map_namespace
+                (axis2_xml_schema_collection_t* collection,
+                 axis2_env_t **env,
+                 axis2_char_t *prefix, 
+                 axis2_char_t *namespc_uri);
+                    
+                    
 
 AXIS2_DECLARE(axis2_xml_schema_collection_t *)
 axis2_xml_schema_collection_create(axis2_env_t **env)
@@ -174,10 +173,29 @@
     
     collection_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_collection_impl_t));
-
+    if(!collection_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    collection_impl->base_uri  = NULL;
+    collection_impl->collection.ops = NULL;
+    collection_impl->in_scope_namespaces = NULL;
+    collection_impl->namespaces = NULL;
+    collection_impl->unresolved_types = NULL;
+    collection_impl->xml_schema = NULL;
+    
     collection_impl->collection.ops = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_collection_ops_t)); 
-
+    
+    if(!collection_impl->collection.ops)
+    {
+        axis2_xml_schema_collection_free(&(collection_impl->collection), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
     axis2_xml_schema_collection_init(&(collection_impl->collection), env);
 
     collection_impl->collection.ops->free = 
@@ -186,18 +204,24 @@
             axis2_xml_schema_collection_set_base_uri;
     collection_impl->collection.ops->init = 
             axis2_xml_schema_collection_init;
+            
     collection_impl->collection.ops->read_a_reader_and_validation_event_handler = 
             axis2_xml_schema_collection_read_a_reader_and_validation_event_handler;
+            
     collection_impl->collection.ops->read_a_input_source_and_validation_event_handler = 
             axis2_xml_schema_collection_read_a_input_source_and_validation_event_handler;
+            
     collection_impl->collection.ops->read_a_source_and_validation_event_handler = 
             axis2_xml_schema_collection_read_a_source_and_validation_event_handler;
+            
     collection_impl->collection.ops->read_a_document_and_validation_event_handler = 
             axis2_xml_schema_collection_read_a_document_and_validation_event_handler;
+            
     collection_impl->collection.ops->read_a_element = 
             axis2_xml_schema_collection_read_a_element;
-    collection_impl->collection.ops->read_a_document_and_uri_and_validation_event_handler= 
-            axis2_xml_schema_collection_read_a_document_and_uri_and_validation_event_handler;
+            
+    collection_impl->collection.ops->read_a_document_uri_and_validation_event_handler= 
+        axis2_xml_schema_collection_read_a_document_uri_and_validation_event_handler;
     collection_impl->collection.ops->read_a_element_and_uri = 
             axis2_xml_schema_collection_read_a_element_and_uri;
     collection_impl->collection.ops->get_element_by_qname = 
@@ -218,87 +242,20 @@
 
 
 axis2_status_t AXIS2_CALL
-axis2_xml_schema_collection_free(void *collection,
-                                        axis2_env_t **env)
+axis2_xml_schema_collection_free(axis2_xml_schema_collection_t *collection,
+                                 axis2_env_t **env)
 {
-    axis2_xml_schema_collection_impl_t *collection_impl = NULL;
-
-    collection_impl = INTF_TO_IMPL(collection);
-
-    if((&(collection_impl->collection))->ops)
-    {
-        free((&(collection_impl->collection))->ops);
-        (&(collection_impl->collection))->ops = NULL;
-    }
-
-    if(collection_impl)
+    if(NULL != collection->ops)
     {
-        free(collection_impl);
-        collection_impl = NULL;
+        AXIS2_FREE((*env)->allocator, collection->ops);
+        collection->ops = NULL;
     }
+    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(collection));
     return AXIS2_SUCCESS;
 }
 
-AXIS2_DECLARE(axis2_status_t)
-axis2_xml_schema_collection_resolve_methods(
-                        axis2_xml_schema_collection_t *collection,
-                        axis2_env_t **env,
-                        axis2_xml_schema_collection_t *collection_impl,
-                        axis2_hash_t *methods)
-{    
-    axis2_xml_schema_collection_impl_t *collection_impl_l = NULL;
-
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK((*env)->error, collection_impl, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
-    
-    collection_impl_l = (axis2_xml_schema_collection_impl_t *) collection_impl;
-    
-    collection->ops = AXIS2_MALLOC((*env)->allocator, 
-            sizeof(axis2_xml_schema_collection_ops_t));
-    collection->ops->free = axis2_hash_get(methods, "free", 
-            AXIS2_HASH_KEY_STRING);
-    collection->ops->set_base_uri = 
-            collection_impl_l->collection.ops->set_base_uri;
-    collection->ops->init = 
-            collection_impl_l->collection.ops->init; 
-    collection->ops->read_a_reader_and_validation_event_handler = 
-            collection_impl_l->collection.ops->read_a_reader_and_validation_event_handler; 
-    collection->ops->read_a_input_source_and_validation_event_handler = 
-            collection_impl_l->collection.ops->read_a_input_source_and_validation_event_handler; 
-    collection->ops->read_a_source_and_validation_event_handler = 
-            collection_impl_l->collection.ops->read_a_source_and_validation_event_handler; 
-    collection->ops->read_a_document_and_validation_event_handler = 
-            collection_impl_l->collection.ops->read_a_document_and_validation_event_handler; 
-    collection->ops->read_a_element = 
-            collection_impl_l->collection.ops->read_a_element; 
-    collection->ops->read_a_document_and_uri_and_validation_event_handler = 
-            collection_impl_l->collection.ops->read_a_document_and_uri_and_validation_event_handler; 
-    collection->ops->read_a_element_and_uri = 
-            collection_impl_l->collection.ops->read_a_element_and_uri; 
-    collection->ops->get_element_by_qname = 
-            collection_impl_l->collection.ops->get_element_by_qname; 
-    collection->ops->get_type_by_qname = 
-            collection_impl_l->collection.ops->get_type_by_qname; 
-    collection->ops->add_unresolved_type = 
-            collection_impl_l->collection.ops->add_unresolved_type; 
-    collection->ops->resolve_type = 
-            collection_impl_l->collection.ops->resolve_type; 
-    collection->ops->get_namespace_for_prefix = 
-            collection_impl_l->collection.ops->get_namespace_for_prefix; 
-    collection->ops->map_namespace = 
-            collection_impl_l->collection.ops->map_namespace; 
-    return AXIS2_SUCCESS;    
-
-}
-
-/**
- * Set the base URI. This is used when schemas need to be
- * loaded from relative locations
- * @param base_uri
- */
 axis2_status_t AXIS2_CALL 
-axis2_xml_schema_collection_set_base_uri(void *collection,
+axis2_xml_schema_collection_set_base_uri(axis2_xml_schema_collection_t*collection,
                                             axis2_env_t **env,
                                             axis2_char_t *base_uri)
 {
@@ -312,7 +269,7 @@
  * This needs to be inspected by another pair of eyes
  */
 axis2_status_t AXIS2_CALL 
-axis2_xml_schema_collection_init(void *collection,
+axis2_xml_schema_collection_init(axis2_xml_schema_collection_t   *collection,
                                     axis2_env_t **env) 
 {
     /*
@@ -374,7 +331,7 @@
     return AXIS2_SUCCESS;
 }
 
-static axis2_status_t add_simple_type(void *collection,
+static axis2_status_t add_simple_type(axis2_xml_schema_collection_t  *collection,
                                         axis2_env_t **env,
                                         axis2_xml_schema_t *schema,
                                         axis2_char_t *type_name)
@@ -384,70 +341,68 @@
 
 axis2_xml_schema_t *AXIS2_CALL
 axis2_xml_schema_collection_read_a_reader_and_validation_event_handler(
-                                            void *collection,
+                                            axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
-                                            void *reader, 
-                                            axis2_xml_schema_validation_event_handler_t *veh) 
+                                            axis2_xml_schema_collection_t  *reader, 
+                                            axis2_validation_event_handler_t *veh) 
 {
     return NULL;
 }
 
 axis2_xml_schema_t *AXIS2_CALL
 axis2_xml_schema_collection_read_a_input_source_and_validation_event_handler(
-                                            void *collection,
+                                            axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
-                                            void *input_source, 
-                                            axis2_xml_schema_validation_event_handler_t *veh) 
+                                            axis2_xml_schema_collection_t  *input_source, 
+                                            axis2_validation_event_handler_t *veh) 
 {
     return NULL;
 }
 
 axis2_xml_schema_t *AXIS2_CALL
 axis2_xml_schema_collection_read_a_source_and_validation_event_handler(
-                                            void *collection,
+                                            axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
-                                            void *source, 
-                                            axis2_xml_schema_validation_event_handler_t *veh) 
+                                            axis2_xml_schema_collection_t  *source, 
+                                            axis2_validation_event_handler_t *veh) 
 {
     return NULL;
 }
 
 axis2_xml_schema_t *AXIS2_CALL
 axis2_xml_schema_collection_read_a_document_and_validation_event_handler(
-                                            void *collection,
+                                            axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
                                             void *source, 
-                                            axis2_xml_schema_validation_event_handler_t *veh) 
+                                            axis2_validation_event_handler_t *veh) 
 {
     return NULL;
 }
 
 axis2_xml_schema_t *AXIS2_CALL
 axis2_xml_schema_collection_read_a_element(
-                                            void *collection,
+                                            axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
-                                            axis2_om_element_t *element, 
                                             axis2_om_node_t *node)
 {
     return NULL;
 }
 
 axis2_xml_schema_t *AXIS2_CALL
-axis2_xml_schema_collection_read_a_document_and_uri_and_validation_event_handler(
-                                            void *collection,
+axis2_xml_schema_collection_read_a_document_uri_and_validation_event_handler(
+                                            axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
                                             void *document,
                                             axis2_char_t *uri,
-                                            axis2_xml_schema_validation_event_handler_t *veh) 
+                                            axis2_validation_event_handler_t *veh) 
 {
     return NULL;
 }
 
 axis2_xml_schema_t *AXIS2_CALL
 axis2_xml_schema_collection_read_a_element_and_uri(
-                                            void *collection,
+                                            axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
-                                            axis2_om_element_t *element,
                                             axis2_om_node_t *node,
                                             axis2_char_t *uri) 
 {
@@ -455,7 +410,7 @@
 }
 
 axis2_xml_schema_element_t *AXIS2_CALL
-axis2_xml_schema_collection_get_element_by_qname(void *collection,
+axis2_xml_schema_collection_get_element_by_qname(axis2_xml_schema_collection_t  *collection,
                                                  axis2_env_t **env,
                                                  axis2_qname_t *qname) 
 {
@@ -463,7 +418,7 @@
 }
 
 axis2_xml_schema_type_t *AXIS2_CALL
-axis2_xml_schema_collection_get_type_by_qname(void *collection,
+axis2_xml_schema_collection_get_type_by_qname(axis2_xml_schema_collection_t  *collection,
                                              axis2_env_t **env,
                                              axis2_qname_t *schema_type_qname) 
 {
@@ -472,7 +427,7 @@
 
 
 axis2_status_t AXIS2_CALL
-axis2_xml_schema_collection_add_unresolved_type(void *collection,
+axis2_xml_schema_collection_add_unresolved_type(axis2_xml_schema_collection_t  *collection,
                                                 axis2_env_t **env,
                                                 axis2_qname_t *qtype, 
                                                 axis2_xml_schema_type_receiver_t *receiver) 
@@ -481,7 +436,7 @@
 }
 
 axis2_status_t AXIS2_CALL
-axis2_xml_schema_collection_resolve_type(void *collection,
+axis2_xml_schema_collection_resolve_type(axis2_xml_schema_collection_t  *collection,
                                          axis2_env_t **env,
                                          axis2_qname_t *type_qame, 
                                           struct axis2_xml_schema_type *type) 
@@ -490,7 +445,7 @@
 }
 
 axis2_char_t *AXIS2_CALL 
-axis2_xml_schema_collection_get_namespace_for_prefix(void *collection,
+axis2_xml_schema_collection_get_namespace_for_prefix(axis2_xml_schema_collection_t  *collection,
                                                     axis2_env_t **env,
                                                     axis2_char_t *prefix) 
 {
@@ -498,7 +453,7 @@
 }
 
 axis2_status_t AXIS2_CALL
-axis2_xml_schema_collection_map_namespace(void *collection,
+axis2_xml_schema_collection_map_namespace(axis2_xml_schema_collection_t  *collection,
                                             axis2_env_t **env,
                                             axis2_char_t *prefix, 
                                             axis2_char_t *namespc_uri)

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_content_processing.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_content_processing.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_content_processing.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_content_processing.c Thu Apr 20 22:00:55 2006
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <xml_schema/axis2_xml_schema_content_processing.h>
+#include <axis2_xml_schema_content_processing.h>
 
 typedef struct axis2_xml_schema_content_processing_impl 
         axis2_xml_schema_content_processing_impl_t;
@@ -26,12 +26,15 @@
 struct axis2_xml_schema_content_processing_impl
 {
     axis2_xml_schema_content_processing_t content_processing;
+    
     axis2_xml_schema_enum_t *schema_enum;
+    
     axis2_hash_t *methods;
+    
     axis2_array_list_t *members;
 };
 
-#define INTF_TO_IMPL(content_processing) \
+#define AXIS2_INTF_TO_IMPL(content_processing) \
         ((axis2_xml_schema_content_processing_impl_t *) content_processing)
 
 axis2_status_t AXIS2_CALL 
@@ -56,44 +59,66 @@
     
     content_processing_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_content_processing_impl_t));
-
+    if(!content_processing_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
     content_processing_impl->schema_enum = NULL;
+    content_processing_impl->content_processing.base.ops = NULL;
     content_processing_impl->methods = NULL;
     content_processing_impl->members = NULL;
+    content_processing_impl->content_processing.ops = NULL;
+    
     content_processing_impl->content_processing.ops = 
             AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_content_processing_ops_t));
-
+    if(!content_processing_impl->content_processing.ops)
+    {
+        axis2_xml_schema_content_processing_free(
+            &(content_processing_impl->content_processing), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;            
+    }
+    
     content_processing_impl->content_processing.ops->free = 
             axis2_xml_schema_content_processing_free;
     content_processing_impl->content_processing.ops->get_base_impl = 
             axis2_xml_schema_content_processing_get_base_impl;
+            
     content_processing_impl->content_processing.ops->get_values = 
             axis2_xml_schema_content_processing_get_values;
    
+    content_processing_impl->members = axis2_array_list_create(env, 0);
     if(!content_processing_impl->members)
     {
-        content_processing_impl->members = axis2_array_list_create(env, 0);
-        if(!content_processing_impl->members)
-            return NULL;
-        AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "Lax");
-        AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "None");
-        AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "Skip");
-        AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "Strict");
-    }
+         axis2_xml_schema_content_processing_free(
+            &(content_processing_impl->content_processing), env);
+        return NULL;
+    }   
+    AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "Lax");
+    AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "None");
+    AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "Skip");
+    AXIS2_ARRAY_LIST_ADD(content_processing_impl->members, env, "Strict");
     
     content_processing_impl->methods = axis2_hash_make(env);
     if(!content_processing_impl->methods)
     {
+         axis2_xml_schema_content_processing_free(
+            &(content_processing_impl->content_processing), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+
     axis2_hash_set(content_processing_impl->methods, "free", 
             AXIS2_HASH_KEY_STRING, axis2_xml_schema_content_processing_free);
+            
     axis2_hash_set(content_processing_impl->methods, "get_values", 
             AXIS2_HASH_KEY_STRING, axis2_xml_schema_content_processing_get_values);
     
     content_processing_impl->schema_enum = axis2_xml_schema_enum_create(env, NULL);
+    
     status = axis2_xml_schema_enum_resolve_methods(
             &(content_processing_impl->content_processing.base), env, 
             content_processing_impl->schema_enum, 
@@ -109,33 +134,50 @@
     axis2_xml_schema_content_processing_impl_t *content_processing_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    content_processing_impl = INTF_TO_IMPL(content_processing);
+    content_processing_impl = AXIS2_INTF_TO_IMPL(content_processing);
 
-    if(content_processing_impl->members)
-    {
+    if(NULL != content_processing_impl->members)
+    {   
+        int size = 0;
+        int i    = 0;
+        size = AXIS2_ARRAY_LIST_SIZE(content_processing_impl->members, env);
+        for(i = 0; i < size ; i++)
+        {
+            axis2_char_t *value = NULL;
+            value =(axis2_char_t* ) 
+                AXIS2_ARRAY_LIST_GET(content_processing_impl->members, env, i);
+            if(NULL != value)
+            {
+                AXIS2_FREE((*env)->allocator, value);
+                value = NULL;
+            }
+        }
         AXIS2_ARRAY_LIST_FREE(content_processing_impl->members, env);
         content_processing_impl->members = NULL;
     }
     
-    if(content_processing_impl->methods)
+    if(NULL != content_processing_impl->methods)
     {
         axis2_hash_free(content_processing_impl->methods, env);
         content_processing_impl->methods = NULL;
     }
-    if(content_processing_impl->schema_enum)
+    if(NULL != content_processing_impl->schema_enum)
     {
         AXIS2_XML_SCHEMA_ENUM_FREE(content_processing_impl->schema_enum, env);
         content_processing_impl->schema_enum = NULL;
     }
     
-    if((&(content_processing_impl->content_processing))->ops)
+    if(NULL != content_processing_impl->content_processing.ops)
     {
-        AXIS2_FREE((*env)->allocator, (&(content_processing_impl->
-                        content_processing))->ops);
-        (&(content_processing_impl->content_processing))->ops = NULL;
+        AXIS2_FREE((*env)->allocator, content_processing_impl->content_processing.ops);
+        content_processing_impl->content_processing.ops = NULL;
     }
-
-    if(content_processing_impl)
+    if(NULL != content_processing_impl->content_processing.base.ops)
+    {
+        AXIS2_FREE((*env)->allocator, content_processing_impl->content_processing.base.ops);
+        content_processing_impl->content_processing.base.ops = NULL;
+    }
+    if(NULL != content_processing_impl)
     {
         AXIS2_FREE((*env)->allocator, content_processing_impl);
         content_processing_impl = NULL;
@@ -150,7 +192,7 @@
     axis2_xml_schema_content_processing_impl_t *content_processing_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    content_processing_impl = INTF_TO_IMPL(content_processing);
+    content_processing_impl = AXIS2_INTF_TO_IMPL(content_processing);
 
     return content_processing_impl->schema_enum;
 }
@@ -189,6 +231,6 @@
 axis2_xml_schema_content_processing_get_values(void *content_processing,
                                         axis2_env_t **env)
 {
-    return INTF_TO_IMPL(content_processing)->members;
+    return AXIS2_INTF_TO_IMPL(content_processing)->members;
 }
 

Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_data_type.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_data_type.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_data_type.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_data_type.c Thu Apr 20 22:00:55 2006
@@ -14,11 +14,12 @@
  * limitations under the License.
  */
  
-#include <xml_schema/axis2_xml_schema_data_type.h>
-#include <xml_schema/axis2_xml_tokenized_type.h>
+#include <axis2_xml_schema_data_type.h>
+#include <axis2_xml_tokenized_type.h>
 #include <axis2_hash.h>
 
-typedef struct axis2_xml_schema_data_type_impl axis2_xml_schema_data_type_impl_t;
+typedef struct axis2_xml_schema_data_type_impl 
+            axis2_xml_schema_data_type_impl_t;
 
 /** 
  * @brief Xml Schema Data Type Struct Impl
@@ -29,7 +30,8 @@
     axis2_xml_schema_data_type_t data_type;
 };
 
-#define INTF_TO_IMPL(data_type) ((axis2_xml_schema_data_type_impl_t *) data_type)
+#define AXIS2_INTF_TO_IMPL(data_type) \
+        ((axis2_xml_schema_data_type_impl_t *) data_type)
 
 axis2_status_t AXIS2_CALL 
 axis2_xml_schema_data_type_free(void *data_type,
@@ -55,10 +57,17 @@
     
     data_type_impl = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_data_type_impl_t));
-
+    if(NULL != data_type_impl)
+    {
+        return NULL;
+    }
     data_type_impl->data_type.ops = AXIS2_MALLOC((*env)->allocator, 
                     sizeof(axis2_xml_schema_data_type_ops_t)); 
-
+     if(NULL != data_type_impl->data_type.ops)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
 
     data_type_impl->data_type.ops->free = axis2_xml_schema_data_type_free;
     data_type_impl->data_type.ops->parse_value = axis2_xml_schema_data_type_parse_value;
@@ -75,17 +84,17 @@
 {
     axis2_xml_schema_data_type_impl_t *data_type_impl = NULL;
 
-    data_type_impl = INTF_TO_IMPL(data_type);
+    data_type_impl = AXIS2_INTF_TO_IMPL(data_type);
 
-    if((&(data_type_impl->data_type))->ops)
+    if(data_type_impl->data_type.ops)
     {
-        free((&(data_type_impl->data_type))->ops);
-        (&(data_type_impl->data_type))->ops = NULL;
+        AXIS2_FREE((*env)->allocator ,data_type_impl->data_type.ops);
+        data_type_impl->data_type.ops = NULL;
     }
 
-    if(data_type_impl)
+    if(NULL != data_type_impl)
     {
-        free(data_type_impl);
+        AXIS2_FREE((*env)->allocator, data_type_impl);
         data_type_impl = NULL;
     }
     return AXIS2_SUCCESS;
@@ -127,7 +136,7 @@
     axis2_xml_schema_data_type_impl_t *data_type_impl = NULL;
     
     AXIS2_ENV_CHECK(env, NULL);
-    data_type_impl = INTF_TO_IMPL(data_type);
+    data_type_impl = AXIS2_INTF_TO_IMPL(data_type);
     return NULL;
 }
 
@@ -138,7 +147,7 @@
     axis2_xml_schema_data_type_impl_t *data_type_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    data_type_impl = INTF_TO_IMPL(data_type);
+    data_type_impl = AXIS2_INTF_TO_IMPL(data_type);
 
     return NULL;
 }
@@ -150,7 +159,7 @@
     axis2_xml_schema_data_type_impl_t *data_type_impl = NULL;
     
     AXIS2_ENV_CHECK(env, NULL);
-    data_type_impl = INTF_TO_IMPL(data_type);
+    data_type_impl = AXIS2_INTF_TO_IMPL(data_type);
     return NULL;
 }
 



Mime
View raw message