summaryrefslogtreecommitdiffstats
path: root/generic/tclGetDate.y
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-15 20:24:10 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-15 20:24:10 (GMT)
commitc4333327b2ce34eda6e780c94340932d5427e7ec (patch)
tree66f811f3e43d90f5bbc399b97cdfa5dda6caab2b /generic/tclGetDate.y
parent2a9e281535fc3fa44638d1c2b049316a55d48b87 (diff)
downloadtcl-c4333327b2ce34eda6e780c94340932d5427e7ec.zip
tcl-c4333327b2ce34eda6e780c94340932d5427e7ec.tar.gz
tcl-c4333327b2ce34eda6e780c94340932d5427e7ec.tar.bz2
Review: Unnecessary use of 'L', TABLE.value: int is enough, making smaller tables
Diffstat (limited to 'generic/tclGetDate.y')
-rw-r--r--generic/tclGetDate.y46
1 files changed, 16 insertions, 30 deletions
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index 92e1b26..077d751 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -7,9 +7,9 @@
* only used when doing free-form date parsing, an ill-defined process
* anyway.
*
- * Copyright (c) 1992-1995 Karl Lehenbauer & Mark Diekhans.
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 2015 Sergey G. Brester aka sebres.
+ * Copyright © 1992-1995 Karl Lehenbauer & Mark Diekhans.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2015 Sergey G. Brester aka sebres.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -28,8 +28,9 @@
* This file is generated from a yacc grammar defined in the file
* tclGetDate.y. It should not be edited directly.
*
- * Copyright (c) 1992-1995 Karl Lehenbauer & Mark Diekhans.
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1995 Karl Lehenbauer & Mark Diekhans.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 2015 Sergey G. Brester aka sebres.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -71,8 +72,7 @@
#define TM_YEAR_BASE 1900
-#define HOUR(x) ((int) (60 * (x)))
-#define SECSPERDAY (24L * 60L * 60L)
+#define HOUR(x) ((60 * (int)(x)))
#define IsLeapYear(x) (((x) % 4 == 0) && ((x) % 100 != 0 || (x) % 400 == 0))
#define yyIncrFlags(f) \
@@ -86,10 +86,10 @@
* An entry in the lexical lookup table.
*/
-typedef struct _TABLE {
+typedef struct {
const char *name;
int type;
- long long value;
+ int value;
} TABLE;
/*
@@ -114,9 +114,9 @@ typedef enum _DSTMODE {
*/
static int LookupWord(YYSTYPE* yylvalPtr, char *buff);
- static void TclDateerror(YYLTYPE* location,
+static void TclDateerror(YYLTYPE* location,
DateInfo* info, const char *s);
- static int TclDatelex(YYSTYPE* yylvalPtr, YYLTYPE* location,
+static int TclDatelex(YYSTYPE* yylvalPtr, YYLTYPE* location,
DateInfo* info);
MODULE_SCOPE int yyparse(DateInfo*);
@@ -386,7 +386,7 @@ trek : tSTARDATE INTNUM '.' tUNUMBER {
yyDay = 1;
yyMonth = 1;
yyRelDay += (($2%1000)*(365 + IsLeapYear(yyYear)))/1000;
- yyRelSeconds += $4 * 144 * 60;
+ yyRelSeconds += $4 * (144LL * 60LL);
}
;
@@ -540,20 +540,6 @@ static const TABLE OtherTable[] = {
{ "last", tUNUMBER, -1 },
{ "this", tSEC_UNIT, 0 },
{ "next", tNEXT, 1 },
-#if 0
- { "first", tUNUMBER, 1 },
- { "second", tUNUMBER, 2 },
- { "third", tUNUMBER, 3 },
- { "fourth", tUNUMBER, 4 },
- { "fifth", tUNUMBER, 5 },
- { "sixth", tUNUMBER, 6 },
- { "seventh", tUNUMBER, 7 },
- { "eighth", tUNUMBER, 8 },
- { "ninth", tUNUMBER, 9 },
- { "tenth", tUNUMBER, 10 },
- { "eleventh", tUNUMBER, 11 },
- { "twelfth", tUNUMBER, 12 },
-#endif
{ "ago", tAGO, 1 },
{ "epoch", tEPOCH, 0 },
{ "stardate", tSTARDATE, 0 },
@@ -736,17 +722,17 @@ ToSeconds(
if (Hours < 0 || Hours > 23) {
return -1;
}
- return (Hours * 60L + Minutes) * 60L + Seconds;
+ return (Hours * 60 + Minutes) * 60 + Seconds;
case MERam:
if (Hours < 1 || Hours > 12) {
return -1;
}
- return ((Hours % 12) * 60L + Minutes) * 60L + Seconds;
+ return ((Hours % 12) * 60 + Minutes) * 60 + Seconds;
case MERpm:
if (Hours < 1 || Hours > 12) {
return -1;
}
- return (((Hours % 12) + 12) * 60L + Minutes) * 60L + Seconds;
+ return (((Hours % 12) + 12) * 60 + Minutes) * 60 + Seconds;
}
return -1; /* Should never be reached */
}
@@ -955,7 +941,7 @@ TclDatelex(
int ret;
for (p = buff; isalpha(UCHAR(c = *yyInput++)) /* INTL: ISO only. */
|| c == '.'; ) {
- if (p < &buff[sizeof buff - 1]) {
+ if (p < &buff[sizeof(buff) - 1]) {
*p++ = c;
}
}