2006-10-13 Ulrich Drepper * libio/stdio.h: Add more __wur attributes. 2006-11-12 Andreas Jaeger [BZ #2510] * manual/search.texi (Hash Search Function): Clarify. (Array Search Function): Clarify. 2006-11-12 Joseph Myers [BZ #2830] * math/atest-exp.c (main): Cast hex value to mp_limb_t before shifting. * math/atest-exp2.c (read_mpn_hex): Likewise. * math/atest-sincos.c (main): Likewise. --- libio/stdio.h 27 Sep 2006 15:55:23 -0000 1.87 +++ libio/stdio.h 13 Oct 2006 19:50:36 -0000 1.88 @@ -166,27 +166,27 @@ __BEGIN_NAMESPACE_STD This function is a possible cancellation points and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern FILE *tmpfile (void); +extern FILE *tmpfile (void) __wur; #else # ifdef __REDIRECT -extern FILE *__REDIRECT (tmpfile, (void), tmpfile64); +extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur; # else # define tmpfile tmpfile64 # endif #endif #ifdef __USE_LARGEFILE64 -extern FILE *tmpfile64 (void); +extern FILE *tmpfile64 (void) __wur; #endif /* Generate a temporary filename. */ -extern char *tmpnam (char *__s) __THROW; +extern char *tmpnam (char *__s) __THROW __wur; __END_NAMESPACE_STD #ifdef __USE_MISC /* This is the reentrant variant of `tmpnam'. The only difference is that it does not allow S to be NULL. */ -extern char *tmpnam_r (char *__s) __THROW; +extern char *tmpnam_r (char *__s) __THROW __wur; #endif @@ -199,7 +199,7 @@ extern char *tmpnam_r (char *__s) __THRO P_tmpdir is tried and finally "/tmp". The storage for the filename is allocated by `malloc'. */ extern char *tempnam (__const char *__dir, __const char *__pfx) - __THROW __attribute_malloc__; + __THROW __attribute_malloc__ __wur; #endif @@ -244,21 +244,23 @@ __BEGIN_NAMESPACE_STD This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *fopen (__const char *__restrict __filename, - __const char *__restrict __modes); + __const char *__restrict __modes) __wur; /* Open a file, replacing an existing stream with it. This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream); + FILE *__restrict __stream) __wur; #else # ifdef __REDIRECT extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename, - __const char *__restrict __modes), fopen64); + __const char *__restrict __modes), fopen64) + __wur; extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream), freopen64); + FILE *__restrict __stream), freopen64) + __wur; # else # define fopen fopen64 # define freopen freopen64 @@ -267,15 +269,15 @@ extern FILE *__REDIRECT (freopen, (__con __END_NAMESPACE_STD #ifdef __USE_LARGEFILE64 extern FILE *fopen64 (__const char *__restrict __filename, - __const char *__restrict __modes); + __const char *__restrict __modes) __wur; extern FILE *freopen64 (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream); + FILE *__restrict __stream) __wur; #endif #ifdef __USE_POSIX /* Create a new stream that refers to an existing system file descriptor. */ -extern FILE *fdopen (int __fd, __const char *__modes) __THROW; +extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur; #endif #ifdef __USE_GNU @@ -283,15 +285,16 @@ extern FILE *fdopen (int __fd, __const c and uses the given functions for input and output. */ extern FILE *fopencookie (void *__restrict __magic_cookie, __const char *__restrict __modes, - _IO_cookie_io_functions_t __io_funcs) __THROW; + _IO_cookie_io_functions_t __io_funcs) __THROW __wur; /* Create a new stream that refers to a memory buffer. */ -extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW; +extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) + __THROW __wur; /* Open a stream that writes into a malloc'd buffer that is expanded as necessary. *BUFLOC and *SIZELOC are updated with the buffer's location and the number of characters written on fflush or fclose. */ -extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW; +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur; #endif @@ -367,13 +370,13 @@ __END_NAMESPACE_C99 Store the address of the string in *PTR. */ extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f, _G_va_list __arg) - __THROW __attribute__ ((__format__ (__printf__, 2, 0))); + __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur; extern int __asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) - __THROW __attribute__ ((__format__ (__printf__, 2, 3))); + __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur; extern int asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) - __THROW __attribute__ ((__format__ (__printf__, 2, 3))); + __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur; /* Write formatted output to a file descriptor. --- manual/search.texi 11 Oct 2002 10:50:55 -0000 1.36 +++ manual/search.texi 12 Oct 2006 05:26:33 -0000 1.37 @@ -82,7 +82,7 @@ starting at @var{base} if it is found. available @code{NULL} is returned. The mean runtime of this function is @code{*@var{nmemb}}/2. This -function should only be used elements often get added to or deleted from +function should only be used if elements often get added to or deleted from the array in which case it might not be useful to sort the array before searching. @end deftypefun @@ -247,21 +247,21 @@ Couldn't find Janice. @node Hash Search Function @section The @code{hsearch} function. -The functions mentioned so far in this chapter are searching in a sorted +The functions mentioned so far in this chapter are for searching in a sorted or unsorted array. There are other methods to organize information which later should be searched. The costs of insert, delete and search differ. One possible implementation is using hashing tables. -The following functions are declared in the the header file @file{search.h}. +The following functions are declared in the header file @file{search.h}. @comment search.h @comment SVID @deftypefun int hcreate (size_t @var{nel}) The @code{hcreate} function creates a hashing table which can contain at least @var{nel} elements. There is no possibility to grow this table so -it is necessary to choose the value for @var{nel} wisely. The used -methods to implement this function might make it necessary to make the +it is necessary to choose the value for @var{nel} wisely. The method +used to implement this function might make it necessary to make the number of elements in the hashing table larger than the expected maximal -number of elements. Hashing tables usually work inefficient if they are +number of elements. Hashing tables usually work inefficiently if they are filled 80% or more. The constant access time guaranteed by hashing can only be achieved if few collisions exist. See Knuth's ``The Art of Computer Programming, Part 3: Searching and Sorting'' for more --- math/atest-exp.c 6 Jul 2001 04:55:35 -0000 1.7 +++ math/atest-exp.c 12 Oct 2006 05:25:34 -0000 1.8 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating , 1997. @@ -171,8 +171,10 @@ main (void) memset (e2, '\0', sizeof (mp1)); for (i = -1; i < 100 && i < FRAC / 4; i++) - e2[(FRAC - i * 4 - 4) / mpbpl] |= ((strchr (hexdig, exp1[i + 1]) - hexdig) - << (FRAC - i * 4 - 4) % mpbpl); + e2[(FRAC - i * 4 - 4) / mpbpl] |= ((mp_limb_t) (strchr (hexdig, + exp1[i + 1]) + - hexdig) + << (FRAC - i * 4 - 4) % mpbpl); if (mpn_cmp (ex, e2, SZ) >= 0) mpn_sub_n (e3, ex, e2, SZ); --- math/atest-exp2.c 6 Jul 2001 04:55:35 -0000 1.8 +++ math/atest-exp2.c 12 Oct 2006 05:25:34 -0000 1.9 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating , 1997. @@ -73,8 +73,9 @@ read_mpn_hex(mp_limb_t *x, const char *s memset (x, 0, sizeof (mp1)); for (i = -1; i < 100 && i < FRAC / 4; ++i) - x[(FRAC - i * 4 - 4) / mpbpl] |= ((strchr (hexdig, str[i + 1]) - hexdig) - << (FRAC - i * 4 - 4) % mpbpl); + x[(FRAC - i * 4 - 4) / mpbpl] |= ((mp_limb_t) (strchr (hexdig, str[i + 1]) + - hexdig) + << (FRAC - i * 4 - 4) % mpbpl); } static mp_limb_t *get_log2(void) __attribute__((const)); --- math/atest-sincos.c 6 Jul 2001 04:55:35 -0000 1.7 +++ math/atest-sincos.c 12 Oct 2006 05:25:34 -0000 1.8 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating , 1997. @@ -239,9 +239,11 @@ main (void) memset (c2, 0, sizeof (mp1)); for (i = 0; i < 100 && i < FRAC / 4; i++) { - s2[(FRAC - i * 4 - 4) / mpbpl] |= ((strchr (hexdig, sin1[i]) - hexdig) - << (FRAC - i * 4 - 4) % mpbpl); - c2[(FRAC - i * 4 - 4) / mpbpl] |= ((strchr (hexdig, cos1[i]) - hexdig) + s2[(FRAC - i * 4 - 4) / mpbpl] |= ((mp_limb_t) (strchr (hexdig, sin1[i]) + - hexdig) + << (FRAC - i * 4 - 4) % mpbpl); + c2[(FRAC - i * 4 - 4) / mpbpl] |= ((mp_limb_t) (strchr (hexdig, cos1[i]) + - hexdig) << (FRAC - i * 4 - 4) % mpbpl); }