Convert 29 more function definitions to prototype style (multiple parameters in one K&R parameter declaration).

This automatically-generated patch converts 29 function definitions in
glibc (including one in an example in the manual) from old-style K&R
to prototype-style.  Following my other recent such patches, this one
deals with the case of function definitions where one K&R parameter
declaration declares multiple parameters, as in:

void
foo (a, b)
     int a, *b;
{
}

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* crypt/crypt.c (_ufc_doit_r): Convert to prototype-style function
	definition.
	(_ufc_doit_r): Likewise.
	* crypt/crypt_util.c (_ufc_copymem): Likewise.
	(_ufc_output_conversion_r): Likewise.
	* inet/inet_mkadr.c (__inet_makeaddr): Likewise.
	* inet/rcmd.c (rcmd_af): Likewise.
	(rcmd): Likewise.
	(ruserok_af): Likewise.
	(ruserok): Likewise.
	(ruserok2_sa): Likewise.
	(ruserok_sa): Likewise.
	(iruserok_af): Likewise.
	(iruserok): Likewise.
	(__ivaliduser): Likewise.
	(__validuser2_sa): Likewise.
	* inet/rexec.c (rexec_af): Likewise.
	(rexec): Likewise.
	* inet/ruserpass.c (ruserpass): Likewise.
	* locale/programs/xmalloc.c (xcalloc): Likewise.
	* manual/examples/timeval_subtract.c (timeval_subtract): Likewise.
	* math/w_drem.c (__drem): Likewise.
	* math/w_dremf.c (__dremf): Likewise.
	* math/w_dreml.c (__dreml): Likewise.
	* misc/daemon.c (daemon): Likewise.
	* resolv/res_debug.c (p_fqnname): Likewise.
	* stdlib/div.c (div): Likewise.
	* string/memcmp.c (memcmp_bytes): Likewise.
	* sunrpc/pmap_rmt.c (pmap_rmtcall): Likewise.
	* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
This commit is contained in:
Joseph Myers 2015-10-20 11:52:27 +00:00
parent a72ddc1424
commit 41075ae3e7
18 changed files with 78 additions and 105 deletions

View File

@ -1,5 +1,36 @@
2015-10-20 Joseph Myers <joseph@codesourcery.com> 2015-10-20 Joseph Myers <joseph@codesourcery.com>
* crypt/crypt.c (_ufc_doit_r): Convert to prototype-style function
definition.
(_ufc_doit_r): Likewise.
* crypt/crypt_util.c (_ufc_copymem): Likewise.
(_ufc_output_conversion_r): Likewise.
* inet/inet_mkadr.c (__inet_makeaddr): Likewise.
* inet/rcmd.c (rcmd_af): Likewise.
(rcmd): Likewise.
(ruserok_af): Likewise.
(ruserok): Likewise.
(ruserok2_sa): Likewise.
(ruserok_sa): Likewise.
(iruserok_af): Likewise.
(iruserok): Likewise.
(__ivaliduser): Likewise.
(__validuser2_sa): Likewise.
* inet/rexec.c (rexec_af): Likewise.
(rexec): Likewise.
* inet/ruserpass.c (ruserpass): Likewise.
* locale/programs/xmalloc.c (xcalloc): Likewise.
* manual/examples/timeval_subtract.c (timeval_subtract): Likewise.
* math/w_drem.c (__drem): Likewise.
* math/w_dremf.c (__dremf): Likewise.
* math/w_dreml.c (__dreml): Likewise.
* misc/daemon.c (daemon): Likewise.
* resolv/res_debug.c (p_fqnname): Likewise.
* stdlib/div.c (div): Likewise.
* string/memcmp.c (memcmp_bytes): Likewise.
* sunrpc/pmap_rmt.c (pmap_rmtcall): Likewise.
* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
* crypt/cert.c (main): Convert to prototype-style function * crypt/cert.c (main): Convert to prototype-style function
definition. definition.
* io/pipe.c (__pipe): Likewise. * io/pipe.c (__pipe): Likewise.

View File

@ -34,9 +34,8 @@
#define SBA(sb, v) (*(long32*)((char*)(sb)+(v))) #define SBA(sb, v) (*(long32*)((char*)(sb)+(v)))
void void
_ufc_doit_r(itr, __data, res) _ufc_doit_r (ufc_long itr, struct crypt_data * __restrict __data,
ufc_long itr, *res; ufc_long *res)
struct crypt_data * __restrict __data;
{ {
int i; int i;
long32 s, *k; long32 s, *k;
@ -80,9 +79,8 @@ _ufc_doit_r(itr, __data, res)
#define SBA(sb, v) (*(long64*)((char*)(sb)+(v))) #define SBA(sb, v) (*(long64*)((char*)(sb)+(v)))
void void
_ufc_doit_r(itr, __data, res) _ufc_doit_r (ufc_long itr, struct crypt_data * __restrict __data,
ufc_long itr, *res; ufc_long *res)
struct crypt_data * __restrict __data;
{ {
int i; int i;
long64 l, r, s, *k; long64 l, r, s, *k;

View File

@ -304,9 +304,7 @@ _ufc_clearmem (char *start, int cnt)
} }
void void
_ufc_copymem(from, to, cnt) _ufc_copymem (char *from, char *to, int cnt)
char *from, *to;
int cnt;
{ {
while(cnt--) while(cnt--)
*to++ = *from++; *to++ = *from++;
@ -762,10 +760,8 @@ _ufc_dofinalperm_r (ufc_long *res, struct crypt_data * __restrict __data)
*/ */
void void
_ufc_output_conversion_r(v1, v2, salt, __data) _ufc_output_conversion_r (ufc_long v1, ufc_long v2, const char *salt,
ufc_long v1, v2; struct crypt_data * __restrict __data)
const char *salt;
struct crypt_data * __restrict __data;
{ {
int i, s, shf; int i, s, shf;

View File

@ -40,8 +40,7 @@ static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
* building addresses stored in the ifnet structure. * building addresses stored in the ifnet structure.
*/ */
struct in_addr struct in_addr
__inet_makeaddr(net, host) __inet_makeaddr (in_addr_t net, in_addr_t host)
in_addr_t net, host;
{ {
struct in_addr in; struct in_addr in;

View File

@ -103,12 +103,8 @@ libc_hidden_proto (iruserok_af)
libc_freeres_ptr(static char *ahostbuf); libc_freeres_ptr(static char *ahostbuf);
int int
rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) rcmd_af (char **ahost, u_short rport, const char *locuser, const char *remuser,
char **ahost; const char *cmd, int *fd2p, sa_family_t af)
u_short rport;
const char *locuser, *remuser, *cmd;
int *fd2p;
sa_family_t af;
{ {
char paddr[INET6_ADDRSTRLEN]; char paddr[INET6_ADDRSTRLEN];
struct addrinfo hints, *res, *ai; struct addrinfo hints, *res, *ai;
@ -360,11 +356,8 @@ bad:
libc_hidden_def (rcmd_af) libc_hidden_def (rcmd_af)
int int
rcmd(ahost, rport, locuser, remuser, cmd, fd2p) rcmd (char **ahost, u_short rport, const char *locuser, const char *remuser,
char **ahost; const char *cmd, int *fd2p)
u_short rport;
const char *locuser, *remuser, *cmd;
int *fd2p;
{ {
return rcmd_af (ahost, rport, locuser, remuser, cmd, fd2p, AF_INET); return rcmd_af (ahost, rport, locuser, remuser, cmd, fd2p, AF_INET);
} }
@ -438,10 +431,8 @@ int __check_rhosts_file = 1;
char *__rcmd_errstr; char *__rcmd_errstr;
int int
ruserok_af(rhost, superuser, ruser, luser, af) ruserok_af (const char *rhost, int superuser, const char *ruser,
const char *rhost, *ruser, *luser; const char *luser, sa_family_t af)
int superuser;
sa_family_t af;
{ {
struct addrinfo hints, *res, *res0; struct addrinfo hints, *res, *res0;
int gai; int gai;
@ -465,9 +456,8 @@ ruserok_af(rhost, superuser, ruser, luser, af)
libc_hidden_def (ruserok_af) libc_hidden_def (ruserok_af)
int int
ruserok(rhost, superuser, ruser, luser) ruserok (const char *rhost, int superuser, const char *ruser,
const char *rhost, *ruser, *luser; const char *luser)
int superuser;
{ {
return ruserok_af(rhost, superuser, ruser, luser, AF_INET); return ruserok_af(rhost, superuser, ruser, luser, AF_INET);
} }
@ -527,11 +517,8 @@ iruserfopen (const char *file, uid_t okuser)
* Returns 0 if ok, -1 if not ok. * Returns 0 if ok, -1 if not ok.
*/ */
static int static int
ruserok2_sa (ra, ralen, superuser, ruser, luser, rhost) ruserok2_sa (struct sockaddr *ra, size_t ralen, int superuser,
struct sockaddr *ra; const char *ruser, const char *luser, const char *rhost)
size_t ralen;
int superuser;
const char *ruser, *luser, *rhost;
{ {
FILE *hostf = NULL; FILE *hostf = NULL;
int isbad = -1; int isbad = -1;
@ -588,22 +575,17 @@ ruserok2_sa (ra, ralen, superuser, ruser, luser, rhost)
* ruserok_sa() is now discussed on ipng, so * ruserok_sa() is now discussed on ipng, so
* currently disabled for external use * currently disabled for external use
*/ */
static int ruserok_sa(ra, ralen, superuser, ruser, luser) static int
struct sockaddr *ra; ruserok_sa (struct sockaddr *ra, size_t ralen, int superuser,
size_t ralen; const char *ruser, const char *luser)
int superuser;
const char *ruser, *luser;
{ {
return ruserok2_sa(ra, ralen, superuser, ruser, luser, "-"); return ruserok2_sa(ra, ralen, superuser, ruser, luser, "-");
} }
/* This is the exported version. */ /* This is the exported version. */
int int
iruserok_af (raddr, superuser, ruser, luser, af) iruserok_af (const void *raddr, int superuser, const char *ruser,
const void *raddr; const char *luser, sa_family_t af)
int superuser;
const char *ruser, *luser;
sa_family_t af;
{ {
union { union {
struct sockaddr generic; struct sockaddr generic;
@ -632,10 +614,7 @@ iruserok_af (raddr, superuser, ruser, luser, af)
libc_hidden_def (iruserok_af) libc_hidden_def (iruserok_af)
int int
iruserok (raddr, superuser, ruser, luser) iruserok (u_int32_t raddr, int superuser, const char *ruser, const char *luser)
u_int32_t raddr;
int superuser;
const char *ruser, *luser;
{ {
return iruserok_af (&raddr, superuser, ruser, luser, AF_INET); return iruserok_af (&raddr, superuser, ruser, luser, AF_INET);
} }
@ -652,10 +631,8 @@ iruserok (raddr, superuser, ruser, luser)
* Returns 0 if ok, -1 if not ok. * Returns 0 if ok, -1 if not ok.
*/ */
int int
__ivaliduser(hostf, raddr, luser, ruser) __ivaliduser (FILE *hostf, u_int32_t raddr, const char *luser,
FILE *hostf; const char *ruser)
u_int32_t raddr;
const char *luser, *ruser;
{ {
struct sockaddr_in ra; struct sockaddr_in ra;
memset(&ra, '\0', sizeof(ra)); memset(&ra, '\0', sizeof(ra));
@ -766,11 +743,8 @@ __isempty (char *p)
* Returns 0 if positive match, -1 if _not_ ok. * Returns 0 if positive match, -1 if _not_ ok.
*/ */
static int static int
__validuser2_sa(hostf, ra, ralen, luser, ruser, rhost) __validuser2_sa (FILE *hostf, struct sockaddr *ra, size_t ralen,
FILE *hostf; const char *luser, const char *ruser, const char *rhost)
struct sockaddr *ra;
size_t ralen;
const char *luser, *ruser, *rhost;
{ {
const char *user; const char *user;
char *p; char *p;

View File

@ -49,12 +49,8 @@ int rexecoptions;
libc_freeres_ptr (static char *ahostbuf); libc_freeres_ptr (static char *ahostbuf);
int int
rexec_af(ahost, rport, name, pass, cmd, fd2p, af) rexec_af (char **ahost, int rport, const char *name, const char *pass,
char **ahost; const char *cmd, int *fd2p, sa_family_t af)
int rport;
const char *name, *pass, *cmd;
int *fd2p;
sa_family_t af;
{ {
struct sockaddr_storage from; struct sockaddr_storage from;
struct addrinfo hints, *res0; struct addrinfo hints, *res0;
@ -198,11 +194,8 @@ bad:
libc_hidden_def (rexec_af) libc_hidden_def (rexec_af)
int int
rexec(ahost, rport, name, pass, cmd, fd2p) rexec (char **ahost, int rport, const char *name, const char *pass,
char **ahost; const char *cmd, int *fd2p)
int rport;
const char *name, *pass, *cmd;
int *fd2p;
{ {
return rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET); return rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET);
} }

View File

@ -94,8 +94,7 @@ static const struct toktab {
int int
ruserpass(host, aname, apass) ruserpass (const char *host, const char **aname, const char **apass)
const char *host, **aname, **apass;
{ {
char *hdir, *buf, *tmp; char *hdir, *buf, *tmp;
char myname[1024], *mydomain; char myname[1024], *mydomain;

View File

@ -80,8 +80,7 @@ xmalloc (size_t n)
/* Allocate memory for N elements of S bytes, with error checking. */ /* Allocate memory for N elements of S bytes, with error checking. */
VOID * VOID *
xcalloc (n, s) xcalloc (size_t n, size_t s)
size_t n, s;
{ {
VOID *p; VOID *p;

View File

@ -20,8 +20,7 @@
Return 1 if the difference is negative, otherwise 0. */ Return 1 if the difference is negative, otherwise 0. */
int int
timeval_subtract (result, x, y) timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
struct timeval *result, *x, *y;
{ {
/* Perform the carry for the later subtraction by updating @var{y}. */ /* Perform the carry for the later subtraction by updating @var{y}. */
if (x->tv_usec < y->tv_usec) { if (x->tv_usec < y->tv_usec) {

View File

@ -8,8 +8,7 @@
#include <math.h> #include <math.h>
double double
__drem(x, y) __drem (double x, double y)
double x, y;
{ {
return __remainder(x, y); return __remainder(x, y);
} }

View File

@ -9,8 +9,7 @@
#include <math_private.h> #include <math_private.h>
float float
__dremf(x, y) __dremf (float x, float y)
float x, y;
{ {
return __remainderf(x, y); return __remainderf(x, y);
} }

View File

@ -10,8 +10,7 @@
#include <math.h> #include <math.h>
long double long double
__dreml(x, y) __dreml (long double x, long double y)
long double x, y;
{ {
return __remainderl(x, y); return __remainderl(x, y);
} }

View File

@ -41,8 +41,7 @@ static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
#include <not-cancel.h> #include <not-cancel.h>
int int
daemon(nochdir, noclose) daemon (int nochdir, int noclose)
int nochdir, noclose;
{ {
int fd; int fd;

View File

@ -307,11 +307,8 @@ p_cdname(const u_char *cp, const u_char *msg, FILE *file) {
length supplied). */ length supplied). */
const u_char * const u_char *
p_fqnname(cp, msg, msglen, name, namelen) p_fqnname (const u_char *cp, const u_char *msg, int msglen, char *name,
const u_char *cp, *msg; int namelen)
int msglen;
char *name;
int namelen;
{ {
int n, newlen; int n, newlen;

View File

@ -51,8 +51,7 @@
/* Return the `div_t' representation of NUMER over DENOM. */ /* Return the `div_t' representation of NUMER over DENOM. */
div_t div_t
div (numer, denom) div (int numer, int denom)
int numer, denom;
{ {
div_t result; div_t result;

View File

@ -93,8 +93,7 @@ typedef unsigned char byte;
static int memcmp_bytes (op_t, op_t) __THROW; static int memcmp_bytes (op_t, op_t) __THROW;
static int static int
memcmp_bytes (a, b) memcmp_bytes (op_t a, op_t b)
op_t a, b;
{ {
long int srcp1 = (long int) &a; long int srcp1 = (long int) &a;
long int srcp2 = (long int) &b; long int srcp2 = (long int) &b;

View File

@ -64,13 +64,9 @@ static const struct timeval timeout = {3, 0};
* programs to do a lookup and call in one step. * programs to do a lookup and call in one step.
*/ */
enum clnt_stat enum clnt_stat
pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_ptr) pmap_rmtcall (struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc,
struct sockaddr_in *addr; xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres, caddr_t resp,
u_long prog, vers, proc; struct timeval tout, u_long *port_ptr)
xdrproc_t xdrargs, xdrres;
caddr_t argsp, resp;
struct timeval tout;
u_long *port_ptr;
{ {
int socket = -1; int socket = -1;
CLIENT *client; CLIENT *client;

View File

@ -118,9 +118,7 @@ struct svcudp_data
* The routines returns NULL if a problem occurred. * The routines returns NULL if a problem occurred.
*/ */
SVCXPRT * SVCXPRT *
svcudp_bufcreate (sock, sendsz, recvsz) svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
int sock;
u_int sendsz, recvsz;
{ {
bool_t madesock = FALSE; bool_t madesock = FALSE;
SVCXPRT *xprt; SVCXPRT *xprt;