parse-datetime.y: accommodate -Wstrict-overflow
authorJim Meyering <meyering@redhat.com>
Sat, 28 May 2011 18:58:14 +0000 (20:58 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 29 May 2011 17:32:26 +0000 (19:32 +0200)
* lib/parse-datetime.y (yylex): Rearrange pointer arithmetic to
placate -Wstrict-overflow.

ChangeLog
lib/parse-datetime.y

index 5de6fa7..f9ee06b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-05-28  Jim Meyering  <meyering@redhat.com>
 
+       parse-datetime.y: accommodate -Wstrict-overflow
+       * lib/parse-datetime.y (yylex): Rearrange pointer arithmetic to
+       placate -Wstrict-overflow.
+
        trim: avoid a warning from -O2 -Wstrict-overflow
        * lib/trim.c (trim2): Declare local to be "unsigned int", not "int".
 
index d77955f..23a9a41 100644 (file)
@@ -1119,7 +1119,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc)
 
           do
             {
-              if (p < buff + sizeof buff - 1)
+              if (p - buff < sizeof buff - 1)
                 *p++ = c;
               c = *++pc->input;
             }