]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
opr: Silence rbtree warning
authorAndrew Deason <adeason@sinenomine.net>
Thu, 9 Jan 2014 18:44:44 +0000 (12:44 -0600)
committerDerrick Brashear <shadow@your-file-system.com>
Thu, 16 Jan 2014 03:30:09 +0000 (19:30 -0800)
On OS X, gcc can complain that 'child' is uninitialized whenever this
'else if' condition is false. We already handled the case where both
node->right and node->left are non-NULL earlier in this function, so
this should never occur. So, to get rid of the warning, just always
take the path in the 'else if', and assert that the right child is
NULL.

Change-Id: I3575de84ea172d3c7e0e022809fdcd0e3b4dcc27
Reviewed-on: http://gerrit.openafs.org/10687
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
src/opr/rbtree.c

index 8143e2d552b6f253c28ba4f3fa09d1d1c26b37b3..50e4115b7d59c44fe444a54a8bf6454c6706015b 100644 (file)
@@ -40,6 +40,7 @@
 #else
 # include <roken.h>
 #endif
+#include <afs/opr.h>
 
 #include "rbtree.h"
 
@@ -422,8 +423,10 @@ opr_rbtree_remove(struct opr_rbtree *head, struct opr_rbtree_node *node)
 
     if (node->left == NULL)
         child = node->right;
-    else if (node->right == NULL)
+    else {
+       opr_Assert(node->right == NULL);
        child = node->left;
+    }
 
     child->parent = node->parent;