about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-02-12 15:27:37 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-02-13 09:14:40 +0100
commit499a92df8b9fc64a054cf3b7f728f8967fc1da7d (patch)
tree2ac72ff8eab1985d7162fd0fd23d18fd7375a0e5 /nscd
parent8a9221415041543aa163071fa547e88138ceec9d (diff)
downloadglibc-499a92df8b9fc64a054cf3b7f728f8967fc1da7d.tar.gz
glibc-499a92df8b9fc64a054cf3b7f728f8967fc1da7d.tar.xz
glibc-499a92df8b9fc64a054cf3b7f728f8967fc1da7d.zip
nss: Add function types and NSS_DECLARE_MODULE_FUNCTIONS macro to <nss.h>
This macro allows to add type safety to the implementation of NSS
service modules.

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'nscd')
-rw-r--r--nscd/aicache.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 46db40fceb..ee9c9b8843 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -33,19 +33,6 @@
 #include "nscd.h"
 
 
-typedef enum nss_status (*nss_gethostbyname4_r)
-  (const char *name, struct gaih_addrtuple **pat,
-   char *buffer, size_t buflen, int *errnop,
-   int *h_errnop, int32_t *ttlp);
-typedef enum nss_status (*nss_gethostbyname3_r)
-  (const char *name, int af, struct hostent *host,
-   char *buffer, size_t buflen, int *errnop,
-   int *h_errnop, int32_t *, char **);
-typedef enum nss_status (*nss_getcanonname_r)
-  (const char *name, char *buffer, size_t buflen, char **result,
-   int *errnop, int *h_errnop);
-
-
 static const ai_response_header notfound =
 {
   .version = NSCD_VERSION,
@@ -127,8 +114,8 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
       char *canon = NULL;
       size_t canonlen;
 
-      nss_gethostbyname4_r fct4 = __nss_lookup_function (nip,
-							 "gethostbyname4_r");
+      nss_gethostbyname4_r *fct4 = __nss_lookup_function (nip,
+							  "gethostbyname4_r");
       if (fct4 != NULL)
 	{
 	  struct gaih_addrtuple atmem;
@@ -212,8 +199,8 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 	{
 	  /* Prefer the function which also returns the TTL and
 	     canonical name.  */
-	  nss_gethostbyname3_r fct = __nss_lookup_function (nip,
-							    "gethostbyname3_r");
+	  nss_gethostbyname3_r *fct
+	    = __nss_lookup_function (nip, "gethostbyname3_r");
 	  if (fct == NULL)
 	    fct = __nss_lookup_function (nip, "gethostbyname2_r");
 
@@ -279,7 +266,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 	  if (canon == NULL)
 	    {
 	      /* Determine the canonical name.  */
-	      nss_getcanonname_r cfct;
+	      nss_getcanonname_r *cfct;
 	      cfct = __nss_lookup_function (nip, "getcanonname_r");
 	      if (cfct != NULL)
 		{