Author: eadler
Date: Wed Apr 24 12:47:41 2013
New Revision: 249841
URL: http://svnweb.freebsd.org/changeset/base/249841

Log:
  MFC r227101:
        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.

Modified:
  stable/8/games/bcd/bcd.c
  stable/8/games/grdc/grdc.c
  stable/8/games/morse/morse.c
  stable/8/games/number/number.c
Directory Properties:
  stable/8/games/bcd/   (props changed)
  stable/8/games/grdc/   (props changed)
  stable/8/games/morse/   (props changed)
  stable/8/games/number/   (props changed)

Modified: stable/8/games/bcd/bcd.c
==============================================================================
--- stable/8/games/bcd/bcd.c    Wed Apr 24 12:47:30 2013        (r249840)
+++ stable/8/games/bcd/bcd.c    Wed Apr 24 12:47:41 2013        (r249841)
@@ -86,7 +86,7 @@ static const char rcsid[] =
 #include <string.h>
 #include <unistd.h>
 
-u_short holes[256] = {
+static u_short holes[256] = {
     0x0,        0x0,     0x0,     0x0,     0x0,     0x0,     0x0,     0x0,
     0x0,        0x0,     0x0,     0x0,     0x0,     0x0,     0x0,     0x0,
     0x0,        0x0,     0x0,     0x0,     0x0,     0x0,     0x0,     0x0,
@@ -121,7 +121,7 @@ u_short holes[256] = {
     0x202,      0x201,   0x082,   0x806,   0x822,   0x600,   0x282,   0x0
 };
 
-void printcard(char *);
+static void printcard(char *);
 
 /*
  * i'th bit of w.
@@ -149,7 +149,7 @@ main(int argc, char **argv)
 
 #define        COLUMNS 48
 
-void
+static void
 printcard(char *str)
 {
        static char rowchars[] = "   123456789";

Modified: stable/8/games/grdc/grdc.c
==============================================================================
--- stable/8/games/grdc/grdc.c  Wed Apr 24 12:47:30 2013        (r249840)
+++ stable/8/games/grdc/grdc.c  Wed Apr 24 12:47:41 2013        (r249841)
@@ -26,29 +26,30 @@
 #define XLENGTH 58
 #define YDEPTH  7
 
-struct timespec now;
-struct tm *tm;
+static struct timespec now;
+static struct tm *tm;
 
-short disp[11] = {
+static short disp[11] = {
        075557, 011111, 071747, 071717, 055711,
        074717, 074757, 071111, 075757, 075717, 002020
 };
-long old[6], next[6], new[6], mask;
+static long old[6], next[6], new[6], mask;
 
-volatile sig_atomic_t sigtermed;
+static volatile sig_atomic_t sigtermed;
 
-int hascolor = 0;
+static int hascolor = 0;
 
-void set(int, int);
-void standt(int);
-void movto(int, int);
-void sighndl(int);
-void usage(void);
+static void set(int, int);
+static void standt(int);
+static void movto(int, int);
+static void sighndl(int);
+static void usage(void);
 
-void
+static void
 sighndl(int signo)
 {
-       sigtermed=signo;
+
+       sigtermed = signo;
 }
 
 int
@@ -225,7 +226,7 @@ main(int argc, char *argv[])
        return(0);
 }
 
-void
+static void
 set(int t, int n)
 {
        int i, m;
@@ -239,7 +240,7 @@ set(int t, int n)
                mask |= m;
 }
 
-void
+static void
 standt(int on)
 {
        if (on) {
@@ -257,13 +258,13 @@ standt(int on)
        }
 }
 
-void
+static void
 movto(int line, int col)
 {
        move(line, col);
 }
 
-void
+static void
 usage(void)
 {
 

Modified: stable/8/games/morse/morse.c
==============================================================================
--- stable/8/games/morse/morse.c        Wed Apr 24 12:47:30 2013        
(r249840)
+++ stable/8/games/morse/morse.c        Wed Apr 24 12:47:41 2013        
(r249841)
@@ -262,33 +262,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
@@ -440,7 +440,7 @@ main(int argc, char **argv)
        exit(0);
 }
 
-void
+static void
 morse(char c)
 {
        const struct morsetab *m;
@@ -474,7 +474,7 @@ morse(char c)
        }
 }
 
-void
+static void
 show(const char *s)
 {
        if (lflag) {
@@ -489,7 +489,7 @@ show(const char *s)
        }
 }
 
-void
+static void
 play(const char *s)
 {
 #ifdef SPEAKER
@@ -531,7 +531,7 @@ play(const char *s)
 #endif
 }
 
-void
+static void
 ttyout(const char *s)
 {
        const char *c;
@@ -573,7 +573,7 @@ ttyout(const char *s)
        usleep(duration);
 }
 
-void
+static void
 sighandler(int signo)
 {
 

Modified: stable/8/games/number/number.c
==============================================================================
--- stable/8/games/number/number.c      Wed Apr 24 12:47:30 2013        
(r249840)
+++ stable/8/games/number/number.c      Wed Apr 24 12:47:41 2013        
(r249841)
@@ -78,14 +78,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(argc, argv)
@@ -126,7 +125,7 @@ main(argc, argv)
        exit(0);
 }
 
-void
+static void
 convert(line)
        char *line;
 {
@@ -195,7 +194,7 @@ badnum:                     errx(1, "illegal number: %s", 
                (void)printf("\n");
 }
 
-int
+static int
 unit(len, p)
        int len;
        char *p;
@@ -231,7 +230,7 @@ unit(len, p)
        return (rval);
 }
 
-int
+static int
 number(p, len)
        char *p;
        int len;
@@ -271,7 +270,7 @@ number(p, len)
        return (rval);
 }
 
-void
+static void
 pfract(len)
        int len;
 {
@@ -290,7 +289,7 @@ pfract(len)
        }
 }
 
-void
+static void
 usage()
 {
        (void)fprintf(stderr, "usage: number [-l] [# ...]\n");
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to