]> Savannah Git Hosting - gnulib.git/commit
parse-datetime: streamline overflow checking
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 12 Nov 2020 03:16:23 +0000 (19:16 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 12 Nov 2020 03:21:20 +0000 (19:21 -0800)
commit00ffb79c529942eab5c81568808bd317c753213a
tree70d6f39129192e94b03fe0d9e18b864591c9d243
parent4c9a3c65e279977af4e345748ba73ab0441dc04a
parse-datetime: streamline overflow checking

When parse-datetime.y’s overflow code was written, INT_ADD_WRAPV
did not work for unsigned destinations, and since time_t might
be unsigned that meant it did not work for time_t destinations.
This limitation of INT_ADD_WRAPV has been fixed, so we can
now streamline parse-datetime.y a bit.
* lib/parse-datetime.y: Do not include limits.h, as LONG_MAX
has not been used for a while.
(yylex, parse_datetime2): Assume C99 declarations after statements.
(yyles): Use INT_SUBTRACT_WRAPV instead of an explicit comparison
to TYPE_MINIMUM.
(parse_datetime2): No need for time_overflow now that
INT_ADD_WRAPV works for unsigned results.
ChangeLog
lib/parse-datetime.y