summaryrefslogtreecommitdiff
path: root/lib/parser_aux.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-09-23 16:10:57 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-09-23 16:10:57 +0200
commite5fe28809968164765d0733a6a579991006f8d58 (patch)
tree54273c3f48de6599a241ad5110b108c28ac8e13d /lib/parser_aux.c
parent80863f75dfa06b3a256760da86850bcc720a5e61 (diff)
downloadlibtasn1-e5fe28809968164765d0733a6a579991006f8d58.tar.gz
libtasn1-e5fe28809968164765d0733a6a579991006f8d58.tar.bz2
libtasn1-e5fe28809968164765d0733a6a579991006f8d58.zip
small optimizations to avoid recalculation of hashes when copying nodes.
Diffstat (limited to 'lib/parser_aux.c')
-rw-r--r--lib/parser_aux.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/parser_aux.c b/lib/parser_aux.c
index 323a5ea..ff701bc 100644
--- a/lib/parser_aux.c
+++ b/lib/parser_aux.c
@@ -376,6 +376,35 @@ unsigned int nsize;
}
/******************************************************************/
+/* Function : _asn1_cpy_name */
+/* Description: copies the field NAME in a NODE_ASN element. */
+/* Parameters: */
+/* dst: a dest element pointer. */
+/* src: a source element pointer. */
+/* Return: pointer to the NODE_ASN element. */
+/******************************************************************/
+ASN1_TYPE
+_asn1_cpy_name (ASN1_TYPE dst, ASN1_TYPE src)
+{
+unsigned int nsize;
+
+ if (dst == NULL)
+ return dst;
+
+ if (src == NULL)
+ {
+ dst->name[0] = 0;
+ dst->name_hash = _asn1_bhash(dst->name, 0);
+ return dst;
+ }
+
+ nsize = _asn1_str_cpy (dst->name, sizeof (dst->name), src->name);
+ dst->name_hash = src->name_hash;
+
+ return dst;
+}
+
+/******************************************************************/
/* Function : _asn1_set_right */
/* Description: sets the field RIGHT in a NODE_ASN element. */
/* Parameters: */