summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1992-11-12 04:13:46 +0000
committerJim Meyering <jim@meyering.net>1992-11-12 04:13:46 +0000
commit5fc2263354892487337ab870520c9b682e8a893e (patch)
tree069dbb951c1522befe7ffb54e0b9c332f5f3b20d
parent83f157a7cc9116102722b26796bc5a201a8f3292 (diff)
downloadcoreutils-5fc2263354892487337ab870520c9b682e8a893e.tar.gz
coreutils-5fc2263354892487337ab870520c9b682e8a893e.tar.bz2
coreutils-5fc2263354892487337ab870520c9b682e8a893e.zip
Make tables static and const when possible.
getdate.c (getdate_yyerr, getdate_yylex): Declare these functions static.
-rw-r--r--lib/getdate.y22
-rw-r--r--lib/getusershell.c2
-rw-r--r--lib/strftime.c4
3 files changed, 14 insertions, 14 deletions
diff --git a/lib/getdate.y b/lib/getdate.y
index bff1a9b78..f856a1807 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -1,5 +1,5 @@
%{
-/* $Revision: 2.1 $
+/* $Revision: 1.1.1.1 $
**
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
@@ -94,7 +94,7 @@ extern struct tm *localtime();
#if !defined(lint) && !defined(SABER)
static char RCS[] =
- "$Header: str2date.y,v 2.1 90/09/06 08:15:06 cronan Exp $";
+ "$Header: /w/src/cvsroot/shellutils/lib/getdate.y,v 1.1.1.1 1992/11/01 05:44:32 meyering Exp $";
#endif /* !defined(lint) && !defined(SABER) */
@@ -366,7 +366,7 @@ o_merid : /* NULL */ {
%%
/* Month and day table. */
-static TABLE MonthDayTable[] = {
+static TABLE const MonthDayTable[] = {
{ "january", tMONTH, 1 },
{ "february", tMONTH, 2 },
{ "march", tMONTH, 3 },
@@ -395,7 +395,7 @@ static TABLE MonthDayTable[] = {
};
/* Time units table. */
-static TABLE UnitsTable[] = {
+static TABLE const UnitsTable[] = {
{ "year", tMONTH_UNIT, 12 },
{ "month", tMONTH_UNIT, 1 },
{ "fortnight", tMINUTE_UNIT, 14 * 24 * 60 },
@@ -410,7 +410,7 @@ static TABLE UnitsTable[] = {
};
/* Assorted relative-time words. */
-static TABLE OtherTable[] = {
+static TABLE const OtherTable[] = {
{ "tomorrow", tMINUTE_UNIT, 1 * 24 * 60 },
{ "yesterday", tMINUTE_UNIT, -1 * 24 * 60 },
{ "today", tMINUTE_UNIT, 0 },
@@ -436,7 +436,7 @@ static TABLE OtherTable[] = {
/* The timezone table. */
/* Some of these are commented out because a time_t can't store a float. */
-static TABLE TimezoneTable[] = {
+static TABLE const TimezoneTable[] = {
{ "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
{ "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */
{ "utc", tZONE, HOUR( 0) },
@@ -520,7 +520,7 @@ static TABLE TimezoneTable[] = {
};
/* Military timezone table. */
-static TABLE MilitaryTable[] = {
+static TABLE const MilitaryTable[] = {
{ "a", tZONE, HOUR( 1) },
{ "b", tZONE, HOUR( 2) },
{ "c", tZONE, HOUR( 3) },
@@ -553,7 +553,7 @@ static TABLE MilitaryTable[] = {
/* ARGSUSED */
-int
+static int
yyerror(s)
char *s;
{
@@ -599,7 +599,7 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
MERIDIAN Meridian;
DSTMODE DSTmode;
{
- static int DaysInMonth[12] = {
+ static int DaysInMonth[12] = {
31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
time_t tod;
@@ -693,7 +693,7 @@ LookupWord(buff)
{
register char *p;
register char *q;
- register TABLE *tp;
+ register const TABLE *tp;
int i;
int abbrev;
@@ -794,7 +794,7 @@ LookupWord(buff)
}
-int
+static int
yylex()
{
register char c;
diff --git a/lib/getusershell.c b/lib/getusershell.c
index 6e2e0c105..1dee6e7ab 100644
--- a/lib/getusershell.c
+++ b/lib/getusershell.c
@@ -35,7 +35,7 @@ char *realloc ();
static int readname ();
/* List of shells to use if the shells file is missing. */
-static char *default_shells[] =
+static char const* const default_shells[] =
{
"/bin/sh", "/bin/csh", "/usr/bin/sh", "/usr/bin/csh", NULL
};
diff --git a/lib/strftime.c b/lib/strftime.c
index cc4953e68..b6695342a 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -94,12 +94,12 @@ enum padding
none, blank, zero
};
-static char *days[] =
+static char const* const days[] =
{
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
};
-static char *months[] =
+static char const * const months[] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"