This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Further warnings patches



Looking at the remaining prototype warnings, I fixed some more nis
warnings.  I also moved struct etherent to a common include file to
avoid declaring it in four different places (and even with different
names).

I've committed the appended patch,

Andreas

2000-12-21  Andreas Jaeger  <aj@suse.de>

	* nis/nss_nisplus/nisplus-ethers.c (struct etherent): Removed.
	* inet/ether_hton.c: Likewise
	* inet/ether_ntoh.c: Likewise.

	* nis/nss_nis/nis-ethers.c (_nss_nis_getntohost_r): Fix
	declaration to match prototype.

	* include/netinet/ether.h (struct etherent): Declare here so that
	all implementations use the same struct.

	* nis/nss_nis/nis-ethers.c: Include netinet/ether.h to get
	prototypes.
	(struct ether): Removed.
	Use struct etherent instead of ether everywhere.

	* include/rpc/auth.h (DECLARE_NSS_PROTOTYPES): New.

	* include/rpc/auth_des.h (DECLARE_NSS_PROTOTYPES): New.

	* sunrpc/publickey.c: Include auth_des.h for prototypes.


============================================================
Index: nis/nss_nisplus/nisplus-ethers.c
--- nis/nss_nisplus/nisplus-ethers.c	1998/02/27 08:45:57	1.12
+++ nis/nss_nisplus/nisplus-ethers.c	2000/12/21 14:30:27
@@ -35,15 +35,6 @@
 static nis_name tablename_val = NULL;
 static u_long tablename_len = 0;
 
-/* Because the `ethers' lookup does not fit so well in the scheme so
-   we define a dummy struct here which helps us to use the available
-   functions.  */
-struct etherent
-{
-  const char *e_name;
-  struct ether_addr e_addr;
-};
-struct etherent_data {};
 
 #define NISENTRYVAL(idx,col,res) \
         ((res)->objects.objects_val[(idx)].zo_data.objdata_u.en_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
@@ -53,7 +44,7 @@
 
 static int
 _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
-			   char *buffer, size_t buflen, int *errnop)
+			     char *buffer, size_t buflen, int *errnop)
 {
   char *p = buffer;
   size_t room_left = buflen;
============================================================
Index: inet/ether_hton.c
--- inet/ether_hton.c	1999/08/04 01:04:45	1.7
+++ inet/ether_hton.c	2000/12/21 14:30:27
@@ -24,16 +24,6 @@
 
 #include "../nss/nsswitch.h"
 
-/* Because the `ethers' lookup does not fit so well in the scheme so
-   we define a dummy struct here which helps us to use the available
-   functions.  */
-struct etherent
-{
-  const char *e_name;
-  struct ether_addr e_addr;
-};
-
-
 /* Type of the lookup function we need here.  */
 typedef int (*lookup_function) (const char *, struct etherent *, char *, int,
 				int *);
============================================================
Index: inet/ether_ntoh.c
--- inet/ether_ntoh.c	1999/04/28 21:45:58	1.5
+++ inet/ether_ntoh.c	2000/12/21 14:30:27
@@ -23,15 +23,6 @@
 
 #include <nss/nsswitch.h>
 
-/* Because the `ethers' lookup does not fit so well in the scheme so
-   we define a dummy struct here which helps us to use the available
-   functions.  */
-struct etherent
-{
-  const char *e_name;
-  struct ether_addr e_addr;
-};
-
 
 /* Type of the lookup function we need here.  */
 typedef int (*lookup_function) (const struct ether_addr *, struct etherent *,
============================================================
Index: nis/nss_nis/nis-ethers.c
--- nis/nss_nis/nis-ethers.c	2000/03/17 18:34:12	1.16
+++ nis/nss_nis/nis-ethers.c	2000/12/21 14:30:27
@@ -24,6 +24,7 @@
 #include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
+#include <netinet/ether.h>
 #include <netinet/if_ether.h>
 
 #include "nss-nis.h"
@@ -31,15 +32,9 @@
 /* Protect global state against multiple changers */
 __libc_lock_define_initialized (static, lock)
 
-struct ether
-{
-  const char *e_name;
-  struct ether_addr e_addr;
-};
-
 /* Get the declaration of the parser function.  */
 #define ENTNAME etherent
-#define STRUCTURE ether
+#define STRUCTURE etherent
 #define EXTERN_PARSER
 #include <nss/nss_files/files-parse.c>
 
@@ -149,7 +144,7 @@
 }
 
 static enum nss_status
-internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen,
+internal_nis_getetherent_r (struct etherent *eth, char *buffer, size_t buflen,
 			    int *errnop)
 {
   struct parser_data *data = (void *) buffer;
@@ -184,7 +179,7 @@
 }
 
 enum nss_status
-_nss_nis_getetherent_r (struct ether *result, char *buffer, size_t buflen,
+_nss_nis_getetherent_r (struct etherent *result, char *buffer, size_t buflen,
 			int *errnop)
 {
   int status;
@@ -199,7 +194,7 @@
 }
 
 enum nss_status
-_nss_nis_gethostton_r (const char *name, struct ether *eth,
+_nss_nis_gethostton_r (const char *name, struct etherent *eth,
 		       char *buffer, size_t buflen, int *errnop)
 {
   struct parser_data *data = (void *) buffer;
@@ -256,7 +251,7 @@
 }
 
 enum nss_status
-_nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth,
+_nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
 		       char *buffer, size_t buflen, int *errnop)
 {
   struct parser_data *data = (void *) buffer;
============================================================
Index: include/netinet/ether.h
--- include/netinet/ether.h	2000/12/19 09:50:44	1.2
+++ include/netinet/ether.h	2000/12/21 14:30:27
@@ -1,7 +1,14 @@
 #ifndef _NETINET_ETHER_H
 #include <inet/netinet/ether.h>
 
-struct etherent;
+/* Because the `ethers' lookup does not fit so well in the scheme so
+   we define a dummy struct here which helps us to use the available
+   functions.  */
+struct etherent
+{
+  const char *e_name;
+  struct ether_addr e_addr;
+};
 
 #define DECLARE_NSS_PROTOTYPES(service)					\
 extern enum nss_status _nss_ ## service ## _setetherent (void);		\
============================================================
Index: include/rpc/auth.h
--- include/rpc/auth.h	1997/09/11 02:46:49	1.1
+++ include/rpc/auth.h	2000/12/21 14:30:27
@@ -1 +1,15 @@
+#ifndef _RPC_AUTH_H
 #include <sunrpc/rpc/auth.h>
+
+#define DECLARE_NSS_PROTOTYPES(service)					\
+extern enum nss_status _nss_ ##service ## _netname2user			\
+                       (char netname[MAXNETNAMELEN + 1], uid_t *uidp,	\
+			gid_t *gidp, int *gidlenp, gid_t *gidlist,	\
+			int *errnop);
+
+DECLARE_NSS_PROTOTYPES (nis)
+DECLARE_NSS_PROTOTYPES (nisplus)
+
+#undef DECLARE_NSS_PROTOTYPES
+
+#endif
============================================================
Index: include/rpc/auth_des.h
--- include/rpc/auth_des.h	1997/09/11 02:46:49	1.1
+++ include/rpc/auth_des.h	2000/12/21 14:30:28
@@ -1 +1,18 @@
+#ifndef _RPC_AUTH_DES_H
+
 #include <sunrpc/rpc/auth_des.h>
+
+#define DECLARE_NSS_PROTOTYPES(service)					\
+extern enum nss_status _nss_ ## service ## _getpublickey		\
+                       (const char *netname, char *pkey, int *errnop);	\
+extern enum nss_status _nss_ ## service ## _getsecretkey		\
+                       (const char *netname, char *skey, char *passwd,	\
+			int *errnop);
+
+DECLARE_NSS_PROTOTYPES (files)
+DECLARE_NSS_PROTOTYPES (nis)
+DECLARE_NSS_PROTOTYPES (nisplus)
+
+#undef DECLARE_NSS_PROTOTYPES
+
+#endif
============================================================
Index: sunrpc/publickey.c
--- sunrpc/publickey.c	1999/04/28 22:54:32	1.5
+++ sunrpc/publickey.c	2000/12/21 14:30:28
@@ -20,6 +20,7 @@
 
 #include <errno.h>
 #include <rpc/netdb.h>
+#include <rpc/auth_des.h>
 
 #include "nsswitch.h"
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]