From 54eb84d0c769dbd974b21ffd9d41d48aff203a15 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 22 Apr 2000 03:58:39 +0000 Subject: Update. * nis/nis_findserv.c (__nis_findfastest): Improve memory handling. * nis/nis_print_group_entry.c (nis_print_group_entry): Use alloca instead of malloc. * nis/nis_subr.c: Use __builtin_expect. * nis/ypclnt.c: Likewise. * nis/nis_getservlist.c: Likewise. * nis/nis_creategroup.c: Likewise. --- nis/nis_subr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'nis/nis_subr.c') diff --git a/nis/nis_subr.c b/nis/nis_subr.c index c7d58a60e9..a5ddf03d51 100644 --- a/nis/nis_subr.c +++ b/nis/nis_subr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1999 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -126,7 +126,7 @@ nis_getnames (const_nis_name name) count = 1; getnames = malloc ((count + 1) * sizeof (char *)); - if (getnames == NULL) + if (__builtin_expect (getnames == NULL, 0)) return NULL; /* Do we have a fully qualified NIS+ name ? If yes, give it back */ @@ -165,12 +165,12 @@ nis_getnames (const_nis_name name) { count += 5; getnames = realloc (getnames, (count + 1) * sizeof (char *)); - if (getnames == NULL) + if (__builtin_expect (getnames == NULL, 0)) return NULL; } tmp = malloc (strlen (cptr) + strlen (local_domain) + strlen (name) + 2); - if (tmp == NULL) + if (__builtin_expect (tmp == NULL, 0)) return NULL; getnames[pos] = tmp; @@ -200,7 +200,7 @@ nis_getnames (const_nis_name name) char *p; tmp = malloc (cplen + strlen (local_domain) + strlen (name) + 2); - if (tmp == NULL) + if (__builtin_expect (tmp == NULL, 0)) return NULL; p = __stpcpy (tmp, name); @@ -216,7 +216,7 @@ nis_getnames (const_nis_name name) char *p; tmp = malloc (cplen + strlen (name) + 2); - if (tmp == NULL) + if (__builtin_expect (tmp == NULL, 0)) return NULL; p = __stpcpy (tmp, name); @@ -228,7 +228,7 @@ nis_getnames (const_nis_name name) { count += 5; getnames = realloc (getnames, (count + 1) * sizeof (char *)); - if (getnames == NULL) + if (__builtin_expect (getnames == NULL, 0)) return NULL; } getnames[pos] = tmp; -- cgit v1.2.3