You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ka...@apache.org on 2007/03/22 12:16:56 UTC

svn commit: r521215 - in /webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n: c14n.c c14n_sorted_list.h sorted_list.c

Author: kaushalye
Date: Thu Mar 22 04:16:55 2007
New Revision: 521215

URL: http://svn.apache.org/viewvc?view=rev&rev=521215
Log:
JIRA AXIS2C-560. Applying the patch sent by Dumindu. 


Modified:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n_sorted_list.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/sorted_list.c

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c?view=diff&rev=521215&r1=521214&r2=521215
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c Thu Mar 22 04:16:55 2007
@@ -872,7 +872,7 @@
     c14n_output(">", ctx);
 
     c14n_ns_stack_pop(save_stack, ctx); /*restore to previous ns stack */
-    /*TODO: save_stack free*/
+    /*TODO:DONE??? save_stack free*/
     /*since save_stack is used just to memorize the head of the stack,
      * we don't have to worry about freeing its members*/
     
@@ -1040,15 +1040,18 @@
     
             if (v)
             {
-                AXIS2_SORTED_LIST_INSERT(&attr_list, v, ctx, attr_compare, 
+                C14N_SORTED_LIST_INSERT(&attr_list, v, ctx, attr_compare, 
                         ctx->env);
             }
         }
 
-        AXIS2_SORTED_LIST_ITERATE(attr_list, ctx, c14n_apply_on_attribute, 
+        C14N_SORTED_LIST_ITERATE(attr_list, ctx, c14n_apply_on_attribute, 
                 ctx->env);
     }
-    /*TODO: AXIS2_SORTED_LIST_FREE();*/
+    
+    /*TODO:DONE C14N_SORTED_LIST_FREE();*/
+    C14N_SORTED_LIST_FREE_CONTAINER(attr_list, ctx->env);
+    
     return AXIS2_SUCCESS;
 
     /* TODO: Still need to add the "xml" attrs of the parents in case of doc subsets
@@ -1068,7 +1071,7 @@
     axis2_char_t *old = NULL;
     int bufsz = INIT_BUFFER_SIZE;
 
-    /* TODO: a better buffer implementation */
+    /* TODO:DONE a better buffer implementation */
     buf = (axis2_char_t *)(AXIS2_MALLOC(ctx->env->allocator, 
                 (sizeof(axis2_char_t) * bufsz) + 10));
     if (!buf)
@@ -1157,7 +1160,7 @@
     axis2_char_t *old = NULL;
     int bufsz = INIT_BUFFER_SIZE;
 
-    /* TODO: a better buffer implementation */
+    /* TODO:DONE a better buffer implementation */
     buf = (axis2_char_t *)(AXIS2_MALLOC(ctx->env->allocator, 
                 sizeof(axis2_char_t) * INIT_BUFFER_SIZE + 10));
     if (!buf)
@@ -1292,7 +1295,7 @@
                         if (c14n_ns_stack_get_default(ctx)!=NULL)
                         {
                             c14n_ns_stack_set_default(ns, ctx);
-                            AXIS2_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
+                            C14N_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
                                     ns_prefix_compare, ctx->env);
                         }
                              
@@ -1309,7 +1312,7 @@
                         if (!prev_def_uri || axis2_strcmp(prev_def_uri, uri) != 0)
                         {
                             c14n_ns_stack_set_default(ns, ctx);
-                            AXIS2_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
+                            C14N_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
                                     ns_prefix_compare, ctx->env);
                         }
                     }
@@ -1318,16 +1321,18 @@
                 {
                     /*non-default namespace*/
                     c14n_ns_stack_add(ns, ctx);
-                    AXIS2_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
+                    C14N_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
                             ns_prefix_compare, ctx->env);
                 }
             }
         }
     }
     
-    AXIS2_SORTED_LIST_ITERATE(out_list, ctx, c14n_apply_on_namespace, ctx->env);
+    C14N_SORTED_LIST_ITERATE(out_list, ctx, c14n_apply_on_namespace, ctx->env);
+    
+    C14N_SORTED_LIST_FREE_CONTAINER(out_list, ctx->env);
     
-    /*TODO: AXIS2_SORTED_LIST_FREE();*/
+    /*TODO:DONE C14N_SORTED_LIST_FREE();*/
     return AXIS2_SUCCESS;
 }
 
@@ -1366,7 +1371,7 @@
                 if (ns_uri_compare(ns, def_ns, ctx) != 0)
                 {
                     c14n_ns_stack_set_default(ns, ctx);
-                    AXIS2_SORTED_LIST_INSERT(&out_list, (void *)ns,
+                    C14N_SORTED_LIST_INSERT(&out_list, (void *)ns,
                             ctx, ns_prefix_compare, ctx->env);
                 }
             }
@@ -1407,7 +1412,7 @@
                         if (c14n_need_to_declare_ns(ele, node, ns, ctx))
                         {
                             c14n_ns_stack_add(ns, ctx);
-                            AXIS2_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
+                            C14N_SORTED_LIST_INSERT(&out_list, (void *)ns, ctx,
                                     ns_prefix_compare, ctx->env);
                         }
                     }
@@ -1416,10 +1421,11 @@
         }
         pnode = AXIOM_NODE_GET_PARENT((axiom_node_t *)pnode, ctx->env);
     } /*while*/
-    AXIS2_SORTED_LIST_ITERATE(out_list, ctx, c14n_apply_on_namespace , ctx->env);
+    C14N_SORTED_LIST_ITERATE(out_list, ctx, c14n_apply_on_namespace , ctx->env);
     
+    C14N_SORTED_LIST_FREE_CONTAINER(out_list, ctx->env);
 
-    /*TODO: AXIS2_SORTED_LIST_FREE();*/
+    /*TODO:DONE C14N_SORTED_LIST_FREE();*/
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n_sorted_list.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n_sorted_list.h?view=diff&rev=521215&r1=521214&r2=521215
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n_sorted_list.h (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n_sorted_list.h Thu Mar 22 04:16:55 2007
@@ -49,18 +49,28 @@
         const axis2_env_t *env
         );
 
+    void
+    sorted_list_free_container(
+        c14n_sorted_list_t *root,
+        const axis2_env_t *env
+        );
+
 #ifdef __cplusplus
 }
 #endif
 
-#define AXIS2_SORTED_LIST_INSERT(list, val, ctx, compar, env)\
+#define C14N_SORTED_LIST_INSERT(list, val, ctx, compar, env)\
     sorted_list_insert(list, val, ctx, compar)
 
 #define c14n_sorted_list_create(env) NULL
 
-#define AXIS2_SORTED_LIST_FREE(list, fp_free, env) sorted_list_free(list, fp_free)
+#define C14N_SORTED_LIST_FREE(list, fp_free, env) sorted_list_free(list, fp_free)
 
-#define AXIS2_SORTED_LIST_ITERATE(list, ctx, fp_perform, env)\
+#define C14N_SORTED_LIST_ITERATE(list, ctx, fp_perform, env)\
     sorted_list_iterate(list, ctx, fp_perform, env)
+
+#define C14N_SORTED_LIST_FREE_CONTAINER(list, env)\
+    sorted_list_free_container(list, env);\
+    AXIS2_FREE(env->allocator, list)
 
 #endif

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/sorted_list.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/sorted_list.c?view=diff&rev=521215&r1=521214&r2=521215
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/sorted_list.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/sorted_list.c Thu Mar 22 04:16:55 2007
@@ -65,6 +65,26 @@
    else; /*neglect if the same ns*/
 }
 
+void
+sorted_list_free_container(
+    c14n_sorted_list_t *root,
+    const axis2_env_t *env
+    )
+{
+    if (!root) return;
+    if (root->left) 
+    {
+        sorted_list_free_container(root->left, env);
+        AXIS2_FREE(env->allocator, root->left);
+    }
+    if (root->right)
+    {
+        sorted_list_free_container(root->right, env);
+        AXIS2_FREE(env->allocator, root->right);
+    }
+    /*if (root) AXIS2_FREE(env->allocator, root);*/
+}
+
 void 
 sorted_list_free(
     c14n_sorted_list_t *root,



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