changeset 1785:197f4bdf9a3d

<stdlib.h>: Include if HAVE_STDLIB_H, since bison 1.27 invokes "free". (LookupWord, yylex): Don't pass negative char to ctype macros.
author Jim Meyering <jim@meyering.net>
date Sun, 18 Apr 1999 23:17:30 +0000
parents 5afbb5279fd5
children 027e08403b18
files lib/getdate.y
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -28,6 +28,10 @@
 #include <stdio.h>
 #include <ctype.h>
 
+#if HAVE_STDLIB_H
+# include <stdlib.h> /* for `free'; used by Bison 1.27 */
+#endif
+
 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
 # define IN_CTYPE_DOMAIN(c) 1
 #else
@@ -706,7 +710,7 @@
 
   /* Make it lowercase. */
   for (p = buff; *p; p++)
-    if (ISUPPER (*p))
+    if (ISUPPER ((unsigned char) *p))
       *p = tolower (*p);
 
   if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
@@ -787,7 +791,7 @@
       }
 
   /* Military timezones. */
-  if (buff[1] == '\0' && ISALPHA (*buff))
+  if (buff[1] == '\0' && ISALPHA ((unsigned char) *buff))
     {
       for (tp = MilitaryTable; tp->name; tp++)
 	if (strcmp (buff, tp->name) == 0)
@@ -818,7 +822,7 @@
 static int
 yylex ()
 {
-  register char c;
+  register unsigned char c;
   register char *p;
   char buff[20];
   int Count;
@@ -826,7 +830,7 @@
 
   for (;;)
     {
-      while (ISSPACE (*yyInput))
+      while (ISSPACE ((unsigned char) *yyInput))
 	yyInput++;
 
       if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')