parse-datetime.y: accommodate -Wstrict-overflow
authorJim Meyering <meyering@redhat.com>
Sat, 28 May 2011 18:58:14 +0000 (20:58 +0200)
committerIan Beckwith <ianb@erislabs.net>
Thu, 9 Jun 2011 20:14:38 +0000 (21:14 +0100)
* lib/parse-datetime.y (yylex): Rearrange pointer arithmetic to
placate -Wstrict-overflow.
(cherry picked from commit a8ff65c566a6391a3c1e832452b6b594eb51f180)

ChangeLog
lib/parse-datetime.y

index 3f5235a..1ee6670 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;
             }