* libmisc/getdate.y: abbrev is a bool.

* libmisc/getdate.y: Avoid implicit conversion of pointers / chars / integers to booleans.
This commit is contained in:
nekral-guest 2008-05-26 08:59:54 +00:00
parent 9305161183
commit 94b414861d
2 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/getdate.y: abbrev is a bool.
* libmisc/getdate.y: Avoid implicit conversion of pointers / chars /
integers to booleans.
2008-05-26 Nicolas François <nicolas.francois@centraliens.net> 2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
* lib/prototypes.h: Fix prototypes according to earlier changes * lib/prototypes.h: Fix prototypes according to earlier changes

View File

@ -395,7 +395,7 @@ relunit : tUNUMBER tYEAR_UNIT {
number : tUNUMBER number : tUNUMBER
{ {
if (yyHaveTime && yyHaveDate && !yyHaveRel) if ((yyHaveTime != 0) && (yyHaveDate != 0) && (yyHaveRel == 0))
yyYear = $1; yyYear = $1;
else else
{ {
@ -647,10 +647,10 @@ static int LookupWord (char *buff)
register char *q; register char *q;
register const TABLE *tp; register const TABLE *tp;
int i; int i;
int abbrev; bool abbrev;
/* Make it lowercase. */ /* Make it lowercase. */
for (p = buff; *p; p++) for (p = buff; '\0' != *p; p++)
if (ISUPPER (*p)) if (ISUPPER (*p))
*p = tolower (*p); *p = tolower (*p);
@ -667,14 +667,14 @@ static int LookupWord (char *buff)
/* See if we have an abbreviation for a month. */ /* See if we have an abbreviation for a month. */
if (strlen (buff) == 3) if (strlen (buff) == 3)
abbrev = 1; abbrev = true;
else if (strlen (buff) == 4 && buff[3] == '.') else if (strlen (buff) == 4 && buff[3] == '.')
{ {
abbrev = 1; abbrev = true;
buff[3] = '\0'; buff[3] = '\0';
} }
else else
abbrev = 0; abbrev = false;
for (tp = MonthDayTable; tp->name; tp++) for (tp = MonthDayTable; tp->name; tp++)
{ {
@ -743,14 +743,14 @@ static int LookupWord (char *buff)
} }
/* Drop out any periods and try the timezone table again. */ /* Drop out any periods and try the timezone table again. */
for (i = 0, p = q = buff; *q; q++) for (i = 0, p = q = buff; '\0' != *q; q++)
if (*q != '.') if (*q != '.')
*p++ = *q; *p++ = *q;
else else
i++; i++;
*p = '\0'; *p = '\0';
if (i) if (0 != i)
for (tp = TimezoneTable; tp->name; tp++) for (tp = TimezoneTable; NULL != tp->name; tp++)
if (strcmp (buff, tp->name) == 0) if (strcmp (buff, tp->name) == 0)
{ {
yylval.Number = tp->value; yylval.Number = tp->value;
@ -790,7 +790,7 @@ yylex (void)
yyInput--; yyInput--;
if (sign < 0) if (sign < 0)
yylval.Number = -yylval.Number; yylval.Number = -yylval.Number;
return sign ? tSNUMBER : tUNUMBER; return (0 != sign) ? tSNUMBER : tUNUMBER;
} }
if (ISALPHA (c)) if (ISALPHA (c))
{ {
@ -874,7 +874,8 @@ time_t get_date (const char *p, const time_t *now)
tm.tm_year = ToYear (yyYear) - TM_YEAR_ORIGIN + yyRelYear; tm.tm_year = ToYear (yyYear) - TM_YEAR_ORIGIN + yyRelYear;
tm.tm_mon = yyMonth - 1 + yyRelMonth; tm.tm_mon = yyMonth - 1 + yyRelMonth;
tm.tm_mday = yyDay + yyRelDay; tm.tm_mday = yyDay + yyRelDay;
if (yyHaveTime || (yyHaveRel && !yyHaveDate && !yyHaveDay)) if ((yyHaveTime != 0) ||
( (yyHaveRel != 0) && (yyHaveDate == 0) && (yyHaveDay == 0) ))
{ {
tm.tm_hour = ToHour (yyHour, yyMeridian); tm.tm_hour = ToHour (yyHour, yyMeridian);
if (tm.tm_hour < 0) if (tm.tm_hour < 0)