From: Steve Dickson <steved@redhat.com>
To: Libtirpc-devel Mailing List <libtirpc-devel@lists.sourceforge.net>
Cc: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 09/12] Convert old-style function definitions into modern-style definitions
Date: Mon, 18 Aug 2025 11:08:26 -0400 [thread overview]
Message-ID: <20250818150829.1044948-10-steved@redhat.com> (raw)
In-Reply-To: <20250818150829.1044948-1-steved@redhat.com>
With newer compilers (gcc 15.1.1) -Wold-style-definition
flag is set by default which causes warnings for
most of the functions in these files.
warning: old-style function definition [-Wold-style-definition]
The warnings are remove by converting the old-style
function definitions into modern-style definitions
Signed-off-by: Steve Dickson <steved@redhat.com>
---
src/getnetconfig.c | 24 +++++++++---------------
src/getnetpath.c | 12 +++++-------
src/getpublickey.c | 20 ++++++++++----------
src/getrpcport.c | 8 +++++---
4 files changed, 29 insertions(+), 35 deletions(-)
diff --git a/src/getnetconfig.c b/src/getnetconfig.c
index d547dce..58c4a5c 100644
--- a/src/getnetconfig.c
+++ b/src/getnetconfig.c
@@ -218,8 +218,7 @@ setnetconfig()
*/
struct netconfig *
-getnetconfig(handlep)
-void *handlep;
+getnetconfig(void *handlep)
{
struct netconfig_vars *ncp = (struct netconfig_vars *)handlep;
char *stringp; /* tmp string pointer */
@@ -354,8 +353,7 @@ void *handlep;
* previously).
*/
int
-endnetconfig(handlep)
-void *handlep;
+endnetconfig(void *handlep)
{
struct netconfig_vars *nc_handlep = (struct netconfig_vars *)handlep;
@@ -417,8 +415,7 @@ void *handlep;
*/
struct netconfig *
-getnetconfigent(netid)
- const char *netid;
+getnetconfigent(const char *netid)
{
FILE *file; /* NETCONFIG db's file pointer */
char *linep; /* holds current netconfig line */
@@ -516,8 +513,7 @@ getnetconfigent(netid)
*/
void
-freenetconfigent(netconfigp)
- struct netconfig *netconfigp;
+freenetconfigent(struct netconfig *netconfigp)
{
if (netconfigp != NULL) {
free(netconfigp->nc_netid); /* holds all netconfigp's strings */
@@ -541,9 +537,9 @@ freenetconfigent(netconfigp)
*/
static int
-parse_ncp(stringp, ncp)
-char *stringp; /* string to parse */
-struct netconfig *ncp; /* where to put results */
+parse_ncp(
+char *stringp, /* string to parse */
+struct netconfig *ncp) /* where to put results */
{
char *tokenp; /* for processing tokens */
char *lasts;
@@ -661,8 +657,7 @@ nc_sperror()
* Prints a message onto standard error describing the reason for failure.
*/
void
-nc_perror(s)
- const char *s;
+nc_perror(const char *s)
{
fprintf(stderr, "%s: %s\n", s, nc_sperror());
}
@@ -671,8 +666,7 @@ nc_perror(s)
* Duplicates the matched netconfig buffer.
*/
static struct netconfig *
-dup_ncp(ncp)
-struct netconfig *ncp;
+dup_ncp(struct netconfig *ncp)
{
struct netconfig *p;
char *tmp;
diff --git a/src/getnetpath.c b/src/getnetpath.c
index ea1a18c..795ea26 100644
--- a/src/getnetpath.c
+++ b/src/getnetpath.c
@@ -129,8 +129,7 @@ setnetpath()
*/
struct netconfig *
-getnetpath(handlep)
- void *handlep;
+getnetpath(void *handlep)
{
struct netpath_vars *np_sessionp = (struct netpath_vars *)handlep;
struct netconfig *ncp = NULL; /* temp. holds a netconfig session */
@@ -185,8 +184,7 @@ getnetpath(handlep)
* (e.g. if setnetpath() was not called previously.
*/
int
-endnetpath(handlep)
- void *handlep;
+endnetpath(void *handlep)
{
struct netpath_vars *np_sessionp = (struct netpath_vars *)handlep;
struct netpath_chain *chainp, *lastp;
@@ -222,9 +220,9 @@ endnetpath(handlep)
*/
char *
-_get_next_token(npp, token)
-char *npp; /* string */
-int token; /* char to parse string for */
+_get_next_token(
+char *npp, /* string */
+int token) /* char to parse string for */
{
char *cp; /* char pointer */
char *np; /* netpath pointer */
diff --git a/src/getpublickey.c b/src/getpublickey.c
index 4e96c7c..9d6b58c 100644
--- a/src/getpublickey.c
+++ b/src/getpublickey.c
@@ -58,16 +58,16 @@ int (*__getpublickey_LOCAL)(const char *, char *) = 0;
* Get somebody's public key
*/
int
-__getpublickey_real(netname, publickey)
- char *netname;
- char *publickey;
+__getpublickey_real(
+ const char *netname,
+ char *publickey)
{
char lookup[3 * HEXKEYBYTES];
char *p;
if (publickey == NULL)
return (0);
- if (!getpublicandprivatekey(netname, lookup))
+ if (!getpublicandprivatekey((char *)netname, lookup))
return (0);
p = strchr(lookup, ':');
if (p == NULL) {
@@ -85,9 +85,9 @@ __getpublickey_real(netname, publickey)
*/
int
-getpublicandprivatekey(key, ret)
- char *key;
- char *ret;
+getpublicandprivatekey(
+ char *key,
+ char *ret)
{
char buf[1024]; /* big enough */
char *res;
@@ -159,9 +159,9 @@ getpublicandprivatekey(key, ret)
}
}
-int getpublickey(netname, publickey)
- const char *netname;
- char *publickey;
+int getpublickey(
+ const char *netname,
+ char *publickey)
{
if (__getpublickey_LOCAL != NULL)
return(__getpublickey_LOCAL(netname, publickey));
diff --git a/src/getrpcport.c b/src/getrpcport.c
index c28cd61..497a2a2 100644
--- a/src/getrpcport.c
+++ b/src/getrpcport.c
@@ -43,9 +43,11 @@
#include <rpc/pmap_clnt.h>
int
-getrpcport(host, prognum, versnum, proto)
- char *host;
- int prognum, versnum, proto;
+getrpcport(
+ char *host,
+ int prognum,
+ int versnum,
+ int proto)
{
struct sockaddr_in addr;
struct hostent *hp;
--
2.50.1
next prev parent reply other threads:[~2025-08-18 15:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 15:08 [PATCH 00/12] Convert old-style function definitions into modern-style definitions Steve Dickson
2025-08-18 15:08 ` [PATCH 01/12] " Steve Dickson
2025-08-21 12:24 ` [Libtirpc-devel] " Steve Dickson
2025-08-25 15:05 ` Steve Dickson
2025-08-18 15:08 ` [PATCH 02/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 03/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 04/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 05/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 06/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 07/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 08/12] " Steve Dickson
2025-08-18 15:08 ` Steve Dickson [this message]
2025-08-18 15:08 ` [PATCH 10/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 11/12] " Steve Dickson
2025-08-18 15:08 ` [PATCH 12/12] " Steve Dickson
-- strict thread matches above, loose matches on Subject: below --
2025-08-21 11:15 [PATCH 00/12] " Steve Dickson
2025-08-21 11:15 ` [PATCH 09/12] " Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250818150829.1044948-10-steved@redhat.com \
--to=steved@redhat.com \
--cc=libtirpc-devel@lists.sourceforge.net \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).