diff options
author | ed <ed@FreeBSD.org> | 2011-11-05 07:18:53 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2011-11-05 07:18:53 +0000 |
commit | af1e42f3663dcd8159beaaa0859821132e24b852 (patch) | |
tree | 4242cd3dd5692991dfad5e1680032fdc0aff58b8 /games/morse | |
parent | 8fee4feec438219b472e674081c93ff29359229f (diff) | |
download | FreeBSD-src-af1e42f3663dcd8159beaaa0859821132e24b852.zip FreeBSD-src-af1e42f3663dcd8159beaaa0859821132e24b852.tar.gz |
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.
Diffstat (limited to 'games/morse')
-rw-r--r-- | games/morse/morse.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/games/morse/morse.c b/games/morse/morse.c index f0abae39..f6c95ee 100644 --- a/games/morse/morse.c +++ b/games/morse/morse.c @@ -261,33 +261,33 @@ static const struct morsetab koi8rtab[] = { {'\0', ""} }; -void show(const char *), play(const char *), morse(char); -void ttyout(const char *); -void sighandler(int); +static void show(const char *), play(const char *), morse(char); +static void ttyout(const char *); +static void sighandler(int); #define GETOPTOPTS "c:d:ef:lsw:" #define USAGE \ "usage: morse [-els] [-d device] [-w speed] [-c speed] [-f frequency] [string ...]\n" -static int pflag, lflag, sflag, eflag; -static int wpm = 20; /* effective words per minute */ -static int cpm; /* effective words per minute between +static int pflag, lflag, sflag, eflag; +static int wpm = 20; /* effective words per minute */ +static int cpm; /* effective words per minute between * characters */ #define FREQUENCY 600 -static int freq = FREQUENCY; +static int freq = FREQUENCY; static char *device; /* for tty-controlled generator */ #define DASH_LEN 3 #define CHAR_SPACE 3 #define WORD_SPACE (7 - CHAR_SPACE - 1) -static float dot_clock; -static float cdot_clock; -int spkr, line; -struct termios otty, ntty; -int olflags; +static float dot_clock; +static float cdot_clock; +static int spkr, line; +static struct termios otty, ntty; +static int olflags; #ifdef SPEAKER -tone_t sound; +static tone_t sound; #undef GETOPTOPTS #define GETOPTOPTS "c:d:ef:lpsw:" #undef USAGE @@ -439,7 +439,7 @@ main(int argc, char **argv) exit(0); } -void +static void morse(char c) { const struct morsetab *m; @@ -473,7 +473,7 @@ morse(char c) } } -void +static void show(const char *s) { if (lflag) { @@ -488,7 +488,7 @@ show(const char *s) } } -void +static void play(const char *s) { #ifdef SPEAKER @@ -530,7 +530,7 @@ play(const char *s) #endif } -void +static void ttyout(const char *s) { const char *c; @@ -572,7 +572,7 @@ ttyout(const char *s) usleep(duration); } -void +static void sighandler(int signo) { |