From af1e42f3663dcd8159beaaa0859821132e24b852 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 5 Nov 2011 07:18:53 +0000 Subject: Add static keywords to variables and functions where possible in games/. This allows us to detect unused functions and variables and allows the compiler to do a better job at optimisation. --- games/number/number.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'games/number') diff --git a/games/number/number.c b/games/number/number.c index 2ffc87c..e8cf181 100644 --- a/games/number/number.c +++ b/games/number/number.c @@ -74,14 +74,13 @@ static const char *name1[] = { "novemdecillion", "vigintillion", }; -void convert(char *); -int number(char *, int); -void pfract(int); -void toobig(void); -int unit(int, char *); -void usage(void); +static void convert(char *); +static int number(char *, int); +static void pfract(int); +static int unit(int, char *); +static void usage(void); -int lflag; +static int lflag; int main(int argc, char *argv[]) @@ -120,7 +119,7 @@ main(int argc, char *argv[]) exit(0); } -void +static void convert(char *line) { int flen, len, rval; @@ -188,7 +187,7 @@ badnum: errx(1, "illegal number: %s", line); (void)printf("\n"); } -int +static int unit(int len, char *p) { int off, rval; @@ -222,7 +221,7 @@ unit(int len, char *p) return (rval); } -int +static int number(char *p, int len) { int val, rval; @@ -260,7 +259,7 @@ number(char *p, int len) return (rval); } -void +static void pfract(int len) { static char const * const pref[] = { "", "ten-", "hundred-" }; @@ -278,7 +277,7 @@ pfract(int len) } } -void +static void usage(void) { (void)fprintf(stderr, "usage: number [-l] [# ...]\n"); -- cgit v1.1