svn commit: r227244 - head/usr.bin/whereis

Ed Schouten ed at FreeBSD.org
Sun Nov 6 18:50:20 UTC 2011


Author: ed
Date: Sun Nov  6 18:50:19 2011
New Revision: 227244
URL: http://svn.freebsd.org/changeset/base/227244

Log:
  Mark global functions and/or variables in whereis(1) static where possible.
  
  This allows compilers and static analyzers to more thorough analysis.

Modified:
  head/usr.bin/whereis/whereis.c

Modified: head/usr.bin/whereis/whereis.c
==============================================================================
--- head/usr.bin/whereis/whereis.c	Sun Nov  6 18:50:00 2011	(r227243)
+++ head/usr.bin/whereis/whereis.c	Sun Nov  6 18:50:19 2011	(r227244)
@@ -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;
-
-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 int opt_a, opt_b, opt_m, opt_q, opt_s, opt_u, opt_x;
+static ccharp *bindirs, *mandirs, *sourcedirs;
+static char **query;
+
+static const char *sourcepath = PATH_SOURCES;
+
+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 *
 /*
  * 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;


More information about the svn-src-all mailing list