remove 0 assignments.
[openssl.git] / crypto / x509v3 / pcy_tree.c
index f1bcb053a9123f1810aef3d133dd913d8605d049..c6be0151936d2190a2361a3d302e46b2391217d0 100644 (file)
@@ -57,7 +57,7 @@
  *
  */
 
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
 
@@ -217,32 +217,18 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
     }
 
     /* If we get this far initialize the tree */
-
-    tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE));
-
+    tree = OPENSSL_zalloc(sizeof(*tree));
     if (!tree)
         return 0;
-
-    tree->flags = 0;
-    tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n);
-    tree->nlevel = 0;
-    tree->extra_data = NULL;
-    tree->auth_policies = NULL;
-    tree->user_policies = NULL;
-
+    tree->levels = OPENSSL_zalloc(sizeof(*tree->levels) * n);
     if (!tree->levels) {
         OPENSSL_free(tree);
         return 0;
     }
-
-    memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL));
-
     tree->nlevel = n;
-
     level = tree->levels;
 
     /* Root data: initialize to anyPolicy */
-
     data = policy_data_new(NULL, OBJ_nid2obj(NID_any_policy), 0);
 
     if (!data || !level_add_node(level, data, NULL, tree))
@@ -252,7 +238,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
         level++;
         x = sk_X509_value(certs, i);
         cache = policy_cache_set(x);
-        CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
+        X509_up_ref(x);
         level->cert = x;
 
         if (!cache->anyPolicy)
@@ -535,7 +521,7 @@ static int tree_calculate_authority_set(X509_POLICY_TREE *tree,
          * If no anyPolicy node on this this level it can't appear on lower
          * levels so end search.
          */
-        if (!(anyptr = curr->anyPolicy))
+        if ((anyptr = curr->anyPolicy) == NULL)
             break;
         curr++;
         for (j = 0; j < sk_X509_POLICY_NODE_num(curr->nodes); j++) {