Add more static keywords to rcorder(8).
The global variables and functions provided by rcorder.c are not used in the other C files, as the other C files only provide memory allocation and hash functions. This reduces the binary size by 10%.
This commit is contained in:
parent
405220fbc9
commit
8859c9b188
@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "hash.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
int debug = 0;
|
||||
static int debug = 0;
|
||||
# define DPRINTF(args) if (debug) { fflush(stdout); fprintf args; }
|
||||
#else
|
||||
# define DPRINTF(args)
|
||||
@ -124,33 +124,32 @@ struct filenode {
|
||||
strnodelist *keyword_list;
|
||||
};
|
||||
|
||||
filenode fn_head_s, *fn_head;
|
||||
static filenode fn_head_s, *fn_head;
|
||||
|
||||
strnodelist *bl_list;
|
||||
strnodelist *keep_list;
|
||||
strnodelist *skip_list;
|
||||
static strnodelist *bl_list;
|
||||
static strnodelist *keep_list;
|
||||
static strnodelist *skip_list;
|
||||
|
||||
void do_file(filenode *fnode);
|
||||
void strnode_add(strnodelist **, char *, filenode *);
|
||||
int skip_ok(filenode *fnode);
|
||||
int keep_ok(filenode *fnode);
|
||||
void satisfy_req(f_reqnode *rnode, char *filename);
|
||||
void crunch_file(char *);
|
||||
void parse_require(filenode *, char *);
|
||||
void parse_provide(filenode *, char *);
|
||||
void parse_before(filenode *, char *);
|
||||
void parse_keywords(filenode *, char *);
|
||||
filenode *filenode_new(char *);
|
||||
void add_require(filenode *, char *);
|
||||
void add_provide(filenode *, char *);
|
||||
void add_before(filenode *, char *);
|
||||
void add_keyword(filenode *, char *);
|
||||
void insert_before(void);
|
||||
Hash_Entry *make_fake_provision(filenode *);
|
||||
void crunch_all_files(void);
|
||||
void initialize(void);
|
||||
void generate_ordering(void);
|
||||
int main(int, char *[]);
|
||||
static void do_file(filenode *fnode);
|
||||
static void strnode_add(strnodelist **, char *, filenode *);
|
||||
static int skip_ok(filenode *fnode);
|
||||
static int keep_ok(filenode *fnode);
|
||||
static void satisfy_req(f_reqnode *rnode, char *filename);
|
||||
static void crunch_file(char *);
|
||||
static void parse_require(filenode *, char *);
|
||||
static void parse_provide(filenode *, char *);
|
||||
static void parse_before(filenode *, char *);
|
||||
static void parse_keywords(filenode *, char *);
|
||||
static filenode *filenode_new(char *);
|
||||
static void add_require(filenode *, char *);
|
||||
static void add_provide(filenode *, char *);
|
||||
static void add_before(filenode *, char *);
|
||||
static void add_keyword(filenode *, char *);
|
||||
static void insert_before(void);
|
||||
static Hash_Entry *make_fake_provision(filenode *);
|
||||
static void crunch_all_files(void);
|
||||
static void initialize(void);
|
||||
static void generate_ordering(void);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@ -196,7 +195,7 @@ main(int argc, char *argv[])
|
||||
/*
|
||||
* initialise various variables.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
initialize(void)
|
||||
{
|
||||
|
||||
@ -207,7 +206,7 @@ initialize(void)
|
||||
}
|
||||
|
||||
/* generic function to insert a new strnodelist element */
|
||||
void
|
||||
static void
|
||||
strnode_add(strnodelist **listp, char *s, filenode *fnode)
|
||||
{
|
||||
strnodelist *ent;
|
||||
@ -229,7 +228,7 @@ strnode_add(strnodelist **listp, char *s, filenode *fnode)
|
||||
* we have a new filename, create a new filenode structure.
|
||||
* fill in the bits, and put it in the filenode linked list
|
||||
*/
|
||||
filenode *
|
||||
static filenode *
|
||||
filenode_new(char *filename)
|
||||
{
|
||||
filenode *temp;
|
||||
@ -257,7 +256,7 @@ filenode_new(char *filename)
|
||||
/*
|
||||
* add a requirement to a filenode.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
add_require(filenode *fnode, char *s)
|
||||
{
|
||||
Hash_Entry *entry;
|
||||
@ -277,7 +276,7 @@ add_require(filenode *fnode, char *s)
|
||||
* add a provision to a filenode. if this provision doesn't
|
||||
* have a head node, create one here.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
add_provide(filenode *fnode, char *s)
|
||||
{
|
||||
Hash_Entry *entry;
|
||||
@ -356,7 +355,7 @@ add_provide(filenode *fnode, char *s)
|
||||
/*
|
||||
* put the BEFORE: lines to a list and handle them later.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
add_before(filenode *fnode, char *s)
|
||||
{
|
||||
strnodelist *bf_ent;
|
||||
@ -371,7 +370,7 @@ add_before(filenode *fnode, char *s)
|
||||
/*
|
||||
* add a key to a filenode.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
add_keyword(filenode *fnode, char *s)
|
||||
{
|
||||
|
||||
@ -382,7 +381,7 @@ add_keyword(filenode *fnode, char *s)
|
||||
* loop over the rest of a REQUIRE line, giving each word to
|
||||
* add_require() to do the real work.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
parse_require(filenode *node, char *buffer)
|
||||
{
|
||||
char *s;
|
||||
@ -396,7 +395,7 @@ parse_require(filenode *node, char *buffer)
|
||||
* loop over the rest of a PROVIDE line, giving each word to
|
||||
* add_provide() to do the real work.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
parse_provide(filenode *node, char *buffer)
|
||||
{
|
||||
char *s;
|
||||
@ -410,7 +409,7 @@ parse_provide(filenode *node, char *buffer)
|
||||
* loop over the rest of a BEFORE line, giving each word to
|
||||
* add_before() to do the real work.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
parse_before(filenode *node, char *buffer)
|
||||
{
|
||||
char *s;
|
||||
@ -424,7 +423,7 @@ parse_before(filenode *node, char *buffer)
|
||||
* loop over the rest of a KEYWORD line, giving each word to
|
||||
* add_keyword() to do the real work.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
parse_keywords(filenode *node, char *buffer)
|
||||
{
|
||||
char *s;
|
||||
@ -438,7 +437,7 @@ parse_keywords(filenode *node, char *buffer)
|
||||
* given a file name, create a filenode for it, read in lines looking
|
||||
* for provision and requirement lines, building the graphs as needed.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
crunch_file(char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
@ -510,7 +509,7 @@ crunch_file(char *filename)
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
Hash_Entry *
|
||||
static Hash_Entry *
|
||||
make_fake_provision(filenode *node)
|
||||
{
|
||||
Hash_Entry *entry;
|
||||
@ -556,7 +555,7 @@ make_fake_provision(filenode *node)
|
||||
* for each entry in the provision list for S, add a requirement to
|
||||
* that provisions filenode for P.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
insert_before(void)
|
||||
{
|
||||
Hash_Entry *entry, *fake_prov_entry;
|
||||
@ -594,7 +593,7 @@ insert_before(void)
|
||||
* real work. after we have built all the nodes, insert the BEFORE:
|
||||
* lines into graph(s).
|
||||
*/
|
||||
void
|
||||
static void
|
||||
crunch_all_files(void)
|
||||
{
|
||||
int i;
|
||||
@ -619,7 +618,7 @@ crunch_all_files(void)
|
||||
* calling do_file() (enter recursion) for each filenode in this
|
||||
* provision.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
satisfy_req(f_reqnode *rnode, char *filename)
|
||||
{
|
||||
Hash_Entry *entry;
|
||||
@ -660,7 +659,7 @@ satisfy_req(f_reqnode *rnode, char *filename)
|
||||
do_file(head->next->fnode);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
skip_ok(filenode *fnode)
|
||||
{
|
||||
strnodelist *s;
|
||||
@ -674,7 +673,7 @@ skip_ok(filenode *fnode)
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
keep_ok(filenode *fnode)
|
||||
{
|
||||
strnodelist *s;
|
||||
@ -699,7 +698,7 @@ keep_ok(filenode *fnode)
|
||||
* safely free() anything related to items that may be recursed on.
|
||||
* Circular dependancies will cause problems if we do.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
do_file(filenode *fnode)
|
||||
{
|
||||
f_reqnode *r, *r_tmp;
|
||||
@ -782,7 +781,7 @@ do_file(filenode *fnode)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
generate_ordering(void)
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user