diff options
| author | Paul Eggert | 2011-02-21 10:06:25 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-21 10:06:25 -0800 |
| commit | b23b5a5b7dca39b708015979ed8c25901390ac14 (patch) | |
| tree | 7a84c8534ce93629c091c9d0db52ddaa5f4b9215 /lib-src/update-game-score.c | |
| parent | 6d7132563c23774dddcd825797a29ce7ae94253a (diff) | |
| download | emacs-b23b5a5b7dca39b708015979ed8c25901390ac14.tar.gz emacs-b23b5a5b7dca39b708015979ed8c25901390ac14.zip | |
Declare file-scope functions and variables static if not exported.
This is more consistent, and is nicer with gcc -Wstrict-prototypes.
* ebrowse.c, emacsclient.c, fakemail.c, make-docfile.c, movemail.c:
* profile.c, test-distrib.c, update-game-score.c:
Declare non-'main' functions and variables to be static.
* ebrowse.c: Omit redundant function prototypes.
Diffstat (limited to 'lib-src/update-game-score.c')
| -rw-r--r-- | lib-src/update-game-score.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 9466bf7b149..70b79a64f91 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c | |||
| @@ -57,7 +57,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 57 | extern char *optarg; | 57 | extern char *optarg; |
| 58 | extern int optind, opterr; | 58 | extern int optind, opterr; |
| 59 | 59 | ||
| 60 | int usage (int err) NO_RETURN; | 60 | static int usage (int err) NO_RETURN; |
| 61 | 61 | ||
| 62 | #define MAX_ATTEMPTS 5 | 62 | #define MAX_ATTEMPTS 5 |
| 63 | #define MAX_SCORES 200 | 63 | #define MAX_SCORES 200 |
| @@ -68,7 +68,7 @@ int usage (int err) NO_RETURN; | |||
| 68 | #define difftime(t1, t0) (double)((t1) - (t0)) | 68 | #define difftime(t1, t0) (double)((t1) - (t0)) |
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
| 71 | int | 71 | static int |
| 72 | usage (int err) | 72 | usage (int err) |
| 73 | { | 73 | { |
| 74 | fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n"); | 74 | fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n"); |
| @@ -80,8 +80,8 @@ usage (int err) | |||
| 80 | exit (err); | 80 | exit (err); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | int lock_file (const char *filename, void **state); | 83 | static int lock_file (const char *filename, void **state); |
| 84 | int unlock_file (const char *filename, void *state); | 84 | static int unlock_file (const char *filename, void *state); |
| 85 | 85 | ||
| 86 | struct score_entry | 86 | struct score_entry |
| 87 | { | 87 | { |
| @@ -90,24 +90,24 @@ struct score_entry | |||
| 90 | char *data; | 90 | char *data; |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | int read_scores (const char *filename, struct score_entry **scores, | 93 | static int read_scores (const char *filename, struct score_entry **scores, |
| 94 | int *count); | 94 | int *count); |
| 95 | int push_score (struct score_entry **scores, int *count, | 95 | static int push_score (struct score_entry **scores, int *count, |
| 96 | int newscore, char *username, char *newdata); | 96 | int newscore, char *username, char *newdata); |
| 97 | void sort_scores (struct score_entry *scores, int count, int reverse); | 97 | static void sort_scores (struct score_entry *scores, int count, int reverse); |
| 98 | int write_scores (const char *filename, const struct score_entry *scores, | 98 | static int write_scores (const char *filename, |
| 99 | int count); | 99 | const struct score_entry *scores, int count); |
| 100 | 100 | ||
| 101 | void lose (const char *msg) NO_RETURN; | 101 | static void lose (const char *msg) NO_RETURN; |
| 102 | 102 | ||
| 103 | void | 103 | static void |
| 104 | lose (const char *msg) | 104 | lose (const char *msg) |
| 105 | { | 105 | { |
| 106 | fprintf (stderr, "%s\n", msg); | 106 | fprintf (stderr, "%s\n", msg); |
| 107 | exit (EXIT_FAILURE); | 107 | exit (EXIT_FAILURE); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | void lose_syserr (const char *msg) NO_RETURN; | 110 | static void lose_syserr (const char *msg) NO_RETURN; |
| 111 | 111 | ||
| 112 | /* Taken from sysdep.c. */ | 112 | /* Taken from sysdep.c. */ |
| 113 | #ifndef HAVE_STRERROR | 113 | #ifndef HAVE_STRERROR |
| @@ -126,14 +126,14 @@ strerror (errnum) | |||
| 126 | #endif /* not WINDOWSNT */ | 126 | #endif /* not WINDOWSNT */ |
| 127 | #endif /* ! HAVE_STRERROR */ | 127 | #endif /* ! HAVE_STRERROR */ |
| 128 | 128 | ||
| 129 | void | 129 | static void |
| 130 | lose_syserr (const char *msg) | 130 | lose_syserr (const char *msg) |
| 131 | { | 131 | { |
| 132 | fprintf (stderr, "%s: %s\n", msg, strerror (errno)); | 132 | fprintf (stderr, "%s: %s\n", msg, strerror (errno)); |
| 133 | exit (EXIT_FAILURE); | 133 | exit (EXIT_FAILURE); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | char * | 136 | static char * |
| 137 | get_user_id (void) | 137 | get_user_id (void) |
| 138 | { | 138 | { |
| 139 | char *name; | 139 | char *name; |
| @@ -154,7 +154,7 @@ get_user_id (void) | |||
| 154 | return buf->pw_name; | 154 | return buf->pw_name; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | const char * | 157 | static const char * |
| 158 | get_prefix (int running_suid, const char *user_prefix) | 158 | get_prefix (int running_suid, const char *user_prefix) |
| 159 | { | 159 | { |
| 160 | if (!running_suid && user_prefix == NULL) | 160 | if (!running_suid && user_prefix == NULL) |
| @@ -258,7 +258,7 @@ main (int argc, char **argv) | |||
| 258 | exit (EXIT_SUCCESS); | 258 | exit (EXIT_SUCCESS); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | int | 261 | static int |
| 262 | read_score (FILE *f, struct score_entry *score) | 262 | read_score (FILE *f, struct score_entry *score) |
| 263 | { | 263 | { |
| 264 | int c; | 264 | int c; |
| @@ -342,7 +342,7 @@ read_score (FILE *f, struct score_entry *score) | |||
| 342 | return 0; | 342 | return 0; |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | int | 345 | static int |
| 346 | read_scores (const char *filename, struct score_entry **scores, int *count) | 346 | read_scores (const char *filename, struct score_entry **scores, int *count) |
| 347 | { | 347 | { |
| 348 | int readval, scorecount, cursize; | 348 | int readval, scorecount, cursize; |
| @@ -375,7 +375,7 @@ read_scores (const char *filename, struct score_entry **scores, int *count) | |||
| 375 | return 0; | 375 | return 0; |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | int | 378 | static int |
| 379 | score_compare (const void *a, const void *b) | 379 | score_compare (const void *a, const void *b) |
| 380 | { | 380 | { |
| 381 | const struct score_entry *sa = (const struct score_entry *) a; | 381 | const struct score_entry *sa = (const struct score_entry *) a; |
| @@ -383,7 +383,7 @@ score_compare (const void *a, const void *b) | |||
| 383 | return (sb->score > sa->score) - (sb->score < sa->score); | 383 | return (sb->score > sa->score) - (sb->score < sa->score); |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | int | 386 | static int |
| 387 | score_compare_reverse (const void *a, const void *b) | 387 | score_compare_reverse (const void *a, const void *b) |
| 388 | { | 388 | { |
| 389 | const struct score_entry *sa = (const struct score_entry *) a; | 389 | const struct score_entry *sa = (const struct score_entry *) a; |
| @@ -407,14 +407,14 @@ push_score (struct score_entry **scores, int *count, int newscore, char *usernam | |||
| 407 | return 0; | 407 | return 0; |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | void | 410 | static void |
| 411 | sort_scores (struct score_entry *scores, int count, int reverse) | 411 | sort_scores (struct score_entry *scores, int count, int reverse) |
| 412 | { | 412 | { |
| 413 | qsort (scores, count, sizeof (struct score_entry), | 413 | qsort (scores, count, sizeof (struct score_entry), |
| 414 | reverse ? score_compare_reverse : score_compare); | 414 | reverse ? score_compare_reverse : score_compare); |
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | int | 417 | static int |
| 418 | write_scores (const char *filename, const struct score_entry *scores, int count) | 418 | write_scores (const char *filename, const struct score_entry *scores, int count) |
| 419 | { | 419 | { |
| 420 | FILE *f; | 420 | FILE *f; |
| @@ -443,7 +443,7 @@ write_scores (const char *filename, const struct score_entry *scores, int count) | |||
| 443 | return 0; | 443 | return 0; |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | int | 446 | static int |
| 447 | lock_file (const char *filename, void **state) | 447 | lock_file (const char *filename, void **state) |
| 448 | { | 448 | { |
| 449 | int fd; | 449 | int fd; |
| @@ -484,7 +484,7 @@ lock_file (const char *filename, void **state) | |||
| 484 | return 0; | 484 | return 0; |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | int | 487 | static int |
| 488 | unlock_file (const char *filename, void *state) | 488 | unlock_file (const char *filename, void *state) |
| 489 | { | 489 | { |
| 490 | char *lockpath = (char *) state; | 490 | char *lockpath = (char *) state; |