]> granicus.if.org Git - sudo/commitdiff
Quiet a compiler warning.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 14 Jun 2010 14:57:23 +0000 (10:57 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 14 Jun 2010 14:57:23 +0000 (10:57 -0400)
--HG--
branch : 1.7

getdate.c
getdate.y

index a2711ccd43a6b732fd66a9339fdb3426f4a881b5..ab0f4fa714a77f817f078cd3f7b197c931043c0e 100644 (file)
--- a/getdate.c
+++ b/getdate.c
@@ -918,45 +918,41 @@ time_t
 get_date(p)
     char               *p;
 {
-    struct tm          *tm, gmt;
+    struct tm          *tm, *gmt, gmtbuf;
     time_t             Start;
     time_t             tod;
     time_t             now;
     time_t             timezone;
 
     yyInput = p;
-    {
-       struct tm *gmt_ptr;
-       /* XXX - eliminate timeb */
+    (void)time (&now);
 
-       (void)time (&now);
+    gmt = gmtime (&now);
+    if (gmt != NULL)
+    {
+       /* Make a copy, in case localtime modifies *tm (I think
+          that comment now applies to *gmt, but I am too
+          lazy to dig into how gmtime and locatime allocate the
+          structures they return pointers to).  */
+       gmtbuf = *gmt;
+       gmt = &gmtbuf;
+    }
 
-       gmt_ptr = gmtime (&now);
-       if (gmt_ptr != NULL)
-       {
-           /* Make a copy, in case localtime modifies *tm (I think
-              that comment now applies to *gmt_ptr, but I am too
-              lazy to dig into how gmtime and locatime allocate the
-              structures they return pointers to).  */
-           gmt = *gmt_ptr;
-       }
+    if (! (tm = localtime (&now)))
+       return -1;
 
-       if (! (tm = localtime (&now)))
-           return -1;
+    if (gmt != NULL)
+       timezone = difftm (gmt, tm) / 60;
+    else
+       /* We are on a system like VMS, where the system clock is
+          in local time and the system has no concept of timezones.
+          Hopefully we can fake this out (for the case in which the
+          user specifies no timezone) by just saying the timezone
+          is zero.  */
+       timezone = 0;
 
-       if (gmt_ptr != NULL)
-           timezone = difftm (&gmt, tm) / 60;
-       else
-           /* We are on a system like VMS, where the system clock is
-              in local time and the system has no concept of timezones.
-              Hopefully we can fake this out (for the case in which the
-              user specifies no timezone) by just saying the timezone
-              is zero.  */
-           timezone = 0;
-
-       if(tm->tm_isdst)
-           timezone += 60;
-    }
+    if(tm->tm_isdst)
+       timezone += 60;
 
     tm = localtime(&now);
     yyYear = tm->tm_year + 1900;
@@ -1020,7 +1016,7 @@ main(ac, av)
     (void)printf("Enter date, or blank line to exit.\n\t> ");
     (void)fflush(stdout);
     while (gets(buff) && buff[0]) {
-       d = get_date(buff, (struct timeb *)NULL);
+       d = get_date(buff);
        if (d == -1)
            (void)printf("Bad format - couldn't convert.\n");
        else
@@ -1032,7 +1028,7 @@ main(ac, av)
     /* NOTREACHED */
 }
 #endif /* defined(TEST) */
-#line 984 "y.tab.c"
+#line 980 "y.tab.c"
 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
 #if defined(__cplusplus) || defined(__STDC__)
 static int yygrowstack(void)
@@ -1527,7 +1523,7 @@ case 41:
            yyval.Meridian = yyvsp[0].Meridian;
        }
 break;
-#line 1479 "y.tab.c"
+#line 1475 "y.tab.c"
     }
     yyssp -= yym;
     yystate = *yyssp;
index af067f59249435edd00fe45bf81e5f19d6435f76..1521edde47b6715d7fec273a161e54c133f9cf1e 100644 (file)
--- a/getdate.y
+++ b/getdate.y
@@ -851,45 +851,41 @@ time_t
 get_date(p)
     char               *p;
 {
-    struct tm          *tm, gmt;
+    struct tm          *tm, *gmt, gmtbuf;
     time_t             Start;
     time_t             tod;
     time_t             now;
     time_t             timezone;
 
     yyInput = p;
-    {
-       struct tm *gmt_ptr;
-       /* XXX - eliminate timeb */
+    (void)time (&now);
 
-       (void)time (&now);
+    gmt = gmtime (&now);
+    if (gmt != NULL)
+    {
+       /* Make a copy, in case localtime modifies *tm (I think
+          that comment now applies to *gmt, but I am too
+          lazy to dig into how gmtime and locatime allocate the
+          structures they return pointers to).  */
+       gmtbuf = *gmt;
+       gmt = &gmtbuf;
+    }
 
-       gmt_ptr = gmtime (&now);
-       if (gmt_ptr != NULL)
-       {
-           /* Make a copy, in case localtime modifies *tm (I think
-              that comment now applies to *gmt_ptr, but I am too
-              lazy to dig into how gmtime and locatime allocate the
-              structures they return pointers to).  */
-           gmt = *gmt_ptr;
-       }
+    if (! (tm = localtime (&now)))
+       return -1;
 
-       if (! (tm = localtime (&now)))
-           return -1;
+    if (gmt != NULL)
+       timezone = difftm (gmt, tm) / 60;
+    else
+       /* We are on a system like VMS, where the system clock is
+          in local time and the system has no concept of timezones.
+          Hopefully we can fake this out (for the case in which the
+          user specifies no timezone) by just saying the timezone
+          is zero.  */
+       timezone = 0;
 
-       if (gmt_ptr != NULL)
-           timezone = difftm (&gmt, tm) / 60;
-       else
-           /* We are on a system like VMS, where the system clock is
-              in local time and the system has no concept of timezones.
-              Hopefully we can fake this out (for the case in which the
-              user specifies no timezone) by just saying the timezone
-              is zero.  */
-           timezone = 0;
-
-       if(tm->tm_isdst)
-           timezone += 60;
-    }
+    if(tm->tm_isdst)
+       timezone += 60;
 
     tm = localtime(&now);
     yyYear = tm->tm_year + 1900;
@@ -953,7 +949,7 @@ main(ac, av)
     (void)printf("Enter date, or blank line to exit.\n\t> ");
     (void)fflush(stdout);
     while (gets(buff) && buff[0]) {
-       d = get_date(buff, (struct timeb *)NULL);
+       d = get_date(buff);
        if (d == -1)
            (void)printf("Bad format - couldn't convert.\n");
        else