Skip to content

Commit

Permalink
Add static keywords to variables and functions where possible in games/.
Browse files Browse the repository at this point in the history
This allows us to detect unused functions and variables and allows the
compiler to do a better job at optimisation.
  • Loading branch information
ed authored and ed committed Nov 5, 2011
1 parent 8fee4fe commit af1e42f
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 153 deletions.
6 changes: 3 additions & 3 deletions games/bcd/bcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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,
Expand Down Expand Up @@ -117,7 +117,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.
Expand Down Expand Up @@ -148,7 +148,7 @@ main(int argc, char **argv)

#define COLUMNS 48

void
static void
printcard(char *str)
{
static char rowchars[] = " 123456789";
Expand Down
6 changes: 3 additions & 3 deletions games/caesar/caesar.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ __FBSDID("$FreeBSD$");
* letter frequencies (taken from some unix(tm) documentation)
* (unix is a trademark of Bell Laboratories)
*/
double stdf[26] = {
static double stdf[26] = {
7.97, 1.35, 3.61, 4.78, 12.37, 2.01, 1.46, 4.49, 6.39, 0.04,
0.42, 3.81, 2.69, 5.92, 6.96, 2.91, 0.08, 6.63, 8.77, 9.68,
2.62, 0.81, 1.88, 0.23, 2.07, 0.06,
};

void printit(char *);
static void printit(char *);

int
main(int argc, char **argv)
Expand Down Expand Up @@ -147,7 +147,7 @@ main(int argc, char **argv)
exit(0);
}

void
static void
printit(char *arg)
{
int ch, rot;
Expand Down
Loading

0 comments on commit af1e42f

Please sign in to comment.