summaryrefslogtreecommitdiff
path: root/nis/nss_nis/nis-netgrp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-04-09 02:45:24 +0000
committerUlrich Drepper <drepper@redhat.com>2006-04-09 02:45:24 +0000
commitab9a9ff8a1db6e91ce2461069c709e68bd82d8eb (patch)
treee38d1cb8196af19131b1419b04025aed5c04ba03 /nis/nss_nis/nis-netgrp.c
parent7960f2a7040874c63196657fa25d6ddda778cc67 (diff)
downloadglibc-ab9a9ff8a1db6e91ce2461069c709e68bd82d8eb.tar.gz
* nis/nss_nis/nis-alias.c: Optimize use of yperr2nss. Avoid calling
it for YPERR_SUCCESS. Minor cleanups. Add __builtin_expect. * nis/nss_nis/nis-ethers.c: Likewise. * nis/nss_nis/nis-grp.c: Likewise. * nis/nss_nis/nis-hosts.c: Likewise. * nis/nss_nis/nis-initgroups.c: Likewise. * nis/nss_nis/nis-netgrp.c: Likewise. * nis/nss_nis/nis-network.c: Likewise. * nis/nss_nis/nis-proto.c: Likewise. * nis/nss_nis/nis-publickey.c: Likewise. * nis/nss_nis/nis-pwd.c: Likewise. * nis/nss_nis/nis-rpc.c: Likewise. * nis/nss_nis/nis-service.c: Likewise. * nis/nss_nis/nis-spwd.c: Likewise.
Diffstat (limited to 'nis/nss_nis/nis-netgrp.c')
-rw-r--r--nis/nss_nis/nis-netgrp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c
index 049bd8cdb4..5a88b72d9c 100644
--- a/nis/nss_nis/nis-netgrp.c
+++ b/nis/nss_nis/nis-netgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1999,2000,2002,2003,2004,2005
+/* Copyright (C) 1996,1997,1999,2000,2002,2003,2004,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -47,24 +47,25 @@ internal_nis_endnetgrent (struct __netgrent *netgrp)
netgrp->cursor = NULL;
}
+
enum nss_status
_nss_nis_setnetgrent (const char *group, struct __netgrent *netgrp)
{
- char *domain;
int len;
enum nss_status status;
status = NSS_STATUS_SUCCESS;
- if (group == NULL || group[0] == '\0')
+ if (__builtin_expect (group == NULL || group[0] == '\0', 0))
return NSS_STATUS_UNAVAIL;
- if (yp_get_default_domain (&domain))
+ char *domain;
+ if (__builtin_expect (yp_get_default_domain (&domain), 0))
return NSS_STATUS_UNAVAIL;
status = yperr2nss (yp_match (domain, "netgroup", group, strlen (group),
&netgrp->data, &len));
- if (status == NSS_STATUS_SUCCESS)
+ if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
{
/* Our implementation of yp_match already allocates a buffer
which is one byte larger than the value in LEN specifies
@@ -90,6 +91,7 @@ _nss_nis_endnetgrent (struct __netgrent *netgrp)
return NSS_STATUS_SUCCESS;
}
+
enum nss_status
_nss_nis_getnetgrent_r (struct __netgrent *result, char *buffer, size_t buflen,
int *errnop)