This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 9/7] nss_nis: Use NSS_DECLARE_MODULE_FUNCTIONS
- From: Florian Weimer <fweimer at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Thu, 13 Feb 2020 10:01:30 +0100
- Subject: [PATCH 9/7] nss_nis: Use NSS_DECLARE_MODULE_FUNCTIONS
- References: <cover.1581517927.git.fweimer@redhat.com>
This commit removes the minor optimization based on strong aliases
because it loses type safety.
-----
nis/nss-nis.h | 1 +
nis/nss_nis/nis-hosts.c | 13 ++++++++-----
nis/nss_nis/nis-network.c | 15 ++++++++++-----
nis/nss_nis/nis-spwd.c | 13 +++++++++----
4 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/nis/nss-nis.h b/nis/nss-nis.h
index dc091d1a20..7c009d7e87 100644
--- a/nis/nss-nis.h
+++ b/nis/nss-nis.h
@@ -22,6 +22,7 @@
#include "nsswitch.h"
+NSS_DECLARE_MODULE_FUNCTIONS (nis)
/* Convert YP error number to NSS error number. */
extern const enum nss_status __yperr2nss_tab[] attribute_hidden;
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index 2d08076382..1ee5444cfc 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -90,9 +90,16 @@ static bool_t new_start = 1;
static char *oldkey = NULL;
static int oldkeylen = 0;
+hidden_proto (_nss_nis_endhostent)
enum nss_status
_nss_nis_sethostent (int stayopen)
+{
+ return _nss_nis_endhostent ();
+}
+
+enum nss_status
+_nss_nis_endhostent (void)
{
__libc_lock_lock (lock);
@@ -108,11 +115,7 @@ _nss_nis_sethostent (int stayopen)
return NSS_STATUS_SUCCESS;
}
-/* Make _nss_nis_endhostent an alias of _nss_nis_sethostent. We do this
- even though the prototypes don't match. The argument of sethostent
- is used so this makes no difference. */
-strong_alias (_nss_nis_sethostent, _nss_nis_endhostent)
-
+hidden_def (_nss_nis_endhostent)
/* The calling function always need to get a lock first. */
static enum nss_status
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index dcafd26148..511de00bd3 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -45,10 +45,18 @@ static bool_t new_start = 1;
static char *oldkey;
static int oldkeylen;
+hidden_proto (_nss_nis_endnetent)
+
enum nss_status
_nss_nis_setnetent (int stayopen)
{
- __libc_lock_lock (lock);
+ return _nss_nis_endnetent ();
+}
+
+enum nss_status
+_nss_nis_endnetent (void)
+{
+__libc_lock_lock (lock);
new_start = 1;
if (oldkey != NULL)
@@ -62,10 +70,7 @@ _nss_nis_setnetent (int stayopen)
return NSS_STATUS_SUCCESS;
}
-/* Make _nss_nis_endnetent an alias of _nss_nis_setnetent. We do this
- even though the prototypes don't match. The argument of setnetent
- is not used so this makes no difference. */
-strong_alias (_nss_nis_setnetent, _nss_nis_endnetent)
+hidden_def (_nss_nis_endnetent)
static enum nss_status
internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index 6cd46b4022..660447b544 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -46,8 +46,16 @@ static bool ent_adjunct_used;
static char *oldkey;
static int oldkeylen;
+hidden_proto (_nss_nis_endspent)
+
enum nss_status
_nss_nis_setspent (int stayopen)
+{
+ return _nss_nis_endspent ();
+}
+
+enum nss_status
+_nss_nis_endspent (void)
{
__libc_lock_lock (lock);
@@ -61,10 +69,7 @@ _nss_nis_setspent (int stayopen)
return NSS_STATUS_SUCCESS;
}
-/* Make _nss_nis_endspent an alias of _nss_nis_setspent. We do this
- even though the prototypes don't match. The argument of setspent
- is not used so this makes no difference. */
-strong_alias (_nss_nis_setspent, _nss_nis_endspent)
+hidden_def (_nss_nis_endspent)
static enum nss_status
internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,