summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-05-10 18:02:27 +0200
committerJim Meyering <meyering@redhat.com>2008-05-17 12:53:29 +0200
commit0b94c83e343bbb3d86fb0fa5225653eca5a6f2a2 (patch)
tree0fcb9786b9ff9a649f4ad179af0ad28d470f57d4 /src
parentdc52ae2e46bed0383fe471e253015c61e98b3ad3 (diff)
downloadidutils-0b94c83e343bbb3d86fb0fa5225653eca5a6f2a2.tar.gz
idutils-0b94c83e343bbb3d86fb0fa5225653eca5a6f2a2.tar.bz2
idutils-0b94c83e343bbb3d86fb0fa5225653eca5a6f2a2.zip
declare many global variable to be "static"
Remove the few that were thus exposed as being unused. Remove some unused prototypes.
Diffstat (limited to 'src')
-rw-r--r--src/fid.c10
-rw-r--r--src/fnid.c8
-rw-r--r--src/lid.c55
-rw-r--r--src/mkid.c55
-rw-r--r--src/xtokid.c6
5 files changed, 65 insertions, 69 deletions
diff --git a/src/fid.c b/src/fid.c
index 1b160f4..9869075 100644
--- a/src/fid.c
+++ b/src/fid.c
@@ -39,7 +39,7 @@ static void skip_hits (unsigned char const **hits, int level);
void usage (void);
struct idhead idh;
-int tree8_levels;
+static int tree8_levels;
/* The name this program was run with. */
@@ -55,10 +55,10 @@ static int show_version;
/* The file name of the ID database. */
-struct file_link *cw_dlink;
-struct file_link **members_0;
-unsigned int bits_vec_size;
-char *hits_buf;
+static struct file_link *cw_dlink;
+static struct file_link **members_0;
+static unsigned int bits_vec_size;
+static char *hits_buf;
static struct option const long_options[] =
{
diff --git a/src/fnid.c b/src/fnid.c
index a8d9f17..0dbf269 100644
--- a/src/fnid.c
+++ b/src/fnid.c
@@ -33,19 +33,17 @@
#include "idfile.h"
#include "iduglobal.h"
-void scan_member_file (struct member_file const *member);
void usage (void);
char const *program_name;
-int show_version = 0;
-int show_help = 0;
+static int show_version = 0;
+static int show_help = 0;
struct idhead idh;
struct file_link *cw_dlink;
-int no_id_flag = 1;
/* How shall we separate file names? */
-enum separator_style separator_style = ss_contextual;
+static enum separator_style separator_style = ss_contextual;
void
usage (void)
diff --git a/src/lid.c b/src/lid.c
index 89fb2f6..4ca37a3 100644
--- a/src/lid.c
+++ b/src/lid.c
@@ -144,13 +144,12 @@ static void chartty (void);
/* Sorry about all the globals, but it's really cleaner this way. */
-char anchor_dir[BUFSIZ];
-int tree8_levels;
-unsigned int bits_vec_size;
+static int tree8_levels;
+static unsigned int bits_vec_size;
struct idhead idh;
-char *hits_buf_1;
-char *hits_buf_2;
-unsigned char *bits_vec;
+static char *hits_buf_1;
+static char *hits_buf_2;
+static unsigned char *bits_vec;
/* The name this program was run with. */
@@ -166,52 +165,52 @@ static int show_version;
/* Which radixes do we want? */
-int radix_flag = radix_all;
+static int radix_flag = radix_all;
/* If nonzero, ignore differences in alphabetic case while matching. */
-int ignore_case_flag = 0;
+static int ignore_case_flag = 0;
/* How will patterns will be delimited? */
-enum delimiter_style delimiter_style = ds_contextual;
+static enum delimiter_style delimiter_style = ds_contextual;
/* How will patterns be interpreted? */
-enum pattern_style pattern_style = ps_contextual;
+static enum pattern_style pattern_style = ps_contextual;
/* How will keys be presented? */
-enum key_style key_style = ks_token;
+static enum key_style key_style = ks_token;
/* How will query results be presented? */
-enum result_style result_style = rs_filenames;
+static enum result_style result_style = rs_filenames;
/* How shall we separate file names when result_style == rs_filenames? */
-enum separator_style separator_style = ss_contextual;
+static enum separator_style separator_style = ss_contextual;
/* If non-zero, list identifiers that are are non-unique within this
number of leading characters. */
-unsigned int ambiguous_prefix_length = 0;
+static unsigned int ambiguous_prefix_length = 0;
/* The style of report. */
-report_func_t report_function;
+static report_func_t report_function;
/* The style of query. */
-query_func_t query_function;
+static query_func_t query_function;
/* Lower and upper bounds on occurrence frequency. */
-unsigned int frequency_low = 1;
-unsigned int frequency_high = USHRT_MAX;
+static unsigned int frequency_low = 1;
+static unsigned int frequency_high = USHRT_MAX;
struct file_link *cw_dlink;
-struct file_link **members_0;
+static struct file_link **members_0;
static struct option const long_options[] =
{
@@ -1478,9 +1477,9 @@ tree8_to_flinkv (unsigned char const *hits_tree8)
#if HAVE_TERMIOS_H
#include <termios.h>
-struct termios linemode;
-struct termios charmode;
-struct termios savemode;
+static struct termios linemode;
+static struct termios charmode;
+static struct termios savemode;
#define GET_TTY_MODES(modes) tcgetattr (0, (modes))
#define SET_TTY_MODES(modes) tcsetattr(0, TCSANOW, (modes))
@@ -1493,9 +1492,9 @@ struct termios savemode;
# if HAVE_TERMIO_H
# include <termio.h>
-struct termio linemode;
-struct termio charmode;
-struct termio savemode;
+static struct termio linemode;
+static struct termio charmode;
+static struct termio savemode;
#define GET_TTY_MODES(modes) ioctl (0, TCGETA, (modes))
#define SET_TTY_MODES(modes) ioctl (0, TCSETA, (modes))
@@ -1504,9 +1503,9 @@ struct termio savemode;
# if HAVE_SGTTY_H
# include <sgtty.h>
-struct sgttyb linemode;
-struct sgttyb charmode;
-struct sgttyb savemode;
+static struct sgttyb linemode;
+static struct sgttyb charmode;
+static struct sgttyb savemode;
# ifdef TIOCGETP
#define GET_TTY_MODES(modes) ioctl (0, TIOCGETP, (modes))
diff --git a/src/mkid.c b/src/mkid.c
index 829d111..fdf9926 100644
--- a/src/mkid.c
+++ b/src/mkid.c
@@ -89,38 +89,37 @@ static void write_hits (FILE *fp, struct summary *summary,
static void sign_token (struct token *token);
static void add_token_to_summary (struct summary *summary, struct token *token);
-struct hash_table token_table;
+static struct hash_table token_table;
/* Miscellaneous statistics */
-unsigned long input_chars;
-unsigned long name_tokens;
-unsigned long number_tokens;
-unsigned long string_tokens;
-unsigned long literal_tokens;
-unsigned long comment_tokens;
-unsigned long occurrences;
-unsigned long hits_length = 0;
-unsigned long tokens_length = 0;
-unsigned long output_length = 0;
-
-int verbose_flag = 0;
-int statistics_flag = 0;
-
-int file_name_count = 0; /* # of files in database */
-int levels = 0; /* ceil(log(8)) of file_name_count */
-
-unsigned char *current_hits_signature;
+static unsigned long input_chars;
+static unsigned long name_tokens;
+static unsigned long number_tokens;
+static unsigned long string_tokens;
+static unsigned long literal_tokens;
+static unsigned long comment_tokens;
+static unsigned long occurrences;
+static unsigned long hits_length = 0;
+static unsigned long tokens_length = 0;
+static unsigned long output_length = 0;
+
+static int verbose_flag = 0;
+static int statistics_flag = 0;
+
+static int levels = 0; /* ceil(log(8)) of file_name_count */
+
+static unsigned char *current_hits_signature;
#define INIT_TOKENS_SIZE(level) (1 << ((level) + 13))
-struct summary *summary_root;
-struct summary *summary_leaf;
+static struct summary *summary_root;
+static struct summary *summary_leaf;
char const *program_name;
-char *lang_map_file_name = 0;
-int show_version = 0;
-int show_help = 0;
+static char *lang_map_file_name = 0;
+static int show_version = 0;
+static int show_help = 0;
struct idhead idh;
-struct file_link *cw_dlink;
+static struct file_link *cw_dlink;
void
usage (void)
@@ -181,9 +180,9 @@ The following arguments apply to the language-specific scanners:\n\
exit (0);
}
-void *heap_initial;
-void *heap_after_walk;
-void *heap_after_scan;
+static void *heap_initial;
+static void *heap_after_walk;
+static void *heap_after_scan;
static void *get_process_heap(void)
{
diff --git a/src/xtokid.c b/src/xtokid.c
index e04ac9b..1e5768e 100644
--- a/src/xtokid.c
+++ b/src/xtokid.c
@@ -36,9 +36,9 @@ static void scan_member_file (struct member_file const *member);
void usage (void);
char const *program_name;
-char *lang_map_file_name = 0;
-int show_version = 0;
-int show_help = 0;
+static char *lang_map_file_name = 0;
+static int show_version = 0;
+static int show_help = 0;
struct idhead idh;
struct file_link *cw_dlink;