]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/dict.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / isisd / dict.c
index f09a8152a836a6109fd0d10d74d47c4c272eae60..5d3e61e6d6bfe0915f0edd55d80a32b646586ec9 100644 (file)
@@ -174,6 +174,7 @@ static int verify_bintree(dict_t *dict)
  * subtree is not red-black.
  */
 
+#ifdef EXTREME_DICT_DEBUG
 static unsigned int verify_redblack(dnode_t *nil, dnode_t *root)
 {
        unsigned height_left, height_right;
@@ -198,6 +199,7 @@ static unsigned int verify_redblack(dnode_t *nil, dnode_t *root)
        }
        return 1;
 }
+#endif
 
 /*
  * Compute the actual count of nodes by traversing the tree and
@@ -205,6 +207,7 @@ static unsigned int verify_redblack(dnode_t *nil, dnode_t *root)
  * detect a mismatch.
  */
 
+#ifdef EXTREME_DICT_DEBUG
 static dictcount_t verify_node_count(dnode_t *nil, dnode_t *root)
 {
        if (root == nil)
@@ -213,6 +216,7 @@ static dictcount_t verify_node_count(dnode_t *nil, dnode_t *root)
                return 1 + verify_node_count(nil, root->left)
                       + verify_node_count(nil, root->right);
 }
+#endif
 
 /*
  * Verify that the tree contains the given node. This is done by
@@ -240,19 +244,18 @@ dict_t *dict_create(dictcount_t maxcount, dict_comp_t comp)
 {
        dict_t *new = XCALLOC(MTYPE_ISIS_DICT, sizeof(dict_t));
 
-       if (new) {
-               new->compare = comp;
-               new->allocnode = dnode_alloc;
-               new->freenode = dnode_free;
-               new->context = NULL;
-               new->nodecount = 0;
-               new->maxcount = maxcount;
-               new->nilnode.left = &new->nilnode;
-               new->nilnode.right = &new->nilnode;
-               new->nilnode.parent = &new->nilnode;
-               new->nilnode.color = dnode_black;
-               new->dupes = 0;
-       }
+       new->compare = comp;
+       new->allocnode = dnode_alloc;
+       new->freenode = dnode_free;
+       new->context = NULL;
+       new->nodecount = 0;
+       new->maxcount = maxcount;
+       new->nilnode.left = &new->nilnode;
+       new->nilnode.right = &new->nilnode;
+       new->nilnode.parent = &new->nilnode;
+       new->nilnode.color = dnode_black;
+       new->dupes = 0;
+
        return new;
 }
 
@@ -369,6 +372,7 @@ static void dict_clear(dict_t *dict)
 
 int dict_verify(dict_t *dict)
 {
+#ifdef EXTREME_DICT_DEBUG
        dnode_t *nil = dict_nil(dict), *root = dict_root(dict);
 
        /* check that the sentinel node and root node are black */
@@ -389,6 +393,7 @@ int dict_verify(dict_t *dict)
                return 0;
        if (verify_node_count(nil, root) != dict_count(dict))
                return 0;
+#endif
        return 1;
 }
 
@@ -968,12 +973,12 @@ static void dnode_free(dnode_t *node, void *context)
 dnode_t *dnode_create(void *data)
 {
        dnode_t *new = XCALLOC(MTYPE_ISIS_DICT_NODE, sizeof(dnode_t));
-       if (new) {
-               new->data = data;
-               new->parent = NULL;
-               new->left = NULL;
-               new->right = NULL;
-       }
+
+       new->data = data;
+       new->parent = NULL;
+       new->left = NULL;
+       new->right = NULL;
+
        return new;
 }
 
@@ -1244,8 +1249,8 @@ static char *dupstring(char *str)
 {
        int sz = strlen(str) + 1;
        char *new = XCALLOC(MTYPE_ISIS_TMP, sz);
-       if (new)
-               memcpy(new, str, sz);
+
+       memcpy(new, str, sz);
        return new;
 }
 
@@ -1317,9 +1322,8 @@ static void construct(dict_t *d)
                                free(val);
                                if (dn)
                                        dnode_destroy(dn);
-                       }
-
-                       dict_load_next(&dl, dn, key);
+                       } else
+                               dict_load_next(&dl, dn, key);
                        break;
                default:
                        putchar('?');