changeset 14843:c2b5c400a991

parse-datetime.y: accommodate -Wstrict-overflow * lib/parse-datetime.y (yylex): Rearrange pointer arithmetic to placate -Wstrict-overflow.
author Jim Meyering <meyering@redhat.com>
date Sat, 28 May 2011 20:58:14 +0200
parents e7fdc5219b0d
children d6cca2f0c240
files ChangeLog lib/parse-datetime.y
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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".
 
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -1119,7 +1119,7 @@
 
           do
             {
-              if (p < buff + sizeof buff - 1)
+              if (p - buff < sizeof buff - 1)
                 *p++ = c;
               c = *++pc->input;
             }