]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: don't validate dict integrity for regular builds
authorChristian Franke <chris@opensourcerouting.org>
Fri, 4 Aug 2017 13:44:45 +0000 (15:44 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Wed, 23 Aug 2017 18:52:34 +0000 (20:52 +0200)
This method is intended to be only used for debugging as per the author
and profiling shows we are spending a lot of cycles on it. Remove it for
regular builds by guarding it with a define.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
isisd/dict.c
isisd/isisd.h

index f09a8152a836a6109fd0d10d74d47c4c272eae60..2ea86d1b68bdb80655f4b450bd086cb0c831e74d 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
@@ -369,6 +373,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 +394,7 @@ int dict_verify(dict_t *dict)
                return 0;
        if (verify_node_count(nil, root) != dict_count(dict))
                return 0;
+#endif
        return 1;
 }
 
index c3a7fc7dd58a0d7a6ed9ba2c80689196543cd342..12f3ece0e9cef007cae91fdb4e16313467a5926c 100644 (file)
@@ -37,7 +37,7 @@
 
 /* uncomment if you are a developer in bug hunt */
 /* #define EXTREME_DEBUG  */
-/* #define EXTREME_TLV_DEBUG */
+/* #define EXTREME_DICT_DEBUG */
 
 struct isis {
        u_long process_id;