Mark global functions and/or variables in whereis(1) static where possible.

This allows compilers and static analyzers to more thorough analysis.
This commit is contained in:
ed 2011-11-06 18:50:19 +00:00
parent 8ea5e6afe9
commit 90167b1812

View File

@ -56,18 +56,18 @@ __FBSDID("$FreeBSD$");
typedef const char *ccharp;
int opt_a, opt_b, opt_m, opt_q, opt_s, opt_u, opt_x;
ccharp *bindirs, *mandirs, *sourcedirs;
char **query;
static int opt_a, opt_b, opt_m, opt_q, opt_s, opt_u, opt_x;
static ccharp *bindirs, *mandirs, *sourcedirs;
static char **query;
const char *sourcepath = PATH_SOURCES;
static const char *sourcepath = PATH_SOURCES;
char *colonify(ccharp *);
int contains(ccharp *, const char *);
void decolonify(char *, ccharp **, int *);
void defaults(void);
void scanopts(int, char **);
void usage(void);
static char *colonify(ccharp *);
static int contains(ccharp *, const char *);
static void decolonify(char *, ccharp **, int *);
static void defaults(void);
static void scanopts(int, char **);
static void usage(void);
/*
* Throughout this program, a number of strings are dynamically
@ -85,7 +85,7 @@ void usage(void);
* abort(3) in case of an allocation failure.
*/
void
static void
usage(void)
{
(void)fprintf(stderr,
@ -99,7 +99,7 @@ usage(void)
* Note that the -B/-M/-S options expect a list of directory
* names that must be terminated with -f.
*/
void
static void
scanopts(int argc, char **argv)
{
int c, i;
@ -174,7 +174,7 @@ scanopts(int argc, char **argv)
/*
* Find out whether string `s' is contained in list `cpp'.
*/
int
static int
contains(ccharp *cpp, const char *s)
{
ccharp cp;
@ -197,7 +197,7 @@ contains(ccharp *cpp, const char *s)
* partial string is only added if it has a length greater than 0, and
* if it's not already contained in the string list.
*/
void
static void
decolonify(char *s, ccharp **cppp, int *ip)
{
char *cp;
@ -223,7 +223,7 @@ decolonify(char *s, ccharp **cppp, int *ip)
/*
* Join string list `cpp' into a colon-separated string.
*/
char *
static char *
colonify(ccharp *cpp)
{
size_t s;
@ -249,7 +249,7 @@ colonify(ccharp *cpp)
/*
* Provide defaults for all options and directory lists.
*/
void
static void
defaults(void)
{
size_t s;