more efficient check for '?LAST' and error checking.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 3 Jun 2014 14:35:45 +0000 (16:35 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 4 Jun 2014 08:06:53 +0000 (10:06 +0200)
lib/parser_aux.c

index effedb2..39e4046 100644 (file)
@@ -170,13 +170,13 @@ asn1_find_node (asn1_node pointer, const char *name)
        return NULL;
 
       p = p->down;
+      if (p == NULL)
+        return NULL;
 
       /* The identifier "?LAST" indicates the last element
          in the right chain. */
-      if (!strcmp (n, "?LAST"))
+      if (n[0] == '?' && n[1] == 'L') /* ?LAST */
        {
-         if (p == NULL)
-           return NULL;
          while (p->right)
            p = p->right;
        }
@@ -189,9 +189,9 @@ asn1_find_node (asn1_node pointer, const char *name)
              else
                p = p->right;
            }
-         if (p == NULL)
-           return NULL;
        }
+      if (p == NULL)
+        return NULL;
     }                          /* while */
 
   return p;