summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-05-30 15:12:00 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-05-30 15:21:30 +0200
commite2e5b1d44456d6e99fb3765f2370630a2059994b (patch)
tree53ad986bd3647c23ff091fe57d9afc0d07616967 /lib
parent0227dd9ef0b11773ff853a96d5135a189e20e83e (diff)
downloadlibtasn1-e2e5b1d44456d6e99fb3765f2370630a2059994b.tar.gz
libtasn1-e2e5b1d44456d6e99fb3765f2370630a2059994b.tar.bz2
libtasn1-e2e5b1d44456d6e99fb3765f2370630a2059994b.zip
Added asn1_copy_node2()
Diffstat (limited to 'lib')
-rw-r--r--lib/libtasn1.h2
-rw-r--r--lib/libtasn1.map1
-rw-r--r--lib/structure.c26
3 files changed, 23 insertions, 6 deletions
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index a457068..064c10f 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -329,6 +329,8 @@ extern "C"
extern ASN1_API int
asn1_copy_node (asn1_node dst, const char *dst_name,
asn1_node src, const char *src_name);
+ extern ASN1_API asn1_node
+ asn1_copy_node2 (asn1_node src, const char *src_name);
/* Internal and low-level DER utility functions. */
diff --git a/lib/libtasn1.map b/lib/libtasn1.map
index fa91638..a2b535e 100644
--- a/lib/libtasn1.map
+++ b/lib/libtasn1.map
@@ -54,6 +54,7 @@ LIBTASN1_0_3
asn1_decode_simple_der;
asn1_read_value_type;
asn1_delete_structure2;
+ asn1_copy_node2;
local:
*;
};
diff --git a/lib/structure.c b/lib/structure.c
index 27fbfe3..2184aa8 100644
--- a/lib/structure.c
+++ b/lib/structure.c
@@ -1128,12 +1128,13 @@ asn1_find_structure_from_oid (asn1_node definitions, const char *oidValue)
/**
* asn1_copy_node:
- * @dst: Destination asn1_node node.
+ * @dst: Destination asn1 node.
* @dst_name: Field name in destination node.
- * @src: Source asn1_node node.
+ * @src: Source asn1 node.
* @src_name: Field name in source node.
*
- * Create a deep copy of a asn1_node variable.
+ * Create a deep copy of a asn1_node variable. That
+ * function requires @dst to be expanded using asn1_create_element().
*
* Returns: Return %ASN1_SUCCESS on success.
**/
@@ -1141,9 +1142,6 @@ int
asn1_copy_node (asn1_node dst, const char *dst_name,
asn1_node src, const char *src_name)
{
-/* FIXME: rewrite using copy_structure().
- * It seems quite hard to do.
- */
int result;
asn1_node dst_node;
void *data = NULL;
@@ -1177,3 +1175,19 @@ asn1_copy_node (asn1_node dst, const char *dst_name,
return result;
}
+
+/**
+ * asn1_copy_node2:
+ * @src: Source asn1 node.
+ * @src_name: Field name in source node.
+ *
+ * Create a deep copy of a asn1_node variable. This function
+ * will return an exact copy of the provided structure.
+ *
+ * Returns: Return %NULL on failure.
+ **/
+asn1_node
+asn1_copy_node2 (asn1_node src, const char *src_name)
+{
+ return _asn1_copy_structure2(src, src_name);
+}