libtasn1-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU libtasn1 branch, master, updated. libtasn1_2_13-32-ge5fe288


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_13-32-ge5fe288
Date: Sun, 23 Sep 2012 14:19:19 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libtasn1".

http://git.savannah.gnu.org/cgit/libtasn1.git/commit/?id=e5fe28809968164765d0733a6a579991006f8d58

The branch, master has been updated
       via  e5fe28809968164765d0733a6a579991006f8d58 (commit)
      from  80863f75dfa06b3a256760da86850bcc720a5e61 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e5fe28809968164765d0733a6a579991006f8d58
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Sep 23 16:10:57 2012 +0200

    small optimizations to avoid recalculation of hashes when copying nodes.

-----------------------------------------------------------------------

Summary of changes:
 lib/decoding.c   |    4 ++--
 lib/parser_aux.c |   29 +++++++++++++++++++++++++++++
 lib/parser_aux.h |    2 ++
 lib/structure.c  |    4 ++--
 4 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/lib/decoding.c b/lib/decoding.c
index c500417..717112b 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -2675,7 +2675,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
                                asn1_create_element (definitions, name, &aux);
                              if (result == ASN1_SUCCESS)
                                {
-                                 _asn1_set_name (aux, p->name);
+                                 _asn1_cpy_name (aux, p);
                                  len2 =
                                    asn1_get_length_der (p->value,
                                                         p->value_len, &len3);
@@ -2857,7 +2857,7 @@ asn1_expand_octet_string (ASN1_TYPE definitions, 
ASN1_TYPE * element,
                  result = asn1_create_element (definitions, name, &aux);
                  if (result == ASN1_SUCCESS)
                    {
-                     _asn1_set_name (aux, octetNode->name);
+                     _asn1_cpy_name (aux, octetNode);
                      len2 =
                        asn1_get_length_der (octetNode->value,
                                             octetNode->value_len, &len3);
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:                                                    */
diff --git a/lib/parser_aux.h b/lib/parser_aux.h
index 0fc5f0d..f3aeb54 100644
--- a/lib/parser_aux.h
+++ b/lib/parser_aux.h
@@ -42,6 +42,8 @@ _asn1_append_value (ASN1_TYPE node, const void *value, 
unsigned int len);
 
 ASN1_TYPE _asn1_set_name (ASN1_TYPE node, const char *name);
 
+ASN1_TYPE _asn1_cpy_name (ASN1_TYPE dst, ASN1_TYPE src);
+
 ASN1_TYPE _asn1_set_right (ASN1_TYPE node, ASN1_TYPE right);
 
 ASN1_TYPE _asn1_get_last_right (ASN1_TYPE node);
diff --git a/lib/structure.c b/lib/structure.c
index 78e1f89..7d622ce 100644
--- a/lib/structure.c
+++ b/lib/structure.c
@@ -392,7 +392,7 @@ _asn1_copy_structure3 (ASN1_TYPE source_node)
       if (move != UP)
        {
          if (p_s->name[0] != 0)
-           _asn1_set_name (p_d, p_s->name);
+           _asn1_cpy_name (p_d, p_s);
          if (p_s->value)
            _asn1_set_value (p_d, p_s->value, p_s->value_len);
          if (p_s->down)
@@ -551,7 +551,7 @@ _asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
                {
                  return ASN1_IDENTIFIER_NOT_FOUND;
                }
-             _asn1_set_name (p2, p->name);
+             _asn1_cpy_name (p2, p);
              p2->right = p->right;
              p2->left = p->left;
              if (p->right)


hooks/post-receive
-- 
GNU libtasn1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]