Refactor to increase performace
diff --git a/src/omxmlsec/axiom.c b/src/omxmlsec/axiom.c
index c0c6802..28cc75e 100644
--- a/src/omxmlsec/axiom.c
+++ b/src/omxmlsec/axiom.c
@@ -456,7 +456,7 @@
axis2_status_t status = AXIS2_FAILURE;
axiom_node_t *temp_node = NULL;
- temp_node = axiom_node_detach(node_to_move,env);
+ temp_node = axiom_node_detach_without_namespaces(node_to_move,env);
status = axiom_node_insert_sibling_before(node_before, env, temp_node);
return status;
}
diff --git a/src/omxmlsec/tokens/token_binary_security_token.c b/src/omxmlsec/tokens/token_binary_security_token.c
index 91aabec..65be1b7 100644
--- a/src/omxmlsec/tokens/token_binary_security_token.c
+++ b/src/omxmlsec/tokens/token_binary_security_token.c
@@ -29,7 +29,7 @@
axis2_char_t* value_type,
axis2_char_t* data)
{
- axiom_node_t *binary_security_token_node = NULL;
+ axiom_node_t *binary_sec_token_node = NULL;
axiom_node_t *first_child_of_parent = NULL;
axiom_element_t *binary_security_token_ele = NULL;
axiom_attribute_t *encoding_type_att = NULL;
@@ -43,7 +43,7 @@
ns = axiom_namespace_create(env, RAMPART_WSU_XMLNS, OXS_WSU);
binary_security_token_ele = axiom_element_create(env, parent, OXS_NODE_BINARY_SECURITY_TOKEN,
- ns_obj, &binary_security_token_node);
+ ns_obj, &binary_sec_token_node);
if(!binary_security_token_ele)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating %s element.",
@@ -54,17 +54,17 @@
}
/* Binary security token must be added as the first child of the paretn */
- binary_security_token_node = axiom_node_detach(binary_security_token_node, env);
+ binary_sec_token_node = axiom_node_detach_without_namespaces(binary_sec_token_node, env);
first_child_of_parent = axiom_node_get_first_element(parent, env);
if(first_child_of_parent)
{
/* If there is a child add bst before it */
- axiom_node_insert_sibling_before(first_child_of_parent, env, binary_security_token_node);
+ axiom_node_insert_sibling_before(first_child_of_parent, env, binary_sec_token_node);
}
else
{
/* If there are no children just add the bst */
- axiom_node_add_child(parent, env, binary_security_token_node);
+ axiom_node_add_child(parent, env, binary_sec_token_node);
}
if(!id)
@@ -77,19 +77,19 @@
value_type_att = axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE, value_type, NULL);
ret = axiom_element_add_attribute(binary_security_token_ele, env, id_attr,
- binary_security_token_node);
+ binary_sec_token_node);
ret = axiom_element_add_attribute(binary_security_token_ele, env, encoding_type_att,
- binary_security_token_node);
+ binary_sec_token_node);
ret = axiom_element_add_attribute(binary_security_token_ele, env, value_type_att,
- binary_security_token_node);
+ binary_sec_token_node);
if(data)
{
ret = axiom_element_set_text(binary_security_token_ele, env, data,
- binary_security_token_node);
+ binary_sec_token_node);
}
- return binary_security_token_node;
+ return binary_sec_token_node;
}
diff --git a/src/omxmlsec/transforms_factory.c b/src/omxmlsec/transforms_factory.c
index 50fcdde..cca4737 100644
--- a/src/omxmlsec/transforms_factory.c
+++ b/src/omxmlsec/transforms_factory.c
@@ -72,7 +72,7 @@
node_local_name = axiom_util_get_localname(child_node, env);
if(!(axutil_strcmp(node_local_name, OXS_NODE_SIGNATURE)))
{
- sig_node = axiom_node_detach(child_node, env);
+ sig_node = axiom_node_detach(child_node, env); /* TODO should we use detach_without_namespace here?? */
break;
}
child_node = axiom_node_get_next_sibling(child_node, env);
diff --git a/src/omxmlsec/xml_encryption.c b/src/omxmlsec/xml_encryption.c
index cae88bb..7909dd1 100644
--- a/src/omxmlsec/xml_encryption.c
+++ b/src/omxmlsec/xml_encryption.c
@@ -260,7 +260,6 @@
/*Remove the node from the parent*/
if(AXIS2_SUCCESS == ret)
{
- axiom_node_detach(node, env);
axiom_node_free_tree(node, env);
node = NULL;
}
@@ -383,8 +382,6 @@
parent_of_enc_node = axiom_node_get_parent(enc_type_node, env);
axiom_node_insert_sibling_after(enc_type_node, env, deserialized_node);
- axiom_node_detach(enc_type_node, env);
-
axiom_node_free_tree(enc_type_node, env);
enc_type_node = NULL;
diff --git a/src/util/rampart_encryption.c b/src/util/rampart_encryption.c
index 387f891..05ebcd2 100644
--- a/src/util/rampart_encryption.c
+++ b/src/util/rampart_encryption.c
@@ -720,7 +720,6 @@
enc_data_node = oxs_axiom_get_node_by_id(env, envelope_node, OXS_ATTR_ID, id, NULL);
str_node = oxs_axiom_get_node_by_local_name(env, enc_data_node, OXS_NODE_SECURITY_TOKEN_REFRENCE);
reference_node = oxs_axiom_get_node_by_local_name(env, str_node, OXS_NODE_REFERENCE);
- reference_node = axiom_node_detach(reference_node, env);
axiom_node_free_tree(reference_node, env);
id_ref = axutil_stracat(env, OXS_LOCAL_REFERENCE_PREFIX,asym_key_id);
@@ -1333,7 +1332,7 @@
if(node_to_move)
{
- temp_node = axiom_node_detach(node_to_move, env);
+ temp_node = axiom_node_detach_without_namespaces(node_to_move, env);
if(temp_node)
{
enc_status = axiom_node_insert_sibling_after(
diff --git a/src/util/rampart_sec_header_builder.c b/src/util/rampart_sec_header_builder.c
index b4668cb..f672b0d 100644
--- a/src/util/rampart_sec_header_builder.c
+++ b/src/util/rampart_sec_header_builder.c
@@ -371,7 +371,7 @@
{
axiom_node_t *tmp_node = NULL;
tmp_node = (axiom_node_t*)axutil_array_list_get(enc_key_list, env, i);
- enc_key_node = axiom_node_detach(tmp_node, env);
+ enc_key_node = axiom_node_detach_without_namespaces(tmp_node, env);
axiom_node_insert_sibling_before(first_protection_item, env, enc_key_node);
}
}