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_3_6-16-g4010bb0


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_3_6-16-g4010bb0
Date: Wed, 04 Jun 2014 09:30:09 +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=4010bb04588fca86a9f6d683b637c05b4cec24e0

The branch, master has been updated
       via  4010bb04588fca86a9f6d683b637c05b4cec24e0 (commit)
      from  ecd1884be1d2e0f0063f82b0dd47ebe0231c3eb4 (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 4010bb04588fca86a9f6d683b637c05b4cec24e0
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Tue Jun 3 15:44:49 2014 +0200

    optimized _asn1_find_up().

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

Summary of changes:
 lib/coding.c     |    4 ++--
 lib/decoding.c   |   20 ++++++++++----------
 lib/element.c    |    2 +-
 lib/int.h        |    1 +
 lib/parser_aux.c |   18 +++++++++++-------
 lib/parser_aux.h |   13 ++++++++++++-
 lib/structure.c  |   22 +++++++++++-----------
 7 files changed, 48 insertions(+), 32 deletions(-)

diff --git a/lib/coding.c b/lib/coding.c
index 9b90477..dc79fcc 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -1246,7 +1246,7 @@ asn1_der_coding (asn1_node element, const char *name, 
void *ider, int *len,
                  continue;
                }
              else
-               p = _asn1_find_up (p);
+               p = _asn1_get_up (p);
              move = UP;
            }
          if (move == UP)
@@ -1320,7 +1320,7 @@ asn1_der_coding (asn1_node element, const char *name, 
void *ider, int *len,
            move = UP;
        }
       if (move == UP)
-       p = _asn1_find_up (p);
+       p = _asn1_get_up (p);
     }
 
   *len = counter;
diff --git a/lib/decoding.c b/lib/decoding.c
index 54f0167..c79a5c4 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -622,7 +622,7 @@ _asn1_delete_not_used (asn1_node node)
            {
              p2 = _asn1_find_left (p);
              if (!p2)
-               p2 = _asn1_find_up (p);
+               p2 = _asn1_get_up (p);
            }
          asn1_delete_structure (&p);
          p = p2;
@@ -645,7 +645,7 @@ _asn1_delete_not_used (asn1_node node)
            {
              while (1)
                {
-                 p = _asn1_find_up (p);
+                 p = _asn1_get_up (p);
                  if (p == node)
                    {
                      p = NULL;
@@ -929,7 +929,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, 
int ider_len,
        {
          if (p->type & CONST_SET)
            {
-             p2 = _asn1_find_up (p);
+             p2 = _asn1_get_up (p);
              len2 = p2->tmp_ival;
              if (len2 == -1)
                {
@@ -985,7 +985,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, 
int ider_len,
 
          if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
            {
-             p2 = _asn1_find_up (p);
+             p2 = _asn1_get_up (p);
              len2 = p2->tmp_ival;
              if (counter == len2)
                {
@@ -1048,7 +1048,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, 
int ider_len,
 
          if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
            {
-             p2 = _asn1_find_up (p);
+             p2 = _asn1_get_up (p);
              len2 = p2->tmp_ival;
 
              if ((len2 != -1) && (counter > len2))
@@ -1463,7 +1463,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, 
int ider_len,
            move = UP;
        }
       if (move == UP)
-       p = _asn1_find_up (p);
+       p = _asn1_get_up (p);
     }
 
   _asn1_delete_not_used (*element);
@@ -1639,7 +1639,7 @@ asn1_expand_any_defined_by (asn1_node definitions, 
asn1_node * element)
                  break;
                }
 
-             p3 = _asn1_find_up (p);
+             p3 = _asn1_get_up (p);
 
              if (!p3)
                {
@@ -1659,8 +1659,8 @@ asn1_expand_any_defined_by (asn1_node definitions, 
asn1_node * element)
                  (p3->value == NULL))
                {
 
-                 p3 = _asn1_find_up (p);
-                 p3 = _asn1_find_up (p3);
+                 p3 = _asn1_get_up (p);
+                 p3 = _asn1_get_up (p3);
 
                  if (!p3)
                    {
@@ -1795,7 +1795,7 @@ asn1_expand_any_defined_by (asn1_node definitions, 
asn1_node * element)
        {
          while (1)
            {
-             p = _asn1_find_up (p);
+             p = _asn1_get_up (p);
              if (p == *element)
                {
                  p = NULL;
diff --git a/lib/element.c b/lib/element.c
index ac30e46..c2b7107 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -52,7 +52,7 @@ _asn1_hierarchical_name (asn1_node node, char *name, int 
name_size)
          _asn1_str_cat (name, name_size, ".");
          _asn1_str_cat (name, name_size, tmp_name);
        }
-      p = _asn1_find_up (p);
+      p = _asn1_get_up (p);
     }
 
   if (name[0] == 0)
diff --git a/lib/int.h b/lib/int.h
index 82d0d3f..8cc79cc 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -51,6 +51,7 @@ struct asn1_node_st
   unsigned int type;           /* Node type */
   unsigned char *value;                /* Node value */
   int value_len;
+  asn1_node up;                        /* Pointer to the parent node */
   asn1_node down;              /* Pointer to the son node */
   asn1_node right;             /* Pointer to the brother node */
   asn1_node left;              /* Pointer to the next list element */
diff --git a/lib/parser_aux.c b/lib/parser_aux.c
index 39e4046..32dfba0 100644
--- a/lib/parser_aux.c
+++ b/lib/parser_aux.c
@@ -419,7 +419,11 @@ _asn1_set_right (asn1_node node, asn1_node right)
     return node;
   node->right = right;
   if (right)
-    right->left = node;
+    {
+      right->left = node;
+      if (right->up == NULL)
+        right->up = node->up;
+    }
   return node;
 }
 
@@ -615,7 +619,7 @@ _asn1_change_integer_value (asn1_node node)
            {
              while (1)
                {
-                 p = _asn1_find_up (p);
+                 p = _asn1_get_up (p);
                  if (p == node)
                    {
                      p = NULL;
@@ -740,7 +744,7 @@ _asn1_expand_object_id (asn1_node node)
            move = UP;
        }
       if (move == UP)
-       p = _asn1_find_up (p);
+       p = _asn1_get_up (p);
     }
 
 
@@ -812,7 +816,7 @@ _asn1_expand_object_id (asn1_node node)
            move = UP;
        }
       if (move == UP)
-       p = _asn1_find_up (p);
+       p = _asn1_get_up (p);
     }
 
   return ASN1_SUCCESS;
@@ -882,7 +886,7 @@ _asn1_type_set_config (asn1_node node)
            move = UP;
        }
       if (move == UP)
-       p = _asn1_find_up (p);
+       p = _asn1_get_up (p);
     }
 
   return ASN1_SUCCESS;
@@ -979,7 +983,7 @@ _asn1_check_identifier (asn1_node node)
        {
          while (1)
            {
-             p = _asn1_find_up (p);
+             p = _asn1_get_up (p);
              if (p == node)
                {
                  p = NULL;
@@ -1039,7 +1043,7 @@ _asn1_set_default_tag (asn1_node node)
        {
          while (1)
            {
-             p = _asn1_find_up (p);
+             p = _asn1_get_up (p);
              if (p == node)
                {
                  p = NULL;
diff --git a/lib/parser_aux.h b/lib/parser_aux.h
index 1f1aec2..55d9061 100644
--- a/lib/parser_aux.h
+++ b/lib/parser_aux.h
@@ -57,6 +57,14 @@ char *_asn1_ltostr (long v, char *str);
 
 asn1_node _asn1_find_up (asn1_node node);
 
+inline static asn1_node _asn1_get_up(asn1_node node)
+{
+       if (node && node->up)
+               return node->up;
+       else
+               return _asn1_find_up(node);
+}
+
 int _asn1_change_integer_value (asn1_node node);
 
 int _asn1_expand_object_id (asn1_node node);
@@ -99,7 +107,10 @@ _asn1_set_down (asn1_node node, asn1_node down)
     return node;
   node->down = down;
   if (down)
-    down->left = node;
+    {
+      down->left = node;
+      down->up = node;
+    }
   return node;
 }
 
diff --git a/lib/structure.c b/lib/structure.c
index 2184aa8..1c9dd59 100644
--- a/lib/structure.c
+++ b/lib/structure.c
@@ -134,7 +134,7 @@ _asn1_create_static_structure (asn1_node pointer, char 
*output_file_name,
        {
          while (1)
            {
-             p = _asn1_find_up (p);
+             p = _asn1_get_up (p);
              if (p == pointer)
                {
                  p = NULL;
@@ -221,7 +221,7 @@ asn1_array2tree (const asn1_static_node * array, asn1_node 
* definitions,
              if (p_last == *definitions)
                break;
 
-             p_last = _asn1_find_up (p_last);
+             p_last = _asn1_get_up (p_last);
 
              if (p_last == NULL)
                break;
@@ -321,7 +321,7 @@ asn1_delete_structure2 (asn1_node * structure, unsigned int 
flags)
          p2 = p->right;
          if (p != *structure)
            {
-             p3 = _asn1_find_up (p);
+             p3 = _asn1_get_up (p);
              _asn1_set_down (p3, p2);
              _asn1_remove_node (p, flags);
              p = p3;
@@ -331,7 +331,7 @@ asn1_delete_structure2 (asn1_node * structure, unsigned int 
flags)
              p3 = _asn1_find_left (p);
              if (!p3)
                {
-                 p3 = _asn1_find_up (p);
+                 p3 = _asn1_get_up (p);
                  if (p3)
                    _asn1_set_down (p3, p2);
                  else
@@ -379,7 +379,7 @@ asn1_delete_element (asn1_node structure, const char 
*element_name)
   p3 = _asn1_find_left (source_node);
   if (!p3)
     {
-      p3 = _asn1_find_up (source_node);
+      p3 = _asn1_get_up (source_node);
       if (p3)
        _asn1_set_down (p3, p2);
       else if (source_node->right)
@@ -439,8 +439,8 @@ _asn1_copy_structure3 (asn1_node source_node)
       else
        {
          move = UP;
-         p_s = _asn1_find_up (p_s);
-         p_d = _asn1_find_up (p_d);
+         p_s = _asn1_get_up (p_s);
+         p_d = _asn1_get_up (p_d);
        }
     }
   while (p_s != source_node);
@@ -540,7 +540,7 @@ _asn1_type_choice_config (asn1_node node)
            move = UP;
        }
       if (move == UP)
-       p = _asn1_find_up (p);
+       p = _asn1_get_up (p);
     }
 
   return ASN1_SUCCESS;
@@ -591,7 +591,7 @@ _asn1_expand_identifier (asn1_node * node, asn1_node root)
                _asn1_set_right (p3, p2);
              else
                {
-                 p3 = _asn1_find_up (p);
+                 p3 = _asn1_get_up (p);
                  if (p3)
                    _asn1_set_down (p3, p2);
                  else
@@ -647,7 +647,7 @@ _asn1_expand_identifier (asn1_node * node, asn1_node root)
            move = UP;
        }
       if (move == UP)
-       p = _asn1_find_up (p);
+       p = _asn1_get_up (p);
     }
 
   return ASN1_SUCCESS;
@@ -1015,7 +1015,7 @@ asn1_print_structure (FILE * out, asn1_node structure, 
const char *name,
        {
          while (1)
            {
-             p = _asn1_find_up (p);
+             p = _asn1_get_up (p);
              if (p == root)
                {
                  p = NULL;


hooks/post-receive
-- 
GNU libtasn1



reply via email to

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