This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMITTED PATCH] Do not pollute name space with internal_*netgrent functions.


getnetgrent_r.c was defining global functions called internal_* rather
than only __* names.  This is not kosher.  While I was there, I made
them use internal_function, which improves performance a little on i?86.

2012-08-16  Roland McGrath  <roland@hack.frob.com>

	* inet/getnetgrent_r.c (internal_setnetgrent): Renamed to ...
	(__internal_setnetgrent): ... this.  Add internal_function to
	definition.  Add libc_hidden_def.
	(setnetgrent): Update caller.
	(internal_endnetgrent): Renamed to ...
	(__internal_endnetgrent): ... this.  Add internal_function to
	definition.  Add libc_hidden_def.
	(endnetgrent): Update caller.
	(internal_getnetgrent_r): Renamed to ...
	(__internal_getnetgrent_r): ... this.  Add internal_function to
	definition.  Add libc_hidden_def.
	(__getnetgrent_r): Update caller.
	* inet/netgroup.h: Update declarations.  Add libc_hidden_proto uses.


diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index 70cc14c..c57e7de 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -171,19 +171,16 @@ __internal_setnetgrent_reuse (const char *group, struct __netgrent *datap,
   return status == NSS_STATUS_SUCCESS;
 }
 
-int internal_setnetgrent (const char *group, struct __netgrent *datap);
-libc_hidden_proto (internal_setnetgrent)
-
 int
-internal_setnetgrent (const char *group, struct __netgrent *datap)
+internal_function
+__internal_setnetgrent (const char *group, struct __netgrent *datap)
 {
   /* Free list of all netgroup names from last run.  */
   free_memory (datap);
 
   return __internal_setnetgrent_reuse (group, datap, &errno);
 }
-libc_hidden_def (internal_setnetgrent)
-strong_alias (internal_setnetgrent, __internal_setnetgrent)
+libc_hidden_def (__internal_setnetgrent)
 
 int
 setnetgrent (const char *group)
@@ -204,7 +201,7 @@ setnetgrent (const char *group)
 	goto out;
     }
 
-  result = internal_setnetgrent (group, &dataset);
+  result = __internal_setnetgrent (group, &dataset);
 
  out:
   __libc_lock_unlock (lock);
@@ -212,18 +209,15 @@ setnetgrent (const char *group)
   return result;
 }
 
-void internal_endnetgrent (struct __netgrent *datap);
-libc_hidden_proto (internal_endnetgrent)
-
 void
-internal_endnetgrent (struct __netgrent *datap)
+internal_function
+__internal_endnetgrent (struct __netgrent *datap)
 {
   endnetgrent_hook (datap);
   /* Now free list of all netgroup names from last run.  */
   free_memory (datap);
 }
-libc_hidden_def (internal_endnetgrent)
-strong_alias (internal_endnetgrent, __internal_endnetgrent)
+libc_hidden_def (__internal_endnetgrent)
 
 
 void
@@ -231,18 +225,12 @@ endnetgrent (void)
 {
   __libc_lock_lock (lock);
 
-  internal_endnetgrent (&dataset);
+  __internal_endnetgrent (&dataset);
 
   __libc_lock_unlock (lock);
 }
 
 
-int internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
-			    struct __netgrent *datap,
-			    char *buffer, size_t buflen, int *errnop);
-libc_hidden_proto (internal_getnetgrent_r)
-
-
 static enum nss_status
 nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen,
 		  int *errnop)
@@ -263,7 +251,8 @@ nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen,
 
 
 int
-internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
+internal_function
+__internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
 			  struct __netgrent *datap,
 			  char *buffer, size_t buflen, int *errnop)
 {
@@ -361,8 +350,7 @@ internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
 
   return status == NSS_STATUS_SUCCESS ? 1 : 0;
 }
-libc_hidden_def (internal_getnetgrent_r)
-strong_alias (internal_getnetgrent_r, __internal_getnetgrent_r)
+libc_hidden_def (__internal_getnetgrent_r)
 
 /* The real entry point.  */
 int
@@ -373,8 +361,8 @@ __getnetgrent_r (char **hostp, char **userp, char **domainp,
 
   __libc_lock_lock (lock);
 
-  status = internal_getnetgrent_r (hostp, userp, domainp, &dataset,
-				   buffer, buflen, &errno);
+  status = __internal_getnetgrent_r (hostp, userp, domainp, &dataset,
+                                     buffer, buflen, &errno);
 
   __libc_lock_unlock (lock);
 
diff --git a/inet/netgroup.h b/inet/netgroup.h
index 2c0d1a4..f3797a6 100644
--- a/inet/netgroup.h
+++ b/inet/netgroup.h
@@ -1,5 +1,5 @@
 /* Internal header for netgroup related functions.
-   Copyright (C) 1996, 1997, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -70,10 +70,16 @@ struct __netgrent
 
 /* The internal netgroup handling functions might be called from outside.  */
 extern int __internal_setnetgrent (const char *group,
-				   struct __netgrent *datap);
-extern void __internal_endnetgrent (struct __netgrent *datap);
+				   struct __netgrent *datap)
+  internal_function;
+libc_hidden_proto (__internal_setnetgrent)
+extern void __internal_endnetgrent (struct __netgrent *datap)
+  internal_function;
+libc_hidden_proto (__internal_endnetgrent)
 extern int __internal_getnetgrent_r (char **hostp, char **userp,
 				     char **domainp, struct __netgrent *datap,
-				     char *buffer, size_t buflen, int *errnop);
+				     char *buffer, size_t buflen, int *errnop)
+  internal_function;
+libc_hidden_proto (__internal_getnetgrent_r)
 
 #endif /* netgroup.h */


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