From 2ba1b30bf50f04ab147452cfba7a3b9899f1d59c Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Sat, 5 Jul 2003 15:18:44 +0000 Subject: [PATCH] Changes following CScout analysis: - Removed dead declarations - Made objects that should have been declared as static, static. The changes use STATIC instead of static, following the existing convention in the rest of the code. Approved by: schweikh (mentor) MFC after: 2 weeks --- bin/sh/alias.c | 2 +- bin/sh/cd.c | 4 ++-- bin/sh/exec.c | 2 +- bin/sh/exec.h | 1 - bin/sh/expand.c | 12 ++++++------ bin/sh/input.c | 2 +- bin/sh/jobs.c | 8 ++++---- bin/sh/memalloc.c | 4 ++-- bin/sh/nodes.c.pat | 8 ++++---- bin/sh/output.c | 2 +- bin/sh/parser.c | 22 +++++++++++----------- bin/sh/redir.c | 2 +- bin/sh/var.c | 6 +++--- 13 files changed, 37 insertions(+), 38 deletions(-) diff --git a/bin/sh/alias.c b/bin/sh/alias.c index 1e4b81ccabce..45cfd74a2d53 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #define ATABSIZE 39 -struct alias *atab[ATABSIZE]; +STATIC struct alias *atab[ATABSIZE]; STATIC void setalias(char *, char *); STATIC int unalias(char *); diff --git a/bin/sh/cd.c b/bin/sh/cd.c index aa1fd5ab5a1b..3a45d95e6ea7 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -74,8 +74,8 @@ STATIC int docd(char *, int, int); STATIC char *getcomponent(void); STATIC int updatepwd(char *); -char *curdir = NULL; /* current working directory */ -char *prevdir; /* previous working directory */ +STATIC char *curdir = NULL; /* current working directory */ +STATIC char *prevdir; /* previous working directory */ STATIC char *cdcomppath; int diff --git a/bin/sh/exec.c b/bin/sh/exec.c index 21f247f4557b..5a1997742364 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -599,7 +599,7 @@ deletefuncs(void) * entry. */ -struct tblentry **lastcmdentry; +STATIC struct tblentry **lastcmdentry; STATIC struct tblentry * diff --git a/bin/sh/exec.h b/bin/sh/exec.h index 2d4743cda9d6..dd1fd81ce217 100644 --- a/bin/sh/exec.h +++ b/bin/sh/exec.h @@ -64,7 +64,6 @@ int find_builtin(char *); void hashcd(void); void changepath(const char *); void deletefuncs(void); -void getcmdentry(char *, struct cmdentry *); void addcmdentry(char *, struct cmdentry *); void defun(char *, union node *); int unsetfunc(char *); diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 214f53a9b224..4ff7427c7b96 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -90,11 +90,11 @@ struct ifsregion { }; -char *expdest; /* output of current string */ -struct nodelist *argbackq; /* list of back quote expressions */ -struct ifsregion ifsfirst; /* first struct in list of ifs regions */ -struct ifsregion *ifslastp; /* last struct in list */ -struct arglist exparg; /* holds expanded arg list */ +STATIC char *expdest; /* output of current string */ +STATIC struct nodelist *argbackq; /* list of back quote expressions */ +STATIC struct ifsregion ifsfirst; /* first struct in list of ifs regions */ +STATIC struct ifsregion *ifslastp; /* last struct in list */ +STATIC struct arglist exparg; /* holds expanded arg list */ STATIC void argstr(char *, int); STATIC char *exptilde(char *, int); @@ -1055,7 +1055,7 @@ ifsbreakup(char *string, struct arglist *arglist) * should be escapes. The results are stored in the list exparg. */ -char *expdir; +STATIC char *expdir; STATIC void diff --git a/bin/sh/input.c b/bin/sh/input.c index 47c7283962a8..85b94d6759ec 100644 --- a/bin/sh/input.c +++ b/bin/sh/input.c @@ -102,7 +102,7 @@ MKINIT int parselleft; /* copy of parsefile->lleft */ char *parsenextc; /* copy of parsefile->nextc */ MKINIT struct parsefile basepf; /* top level input file */ char basebuf[BUFSIZ]; /* buffer for top level input file */ -struct parsefile *parsefile = &basepf; /* current input file */ +STATIC struct parsefile *parsefile = &basepf; /* current input file */ int init_editline = 0; /* editline library initialized? */ int whichprompt; /* 1 == PS1, 2 == PS2 */ diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index f8ecbf888290..7c9cfa4005f9 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -76,12 +76,12 @@ __FBSDID("$FreeBSD$"); #include "mystring.h" -struct job *jobtab; /* array of jobs */ -int njobs; /* size of array */ +STATIC struct job *jobtab; /* array of jobs */ +STATIC int njobs; /* size of array */ MKINIT pid_t backgndpid = -1; /* pid of last background process */ #if JOBS -struct job *jobmru; /* most recently used job list */ -pid_t initialpgrp; /* pgrp of shell on invocation */ +STATIC struct job *jobmru; /* most recently used job list */ +STATIC pid_t initialpgrp; /* pgrp of shell on invocation */ #endif int in_waitcmd = 0; /* are we in waitcmd()? */ int in_dowait = 0; /* are we in dowait()? */ diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index cfe087e908d0..6334290bd10d 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -113,8 +113,8 @@ struct stack_block { }; #define SPACE(sp) ((char*)(sp) + ALIGN(sizeof(struct stack_block))) -struct stack_block *stackp; -struct stackmark *markp; +STATIC struct stack_block *stackp; +STATIC struct stackmark *markp; char *stacknxt; int stacknleft; int sstrnleft; diff --git a/bin/sh/nodes.c.pat b/bin/sh/nodes.c.pat index 80541b038e0d..631961337e0a 100644 --- a/bin/sh/nodes.c.pat +++ b/bin/sh/nodes.c.pat @@ -49,10 +49,10 @@ #include "mystring.h" -int funcblocksize; /* size of structures in function */ -int funcstringsize; /* size of strings in node */ -pointer funcblock; /* block to allocate function from */ -char *funcstring; /* block to allocate strings from */ +STATIC int funcblocksize; /* size of structures in function */ +STATIC int funcstringsize; /* size of strings in node */ +STATIC pointer funcblock; /* block to allocate function from */ +STATIC char *funcstring; /* block to allocate strings from */ %SIZES diff --git a/bin/sh/output.c b/bin/sh/output.c index b850d8005a4e..f332106ac4a9 100644 --- a/bin/sh/output.c +++ b/bin/sh/output.c @@ -161,7 +161,7 @@ outqstr(const char *p, struct output *file) out1c('\''); } -char out_junk[16]; +STATIC char out_junk[16]; void emptyoutbuf(struct output *dest) diff --git a/bin/sh/parser.c b/bin/sh/parser.c index e00df92aab86..da166e6503ba 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -84,19 +84,19 @@ struct heredoc { -struct heredoc *heredoclist; /* list of here documents to read */ -int parsebackquote; /* nonzero if we are inside backquotes */ -int doprompt; /* if set, prompt the user */ -int needprompt; /* true if interactive and at start of line */ -int lasttoken; /* last token read */ +STATIC struct heredoc *heredoclist; /* list of here documents to read */ +STATIC int parsebackquote; /* nonzero if we are inside backquotes */ +STATIC int doprompt; /* if set, prompt the user */ +STATIC int needprompt; /* true if interactive and at start of line */ +STATIC int lasttoken; /* last token read */ MKINIT int tokpushback; /* last token pushed back */ -char *wordtext; /* text of last word returned by readtoken */ +STATIC char *wordtext; /* text of last word returned by readtoken */ MKINIT int checkkwd; /* 1 == check for kwds, 2 == also eat newlines */ -struct nodelist *backquotelist; -union node *redirnode; -struct heredoc *heredoc; -int quoteflag; /* set if (part of) last token was quoted */ -int startlinno; /* line # where last token started */ +STATIC struct nodelist *backquotelist; +STATIC union node *redirnode; +STATIC struct heredoc *heredoc; +STATIC int quoteflag; /* set if (part of) last token was quoted */ +STATIC int startlinno; /* line # where last token started */ /* XXX When 'noaliases' is set to one, no alias expansion takes place. */ static int noaliases = 0; diff --git a/bin/sh/redir.c b/bin/sh/redir.c index 0a4588f57103..547cdcc4ac6b 100644 --- a/bin/sh/redir.c +++ b/bin/sh/redir.c @@ -84,7 +84,7 @@ MKINIT struct redirtab *redirlist; * background commands, where we want to redirect fd0 to /dev/null only * if it hasn't already been redirected. */ -int fd0_redirected = 0; +STATIC int fd0_redirected = 0; STATIC void openredirect(union node *, char[10 ]); STATIC int openhere(union node *); diff --git a/bin/sh/var.c b/bin/sh/var.c index 508867f269ef..7ef73f16eb05 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -93,9 +93,9 @@ struct var vppid; struct var vps1; struct var vps2; struct var vvers; -struct var voptind; +STATIC struct var voptind; -const struct varinit varinit[] = { +STATIC const struct varinit varinit[] = { #ifndef NO_HISTORY { &vhistsize, VSTRFIXED|VTEXTFIXED|VUNSET, "HISTSIZE=", sethistsize }, @@ -121,7 +121,7 @@ const struct varinit varinit[] = { NULL } }; -struct var *vartab[VTABSIZE]; +STATIC struct var *vartab[VTABSIZE]; STATIC struct var **hashvar(char *); STATIC int varequal(char *, char *);