From a711dd4ba8f2c71a260a3f7539c0e86175f97a21 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 21 Apr 2000 16:15:11 +0000 Subject: Update. 2000-04-21 Ulrich Drepper * iconv/iconv.c (iconv): Add __builtin_expect where useful. * iconv/iconv_close.c (iconv_close): Likewise. * iconv/iconv_open.c (iconv_open): Likewise. * grp/putgrent.c (putgrent): Unlock steam if fprintf failed. Add __builtin_expect where useful. * grp/initgroups.c (initgroups): Test for result of memory allocation and punt if it fails. * dirent/scandir.c (scandir): Add __builtin_expect where useful. * grp/fgetgrent.c (fgetfrent): Likewise. * grp/fgetgrent_r.c (__fgetgrent_r): Likewise. --- grp/putgrent.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'grp/putgrent.c') diff --git a/grp/putgrent.c b/grp/putgrent.c index a119ebed17..11b64eca63 100644 --- a/grp/putgrent.c +++ b/grp/putgrent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1996, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 96, 98, 99, 2000 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 @@ -36,7 +36,7 @@ putgrent (gr, stream) { int retval; - if (gr == NULL || stream == NULL) + if (__builtin_expect (gr == NULL, 0) || __builtin_expect (stream == NULL, 0)) { __set_errno (EINVAL); return -1; @@ -46,8 +46,11 @@ putgrent (gr, stream) retval = fprintf (stream, "%s:%s:%u:", gr->gr_name, _S (gr->gr_passwd), gr->gr_gid); - if (retval < 0) - return -1; + if (__builtin_expect (retval, 0) < 0) + { + funlockfile (stream); + return -1; + } if (gr->gr_mem != NULL) { -- cgit v1.2.3