diff options
author | Jim Meyering <meyering@redhat.com> | 2008-05-11 08:47:35 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-05-17 12:53:29 +0200 |
commit | 440e6f0cf9c8421ccd4576171d0c8b916cd681f0 (patch) | |
tree | d5a3664f5e2b8c50027eec3c5f11a041c09a4765 /libidu | |
parent | ff085957e84f5789871521a11b44afa27a48d72d (diff) | |
download | idutils-440e6f0cf9c8421ccd4576171d0c8b916cd681f0.tar.gz idutils-440e6f0cf9c8421ccd4576171d0c8b916cd681f0.tar.bz2 idutils-440e6f0cf9c8421ccd4576171d0c8b916cd681f0.zip |
tighten scope in libidu/, too
Mark with "extern" the symbols that belong that way.
Make the others static.
* libidu/dynvec.h (dv_fill):
* libidu/fnprint.c (cw_dlink):
* libidu/hash.h (qsort_cmp_t):
* libidu/idfile.h (io_func_t):
* libidu/scanners.c (lang_args_obstack, languages_0, languages_N):
(language_help_me, language_getopt, get_language):
(lang_args_index):
* libidu/walker.c (largest_member_file):
* maint.mk (extract_char, today):
* src/fid.c (long_options):
* src/fnid.c (cw_dlink):
* src/lid.c (cw_dlink):
* src/xtokid.c (cw_dlink):
Diffstat (limited to 'libidu')
-rw-r--r-- | libidu/dynvec.h | 10 | ||||
-rw-r--r-- | libidu/fnprint.c | 2 | ||||
-rw-r--r-- | libidu/hash.h | 37 | ||||
-rw-r--r-- | libidu/idfile.h | 11 | ||||
-rw-r--r-- | libidu/scanners.c | 21 | ||||
-rw-r--r-- | libidu/walker.c | 3 |
6 files changed, 43 insertions, 41 deletions
diff --git a/libidu/dynvec.h b/libidu/dynvec.h index f11b06c..6cf25d5 100644 --- a/libidu/dynvec.h +++ b/libidu/dynvec.h @@ -1,5 +1,5 @@ /* dynvec.h -- declarations for dynamically growable vectors - Copyright (C) 1995, 2007 Free Software Foundation, Inc. + Copyright (C) 1995, 2007, 2008 Free Software Foundation, Inc. Written by Greg McGary <gkm@gnu.ai.mit.edu> This program is free software; you can redistribute it and/or modify @@ -26,9 +26,9 @@ struct dynvec int dv_fill; }; -struct dynvec *make_dynvec (int n); -void dynvec_free (struct dynvec *dv); -void dynvec_freeze (struct dynvec *dv); -void dynvec_append (struct dynvec *dv, void *element); +extern struct dynvec *make_dynvec (int n); +extern void dynvec_free (struct dynvec *dv); +extern void dynvec_freeze (struct dynvec *dv); +extern void dynvec_append (struct dynvec *dv, void *element); #endif /* not _dynvec_h_ */ diff --git a/libidu/fnprint.c b/libidu/fnprint.c index e08e97e..813a5a9 100644 --- a/libidu/fnprint.c +++ b/libidu/fnprint.c @@ -35,7 +35,7 @@ static int common_prefix_suffix (struct file_link const *flink_1, struct file_link const *flink_2); extern void usage (void); -extern struct file_link *cw_dlink; +static struct file_link *cw_dlink; /* Return the file name with the suffix stripped off. */ diff --git a/libidu/hash.h b/libidu/hash.h index 118e651..81810be 100644 --- a/libidu/hash.h +++ b/libidu/hash.h @@ -1,5 +1,5 @@ /* hash.h -- decls for hash table - Copyright (C) 1995, 1999, 2007 Free Software Foundation, Inc. + Copyright (C) 1995, 1999, 2007, 2008 Free Software Foundation, Inc. Written by Greg McGary <gkm@gnu.ai.mit.edu> This program is free software; you can redistribute it and/or modify @@ -42,22 +42,25 @@ struct hash_table typedef int (*qsort_cmp_t) (void const *, void const *); -void hash_init (struct hash_table *ht, unsigned long size, - hash_func_t hash_1, hash_func_t hash_2, hash_cmp_func_t hash_cmp); -void hash_load (struct hash_table *ht, void *item_table, - unsigned long cardinality, unsigned long size); -void **hash_find_slot (struct hash_table *ht, void const *key); -void *hash_find_item (struct hash_table *ht, void const *key); -void *hash_insert (struct hash_table *ht, void *item); -void *hash_insert_at (struct hash_table *ht, void *item, void const *slot); -void *hash_delete (struct hash_table *ht, void const *item); -void *hash_delete_at (struct hash_table *ht, void const *slot); -void hash_delete_items (struct hash_table *ht); -void hash_free_items (struct hash_table *ht); -void hash_free (struct hash_table *ht, int free_items); -void hash_map (struct hash_table *ht, hash_map_func_t map); -void hash_print_stats (struct hash_table *ht, FILE *out_FILE); -void **hash_dump (struct hash_table *ht, void **vector_0, qsort_cmp_t compare); +extern void hash_init (struct hash_table *ht, unsigned long size, + hash_func_t hash_1, hash_func_t hash_2, + hash_cmp_func_t hash_cmp); +extern void hash_load (struct hash_table *ht, void *item_table, + unsigned long cardinality, unsigned long size); +extern void **hash_find_slot (struct hash_table *ht, void const *key); +extern void *hash_find_item (struct hash_table *ht, void const *key); +extern void *hash_insert (struct hash_table *ht, void *item); +extern void *hash_insert_at (struct hash_table *ht, void *item, + void const *slot); +extern void *hash_delete (struct hash_table *ht, void const *item); +extern void *hash_delete_at (struct hash_table *ht, void const *slot); +extern void hash_delete_items (struct hash_table *ht); +extern void hash_free_items (struct hash_table *ht); +extern void hash_free (struct hash_table *ht, int free_items); +extern void hash_map (struct hash_table *ht, hash_map_func_t map); +extern void hash_print_stats (struct hash_table *ht, FILE *out_FILE); +extern void **hash_dump (struct hash_table *ht, void **vector_0, + qsort_cmp_t compare); extern void *hash_deleted_item; #define HASH_VACANT(item) ((item) == 0 || (void *) (item) == hash_deleted_item) diff --git a/libidu/idfile.h b/libidu/idfile.h index 1e3b176..31d27a9 100644 --- a/libidu/idfile.h +++ b/libidu/idfile.h @@ -1,5 +1,5 @@ /* idfile.h -- decls for ID file header and constituent file names - Copyright (C) 1986, 1995, 1996, 1999, 2007 Free Software Foundation, Inc. + Copyright (C) 1986, 1995, 1996, 1999, 2007, 2008 Free Software Foundation, Inc. Written by Greg McGary <gkm@gnu.ai.mit.edu> This program is free software; you can redistribute it and/or modify @@ -175,7 +175,7 @@ extern struct file_link **maybe_read_id_file (char const *id_file_name, struct i extern int read_idhead (struct idhead *idhp); extern int write_idhead (struct idhead *idhp); extern int sizeof_idhead (void); -struct file_link *init_walker (struct idhead *idhp); +extern struct file_link *init_walker (struct idhead *idhp); extern void init_idh_obstacks (struct idhead *idhp); extern void init_idh_tables (struct idhead *idhp); @@ -195,10 +195,9 @@ extern enum separator_style parse_separator_style (char const *arg); extern void walk_flink (struct file_link *flink, struct dynvec *sub_dirs_vec); extern int chdir_to_link (struct file_link* dir_link); -void prune_file_names (char *str, struct file_link *from_link); -char **vectorize_string (char *string, char const *delimiter_class); -void include_languages (char *lang_names); -void exclude_languages (char *lang_names); +extern void prune_file_names (char *str, struct file_link *from_link); +extern void include_languages (char *lang_names); +extern void exclude_languages (char *lang_names); extern char *absolute_file_name (char *buffer, struct file_link const *flink); extern char *maybe_relative_file_name (char *buffer, struct file_link const *to_link, struct file_link const *from_link); diff --git a/libidu/scanners.c b/libidu/scanners.c index 9633c4d..92130dc 100644 --- a/libidu/scanners.c +++ b/libidu/scanners.c @@ -36,7 +36,7 @@ #include "tokflags.h" #include "iduglobal.h" -struct obstack lang_args_obstack; +static struct obstack lang_args_obstack; struct lang_args *lang_args_default = 0; struct lang_args *lang_args_list = 0; struct obstack tokens_obstack; @@ -74,7 +74,7 @@ static struct token *get_token_lisp (FILE *in_FILE, void const *args, int *flags static void *parse_args_lisp (char **argv, int argc); static void help_me_lisp (void); -struct language languages_0[] = +static const struct language const languages_0[] = { { "C", parse_args_c, get_token_c, help_me_c }, { "C++", parse_args_c, get_token_c, help_me_cpp }, @@ -84,12 +84,13 @@ struct language languages_0[] = { "perl", parse_args_perl, get_token_perl, help_me_perl }, { "lisp", parse_args_lisp, get_token_lisp, help_me_lisp } }; -struct language const *languages_N = &languages_0[cardinalityof (languages_0)]; +static struct language const *languages_N + = &languages_0[cardinalityof (languages_0)]; void language_help_me (void) { - struct language *lang; + const struct language *lang; for (lang = languages_0; lang < languages_N; lang++) { putchar ('\n'); @@ -117,23 +118,21 @@ language_save_arg (char *arg) void language_getopt (void) { - struct language *lang; - + const struct language *lang; for (lang = languages_0; lang < languages_N; lang++) if (lang->lg_argc) - lang->lg_parse_args (lang->lg_argv, lang->lg_argc); + lang->lg_parse_args ((char**)(lang->lg_argv), lang->lg_argc); } struct language * get_language (char const *lang_name) { - struct language *lang; - + const struct language *lang; for (lang = languages_0; lang < languages_N; lang++) if (strequ (lang_name, lang->lg_name)) { DEBUG (("lang=%s", lang_name)); - return lang; + return (struct language *) lang; } DEBUG (("!lang=%s", lang_name)); return 0; @@ -141,7 +140,7 @@ get_language (char const *lang_name) /****************************************************************************/ -int lang_args_index = 0; +static int lang_args_index = 0; void set_default_language (char const *lang_name) diff --git a/libidu/walker.c b/libidu/walker.c index 29d09b4..0234e9a 100644 --- a/libidu/walker.c +++ b/libidu/walker.c @@ -41,6 +41,7 @@ int walker_verbose_flag = 0; off_t largest_member_file = 0; +static char **vectorize_string (char *string, char const *delimiter_class); static int walk_dir (struct file_link *dir_link); static struct member_file *get_member_file (struct file_link *flink); static struct lang_args *get_lang_args (struct file_link const *flink); @@ -697,7 +698,7 @@ chdir_to_link (struct file_link *dir_link) } } -char ** +static char ** vectorize_string (char *string, char const *delimiter_class) { char **vector_0 = xmalloc (sizeof(char *) * (2 + strlen (string) / 2)); |