]> git.eshelyaron.com Git - emacs.git/commitdiff
Pacify GCC 13 -Wnull-dereference in itree.c
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 May 2023 01:51:23 +0000 (18:51 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 May 2023 02:28:13 +0000 (19:28 -0700)
* src/itree.c (itree_remove_fix): Simplify code and remove a
couple of eassume calls.  This works around GCC bug 109586.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109856

src/itree.c

index bd3e62a374a74dce41ba3b5294a28c145eff7208..ecf7d67422abd261cea3017ac4cee5d7ac6375e8 100644 (file)
@@ -817,14 +817,13 @@ itree_remove_fix (struct itree_tree *tree,
        {
          struct itree_node *other = parent->right;
 
-         if (null_safe_is_red (other)) /* case 1.a */
+         if (other->red) /* case 1.a */
            {
              other->red = false;
              parent->red = true;
              itree_rotate_left (tree, parent);
              other = parent->right;
            }
-         eassume (other != NULL);
 
          if (null_safe_is_black (other->left) /* 2.a */
              && null_safe_is_black (other->right))
@@ -855,14 +854,13 @@ itree_remove_fix (struct itree_tree *tree,
        {
          struct itree_node *other = parent->left;
 
-         if (null_safe_is_red (other)) /* 1.b */
+         if (other->red) /* 1.b */
            {
              other->red = false;
              parent->red = true;
              itree_rotate_right (tree, parent);
              other = parent->left;
            }
-         eassume (other != NULL);
 
          if (null_safe_is_black (other->right) /* 2.b */
              && null_safe_is_black (other->left))