about summary refs log tree commit diff
path: root/nis/ypclnt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-24 20:29:20 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-24 20:29:20 +0000
commit7440c23e03fac030ec163f331c1084e6bcf0c8c1 (patch)
tree4bc151c37adfde0a7b2e67e16fc6b2c9dd64c421 /nis/ypclnt.c
parent1d5cee233d407b0abca1c64b2de712619c26ede4 (diff)
downloadglibc-7440c23e03fac030ec163f331c1084e6bcf0c8c1.tar.gz
glibc-7440c23e03fac030ec163f331c1084e6bcf0c8c1.tar.xz
glibc-7440c23e03fac030ec163f331c1084e6bcf0c8c1.zip
Update.
	* include/libc-symbols.h: Define hidden attribute macros for libnsl.
	* include/rpcsvc/nislib.h: Use libnsl_hidden_proto for various
	functions.
	* nis/nis_add.c: Add libnsl_hidden_def.  Minor optimizations.
	* nis/nis_call.c: Likewise.
	* nis/nis_clone_obj.c: Likewise.
	* nis/nis_defaults.c: Likewise.
	* nis/nis_domain_of_r.c: Likewise.
	* nis/nis_error.c: Likewise.
	* nis/nis_file.c: Likewise.
	* nis/nis_free.c: Likewise.
	* nis/nis_local_names.c: Likewise.
	* nis/nis_lookup.c: Likewise.
	* nis/nis_modify.c: Likewise.
	* nis/nis_print.c: Likewise.
	* nis/nis_remove.c: Likewise.
	* nis/nis_subr.c: Likewise.
	* nis/nis_table.c: Likewise.
	* nis/nis_util.c: Likewise.
	* nis/yp_xdr.c: Likewise.
	* nis/ypclnt.c: Likewise.
	* nis/ypupdate_xdr.c: Likewise.
Diffstat (limited to 'nis/ypclnt.c')
-rw-r--r--nis/ypclnt.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index f25c7c710b..65b9c55467 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -230,6 +230,7 @@ yp_bind (const char *indomain)
 
   return status;
 }
+libnsl_hidden_def (yp_bind)
 
 static void
 yp_unbind_locked (const char *indomain)
@@ -394,6 +395,7 @@ yp_get_default_domain (char **outdomain)
 
   return result;
 }
+libnsl_hidden_def (yp_get_default_domain)
 
 int
 __yp_check (char **domain)
@@ -580,6 +582,7 @@ yp_master (const char *indomain, const char *inmap, char **outname)
 
   return *outname == NULL ? YPERR_YPERR : YPERR_SUCCESS;
 }
+libnsl_hidden_def (yp_master)
 
 int
 yp_order (const char *indomain, const char *inmap, unsigned int *outorder)
@@ -823,36 +826,29 @@ yperr_string (const int error)
   return _("Unknown NIS error code");
 }
 
+static const int8_t yp_2_yperr[] =
+  {
+#define YP2YPERR(yp, yperr)  [YP_##yp - YP_VERS] = YPERR_##yperr
+    YP2YPERR (TRUE, SUCCESS),
+    YP2YPERR (NOMORE, NOMORE),
+    YP2YPERR (FALSE, YPERR),
+    YP2YPERR (NOMAP, MAP),
+    YP2YPERR (NODOM, DOMAIN),
+    YP2YPERR (NOKEY, KEY),
+    YP2YPERR (BADOP, YPERR),
+    YP2YPERR (BADDB, BADDB),
+    YP2YPERR (YPERR, YPERR),
+    YP2YPERR (BADARGS, BADARGS),
+    YP2YPERR (VERS, VERS)
+  };
 int
 ypprot_err (const int code)
 {
-  switch (code)
-    {
-    case YP_TRUE:
-      return YPERR_SUCCESS;
-    case YP_NOMORE:
-      return YPERR_NOMORE;
-    case YP_FALSE:
-      return YPERR_YPERR;
-    case YP_NOMAP:
-      return YPERR_MAP;
-    case YP_NODOM:
-      return YPERR_DOMAIN;
-    case YP_NOKEY:
-      return YPERR_KEY;
-    case YP_BADOP:
-      return YPERR_YPERR;
-    case YP_BADDB:
-      return YPERR_BADDB;
-    case YP_YPERR:
-      return YPERR_YPERR;
-    case YP_BADARGS:
-      return YPERR_BADARGS;
-    case YP_VERS:
-      return YPERR_VERS;
-    }
-  return YPERR_YPERR;
+  if (code < YP_VERS || code > YP_NOKEY)
+    return YPERR_YPERR;
+  return yp_2_yperr[code];
 }
+libnsl_hidden_def (ypprot_err)
 
 const char *
 ypbinderr_string (const int error)
@@ -871,7 +867,7 @@ ypbinderr_string (const int error)
       return _("Unknown ypbind error");
     }
 }
-
+libnsl_hidden_def (ypbinderr_string)
 
 #define WINDOW 60