Date: Mon, 14 Dec 2009 16:54:39 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r200515 - head/usr.bin/xinstall Message-ID: <200912141654.nBEGsdWk032116@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Dec 14 16:54:39 2009 New Revision: 200515 URL: http://svn.freebsd.org/changeset/base/200515 Log: Style improvements: - Sort function prototypes; - Apply static on all function bodies. To quote bde@: > It is a good obfuscation to declare functions as static only in the > prototype, so that you can't see the static for the actual function. > The reverse obfuscation (with static only in the function definition) > would make more sense, but is a constraint error. Reviewed by: bde Modified: head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/xinstall.c ============================================================================== --- head/usr.bin/xinstall/xinstall.c Mon Dec 14 15:32:32 2009 (r200514) +++ head/usr.bin/xinstall/xinstall.c Mon Dec 14 16:54:39 2009 (r200515) @@ -85,8 +85,8 @@ int dobackup, docompare, dodir, dopreser mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; const char *suffix = BACKUP_SUFFIX; -static void copy(int, const char *, int, const char *, off_t); static int compare(int, const char *, size_t, int, const char *, size_t); +static void copy(int, const char *, int, const char *, off_t); static int create_newfile(const char *, int, struct stat *); static int create_tempfile(const char *, char *, size_t); static void install(const char *, const char *, u_long, u_int); @@ -246,7 +246,7 @@ main(int argc, char *argv[]) /* NOTREACHED */ } -u_long +static u_long numeric_id(const char *name, const char *type) { u_long val; @@ -269,7 +269,7 @@ numeric_id(const char *name, const char * install -- * build a path name and install the file */ -void +static void install(const char *from_name, const char *to_name, u_long fset, u_int flags) { struct stat from_sb, temp_sb, to_sb; @@ -523,7 +523,7 @@ install(const char *from_name, const cha * compare -- * compare two files; non-zero means files differ */ -int +static int compare(int from_fd, const char *from_name __unused, size_t from_len, int to_fd, const char *to_name __unused, size_t to_len) { @@ -587,7 +587,7 @@ compare(int from_fd, const char *from_na * create_tempfile -- * create a temporary file based on path and open it */ -int +static int create_tempfile(const char *path, char *temp, size_t tsize) { char *p; @@ -607,7 +607,7 @@ create_tempfile(const char *path, char * * create_newfile -- * create a new file, overwriting an existing one if necessary */ -int +static int create_newfile(const char *path, int target, struct stat *sbp) { char backup[MAXPATHLEN]; @@ -650,7 +650,7 @@ create_newfile(const char *path, int tar * copy -- * copy from one file to another */ -void +static void copy(int from_fd, const char *from_name, int to_fd, const char *to_name, off_t size) { @@ -703,7 +703,7 @@ copy(int from_fd, const char *from_name, * strip -- * use strip(1) to strip the target file */ -void +static void strip(const char *to_name) { const char *stripbin; @@ -735,7 +735,7 @@ strip(const char *to_name) * install_dir -- * build directory heirarchy */ -void +static void install_dir(char *path) { char *p; @@ -769,7 +769,7 @@ install_dir(char *path) * usage -- * print a usage message and die */ -void +static void usage(void) { (void)fprintf(stderr, @@ -786,7 +786,7 @@ usage(void) * trymmap -- * return true (1) if mmap should be tried, false (0) if not. */ -int +static int trymmap(int fd) { /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912141654.nBEGsdWk032116>