summaryrefslogtreecommitdiff
path: root/sunrpc
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2025-11-17 17:18:00 +0100
committerFlorian Weimer <fweimer@redhat.com>2025-11-18 08:35:44 +0100
commita025a9deef8ad0034e88785a6999014fa2808e12 (patch)
treeb764ec793e720fd3e7544a578228b278d02ada69 /sunrpc
parent6463953fec2a8c9acda19ecd49358aa1f80eb02f (diff)
nss: Clean up function pointer/void * unions
All our targets support casts between function pointers and void *, so we might as well use them. This change was largely auto-generated, with the following prompts. @getXXbyYY_r.c Remove the use of the `fct` union and replace it by pointer casts. Apply the same change to ether_* getnetgrent_r getnssent_r netname publickey . Do not use explicit `*` in function pointer calls. Replace `(*((lookup_function) fct))` and similar with `((lookup_function) fct)`. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/netname.c13
-rw-r--r--sunrpc/publickey.c24
2 files changed, 13 insertions, 24 deletions
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index d342fb8964..e2acf107a5 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -157,21 +157,18 @@ netname2user (const char *netname, uid_t * uidp, gid_t * gidp,
int *gidlenp, gid_t * gidlist)
{
nss_action_list nip;
- union
- {
- netname2user_function f;
- void *ptr;
- } fct;
+ void *fct;
enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
- no_more = __nss_publickey_lookup2 (&nip, "netname2user", NULL, &fct.ptr);
+ no_more = __nss_publickey_lookup2 (&nip, "netname2user", NULL, &fct);
while (!no_more)
{
- status = (*fct.f) (netname, uidp, gidp, gidlenp, gidlist);
+ status = ((netname2user_function) fct) (netname, uidp, gidp, gidlenp,
+ gidlist);
- no_more = __nss_next2 (&nip, "netname2user", NULL, &fct.ptr, status, 0);
+ no_more = __nss_next2 (&nip, "netname2user", NULL, &fct, status, 0);
}
return status == NSS_STATUS_SUCCESS;
diff --git a/sunrpc/publickey.c b/sunrpc/publickey.c
index 2480f8234c..812cb19ca0 100644
--- a/sunrpc/publickey.c
+++ b/sunrpc/publickey.c
@@ -34,21 +34,17 @@ int
getpublickey (const char *name, char *key)
{
nss_action_list nip;
- union
- {
- public_function f;
- void *ptr;
- } fct;
+ void *fct;
enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
- no_more = __nss_publickey_lookup2 (&nip, "getpublickey", NULL, &fct.ptr);
+ no_more = __nss_publickey_lookup2 (&nip, "getpublickey", NULL, &fct);
while (! no_more)
{
- status = (*fct.f) (name, key, &errno);
+ status = ((public_function) fct) (name, key, &errno);
- no_more = __nss_next2 (&nip, "getpublickey", NULL, &fct.ptr, status, 0);
+ no_more = __nss_next2 (&nip, "getpublickey", NULL, &fct, status, 0);
}
return status == NSS_STATUS_SUCCESS;
@@ -60,21 +56,17 @@ int
getsecretkey (const char *name, char *key, const char *passwd)
{
nss_action_list nip;
- union
- {
- secret_function f;
- void *ptr;
- } fct;
+ void *fct;
enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
- no_more = __nss_publickey_lookup2 (&nip, "getsecretkey", NULL, &fct.ptr);
+ no_more = __nss_publickey_lookup2 (&nip, "getsecretkey", NULL, &fct);
while (! no_more)
{
- status = (*fct.f) (name, key, passwd, &errno);
+ status = ((secret_function) fct) (name, key, passwd, &errno);
- no_more = __nss_next2 (&nip, "getsecretkey", NULL, &fct.ptr, status, 0);
+ no_more = __nss_next2 (&nip, "getsecretkey", NULL, &fct, status, 0);
}
return status == NSS_STATUS_SUCCESS;