From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 20:48:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF7FB106566B; Sun, 11 Dec 2011 20:48:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE9B88FC0C; Sun, 11 Dec 2011 20:48:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBKmeJc068408; Sun, 11 Dec 2011 20:48:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBKmeFb068406; Sun, 11 Dec 2011 20:48:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112112048.pBBKmeFb068406@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 20:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228422 - head/sbin/rcorder X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Dec 2011 20:48:40 -0000 Author: ed Date: Sun Dec 11 20:48:40 2011 New Revision: 228422 URL: http://svn.freebsd.org/changeset/base/228422 Log: 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%. Modified: head/sbin/rcorder/rcorder.c Modified: head/sbin/rcorder/rcorder.c ============================================================================== --- head/sbin/rcorder/rcorder.c Sun Dec 11 20:40:23 2011 (r228421) +++ head/sbin/rcorder/rcorder.c Sun Dec 11 20:48:40 2011 (r228422) @@ -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; - -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 strnodelist *bl_list; +static strnodelist *keep_list; +static strnodelist *skip_list; + +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 * 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 *buff * 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 *buff * 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 *buffe * 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 *buf * 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 *file 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) {