emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master b2bff45 3/3: Omit null-pointer test in intervals.h


From: Paul Eggert
Subject: [Emacs-diffs] master b2bff45 3/3: Omit null-pointer test in intervals.h FRAME
Date: Sun, 25 Jun 2017 15:54:17 -0400 (EDT)

branch: master
commit b2bff45d0f27b3d8c3dfbf6df51dd7adbcb9d9fc
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Omit null-pointer test in intervals.h FRAME
    
    * src/intervals.h (ROOT_INTERVAL_P, ONLY_INTERVAL_P)
    (INTERVAL_LAST_POS): Omit unnecessary parens.
    (LENGTH): Omit test for null pointer.  The argument is never null.
    The unnecessary test causes GCC 7.1.0 to assume that the argument
    might be null, and therefore to issue false alarms when the
    argument is dereferenced in other expressions.
---
 src/intervals.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/intervals.h b/src/intervals.h
index db91b3f..a0da6f3 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -85,10 +85,10 @@ struct interval
 #define LEAF_INTERVAL_P(i) ((i)->left == NULL && (i)->right == NULL)
 
 /* True if this interval has no parent and is therefore the root.  */
-#define ROOT_INTERVAL_P(i) (NULL_PARENT (i))
+#define ROOT_INTERVAL_P(i) NULL_PARENT (i)
 
 /* True if this interval is the only interval in the interval tree.  */
-#define ONLY_INTERVAL_P(i) (ROOT_INTERVAL_P ((i)) && LEAF_INTERVAL_P ((i)))
+#define ONLY_INTERVAL_P(i) (ROOT_INTERVAL_P (i) && LEAF_INTERVAL_P (i))
 
 /* True if this interval has both left and right children.  */
 #define BOTH_KIDS_P(i) ((i)->left != NULL && (i)->right != NULL)
@@ -98,13 +98,13 @@ struct interval
 #define TOTAL_LENGTH(i) ((i) == NULL ? 0 : (i)->total_length)
 
 /* The size of text represented by this interval alone.  */
-#define LENGTH(i) ((i) == NULL ? 0 : (TOTAL_LENGTH ((i))               \
-                                     - TOTAL_LENGTH ((i)->right)       \
-                                     - TOTAL_LENGTH ((i)->left)))
+#define LENGTH(i) ((i)->total_length                   \
+                  - TOTAL_LENGTH ((i)->right)          \
+                  - TOTAL_LENGTH ((i)->left))
 
 /* The position of the character just past the end of I.  Note that
    the position cache i->position must be valid for this to work.  */
-#define INTERVAL_LAST_POS(i) ((i)->position + LENGTH ((i)))
+#define INTERVAL_LAST_POS(i) ((i)->position + LENGTH (i))
 
 /* The total size of the left subtree of this interval.  */
 #define LEFT_TOTAL_LENGTH(i) ((i)->left ? (i)->left->total_length : 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]