Date: Tue, 28 Jul 2015 02:32:41 +0000 (UTC) From: Marcelo Araujo <araujo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285926 - in head: libexec/ypxfr usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/yp_mkdb usr.sbin/yppush usr.sbin/ypserv Message-ID: <201507280232.t6S2WfSq043383@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: araujo (ports committer) Date: Tue Jul 28 02:32:40 2015 New Revision: 285926 URL: https://svnweb.freebsd.org/changeset/base/285926 Log: Staticfy and constify some variables and clean up the code a bit to make it more readable. No functional change. Differential Revision: D3166 Reviewed by: kib Sponsored by: gandi.net Modified: head/libexec/ypxfr/ypxfr_getmap.c head/libexec/ypxfr/ypxfr_main.c head/libexec/ypxfr/ypxfrd_getmap.c head/usr.bin/ypcat/ypcat.c head/usr.bin/ypmatch/ypmatch.c head/usr.bin/ypwhich/ypwhich.c head/usr.sbin/yp_mkdb/yp_mkdb.c head/usr.sbin/yppush/yppush_main.c head/usr.sbin/ypserv/yp_access.c head/usr.sbin/ypserv/yp_dblookup.c head/usr.sbin/ypserv/yp_error.c head/usr.sbin/ypserv/yp_main.c Modified: head/libexec/ypxfr/ypxfr_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfr_getmap.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfr_getmap.c Tue Jul 28 02:32:40 2015 (r285926) @@ -43,8 +43,8 @@ __FBSDID("$FreeBSD$"); extern bool_t xdr_ypresp_all_seq(XDR *, unsigned long *); -int (*ypresp_allfn)(); -void *ypresp_data; +static int (*ypresp_allfn)(); +static void *ypresp_data; extern DB *specdbp; extern enum ypstat yp_errno; Modified: head/libexec/ypxfr/ypxfr_main.c ============================================================================== --- head/libexec/ypxfr/ypxfr_main.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfr_main.c Tue Jul 28 02:32:40 2015 (r285926) @@ -54,12 +54,12 @@ __FBSDID("$FreeBSD$"); char *progname = "ypxfr"; char *yp_dir = _PATH_YP; int _rpcpmstart = 0; -int ypxfr_use_yplib = 0; /* Assume the worst. */ -int ypxfr_clear = 1; -int ypxfr_prognum = 0; -struct sockaddr_in ypxfr_callback_addr; -struct yppushresp_xfr ypxfr_resp; -DB *dbp; +static int ypxfr_use_yplib = 0; /* Assume the worst. */ +static int ypxfr_clear = 1; +static int ypxfr_prognum = 0; +static struct sockaddr_in ypxfr_callback_addr; +static struct yppushresp_xfr ypxfr_resp; +static DB *dbp; static void ypxfr_exit(ypxfrstat retval, char *temp) Modified: head/libexec/ypxfr/ypxfrd_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfrd_getmap.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfrd_getmap.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include "ypxfr_extern.h" -int fp = 0; +static int fp = 0; static bool_t xdr_my_xfr(register XDR *xdrs, xfr *objp) Modified: head/usr.bin/ypcat/ypcat.c ============================================================================== --- head/usr.bin/ypcat/ypcat.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypcat/ypcat.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, @@ -62,7 +62,7 @@ struct ypalias { { "ethers", "ethers.byname" }, }; -int key; +static int key; static void usage(void) Modified: head/usr.bin/ypmatch/ypmatch.c ============================================================================== --- head/usr.bin/ypmatch/ypmatch.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypmatch/ypmatch.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, Modified: head/usr.bin/ypwhich/ypwhich.c ============================================================================== --- head/usr.bin/ypwhich/ypwhich.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypwhich/ypwhich.c Tue Jul 28 02:32:40 2015 (r285926) @@ -59,9 +59,9 @@ __FBSDID("$FreeBSD$"); extern bool_t xdr_domainname(); -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, Modified: head/usr.sbin/yp_mkdb/yp_mkdb.c ============================================================================== --- head/usr.sbin/yp_mkdb/yp_mkdb.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/yp_mkdb/yp_mkdb.c Tue Jul 28 02:32:40 2015 (r285926) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include "ypxfr_extern.h" char *yp_dir = ""; /* No particular default needed. */ -int _rpcpmstart = 0; int debug = 1; static void @@ -66,7 +65,6 @@ usage(void) } #define PERM_SECURE (S_IRUSR|S_IWUSR) - static DB * open_db(char *path, int flags) { @@ -185,7 +183,6 @@ main(int argc, char *argv[]) * write to stdout; the db library doesn't let you * write to a file stream like that. */ - if (!strcmp(infile, "-")) { ifp = stdin; } else { @@ -327,7 +324,6 @@ main(int argc, char *argv[]) (void)(dbp->close)(dbp); doclear: - if (clear) { char in = 0; char *out = NULL; Modified: head/usr.sbin/yppush/yppush_main.c ============================================================================== --- head/usr.sbin/yppush/yppush_main.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/yppush/yppush_main.c Tue Jul 28 02:32:40 2015 (r285926) @@ -58,15 +58,15 @@ int debug = 1; int _rpcpmstart = 0; char *yp_dir = _PATH_YP; -char *yppush_mapname = NULL; /* Map to transfer. */ -char *yppush_domain = NULL; /* Domain in which map resides. */ -char *yppush_master = NULL; /* Master NIS server for said domain. */ -int skip_master = 0; /* Do not attempt to push map to master. */ -int verbose = 0; /* Toggle verbose mode. */ -unsigned long yppush_transid = 0; -int yppush_timeout = 80; /* Default timeout. */ -int yppush_jobs = 1; /* Number of allowed concurrent jobs. */ -int yppush_running_jobs = 0; /* Number of currently running jobs. */ +static char *yppush_mapname = NULL; /* Map to transfer. */ +static char *yppush_domain = NULL; /* Domain in which map resides. */ +static char *yppush_master = NULL; /* Master NIS server for said domain. */ +static int skip_master = 0; /* Do not attempt to push map to master. */ +static int verbose = 0; /* Toggle verbose mode. */ +static unsigned long yppush_transid = 0; +static int yppush_timeout = 80; /* Default timeout. */ +static int yppush_jobs = 1; /* Number of allowed concurrent jobs. */ +static int yppush_running_jobs = 0; /* Number of currently running jobs. */ /* Structure for holding information about a running job. */ struct jobs { @@ -80,8 +80,7 @@ struct jobs { struct jobs *next; }; -struct jobs *yppush_joblist; /* Linked list of running jobs. */ - +static struct jobs *yppush_joblist; /* Linked list of running jobs. */ static int yppush_svc_run(int); /* @@ -464,7 +463,8 @@ yppush_foreach(int status, char *key, in return (0); } -static void usage() +static void +usage() { fprintf (stderr, "%s\n%s\n", "usage: yppush [-d domain] [-t timeout] [-j #parallel jobs] [-h host]", Modified: head/usr.sbin/ypserv/yp_access.c ============================================================================== --- head/usr.sbin/ypserv/yp_access.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_access.c Tue Jul 28 02:32:40 2015 (r285926) @@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$"); extern int debug; - /* NIS v1 */ -const char *yp_procs[] = { +static const char *yp_procs[] = { + /* NIS v1 */ "ypoldproc_null", "ypoldproc_domain", "ypoldproc_domain_nonack", @@ -71,7 +71,7 @@ const char *yp_procs[] = { "badproc1", /* placeholder */ "badproc2", /* placeholder */ "badproc3", /* placeholder */ - + /* NIS v2 */ "ypproc_null", "ypproc_domain", @@ -93,7 +93,7 @@ struct securenet { struct securenet *next; }; -struct securenet *securenets; +static struct securenet *securenets; #define LINEBUFSZ 1024 Modified: head/usr.sbin/ypserv/yp_dblookup.c ============================================================================== --- head/usr.sbin/ypserv/yp_dblookup.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_dblookup.c Tue Jul 28 02:32:40 2015 (r285926) @@ -405,7 +405,7 @@ yp_open_db(const char *domain, const cha #ifdef DB_CACHE again: #endif - dbp = dbopen(buf,O_RDONLY, PERM_SECURE, DB_HASH, NULL); + dbp = dbopen(buf, O_RDONLY, PERM_SECURE, DB_HASH, NULL); if (dbp == NULL) { switch (errno) { Modified: head/usr.sbin/ypserv/yp_error.c ============================================================================== --- head/usr.sbin/ypserv/yp_error.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_error.c Tue Jul 28 02:32:40 2015 (r285926) @@ -46,13 +46,13 @@ __FBSDID("$FreeBSD$"); #include "yp_extern.h" int debug; -extern int _rpcpmstart; +extern int _rpcpmstart; extern char *progname; - static void __verr(const char *fmt, va_list ap) __printflike(1, 0); -static void __verr(const char *fmt, va_list ap) +static void +__verr(const char *fmt, va_list ap) { if (debug && !_rpcpmstart) { fprintf(stderr,"%s: ",progname); Modified: head/usr.sbin/ypserv/yp_main.c ============================================================================== --- head/usr.sbin/ypserv/yp_main.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_main.c Tue Jul 28 02:32:40 2015 (r285926) @@ -72,13 +72,11 @@ __FBSDID("$FreeBSD$"); #define _RPCSVC_CLOSEDOWN 120 int _rpcpmstart; /* Started by a port monitor ? */ -static int _rpcfdtype; - /* Whether Stream or Datagram ? */ +static int _rpcfdtype; /* Whether Stream or Datagram? */ static int _rpcaf; static int _rpcfd; - /* States a server can be in wrt request */ - +/* States a server can be in wrt request */ #define _IDLE 0 #define _SERVED 1 #define _SERVING 2
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507280232.t6S2WfSq043383>