From 833861be818bb5d45ab0c47370b84068dfb2fedf Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 16 Feb 2005 12:31:10 +0000 Subject: import later fedora-branch tweaks --- stdlib/Makefile | 30 +++--------- stdlib/fmtmsg.c | 25 +++++++++- stdlib/random_r.c | 11 +---- stdlib/stdlib.h | 138 +++++++++++++++++++++++++--------------------------- stdlib/tst-fmtmsg.c | 32 +----------- 5 files changed, 99 insertions(+), 137 deletions(-) (limited to 'stdlib') diff --git a/stdlib/Makefile b/stdlib/Makefile index fafe6061a0..5f4675033e 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1991-2002, 2003, 2004 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 @@ -61,15 +61,10 @@ distribute := exit.h grouping.h abort-instr.h isomac.c tst-fmtmsg.sh \ test-srcs := tst-fmtmsg tests := tst-strtol tst-strtod testmb testrand testsort testdiv \ test-canon test-canon2 tst-strtoll tst-environ \ - tst-xpg-basename tst-random tst-random2 tst-bsearch \ - tst-limits tst-rand48 bug-strtod tst-setcontext \ - test-a64l tst-qsort tst-system testmb2 + tst-xpg-basename tst-random tst-bsearch tst-limits \ + tst-rand48 bug-strtod tst-setcontext test-a64l tst-qsort \ + tst-system testmb2 -include ../Makeconfig - -ifeq ($(build-shared),yes) -tests += tst-putenv -endif # Several mpn functions from GNU MP are used by the strtod function. mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \ @@ -80,21 +75,18 @@ routines := $(strip $(routines) $(mpn-routines)) \ dbl2mpn ldbl2mpn \ mpn2flt mpn2dbl mpn2ldbl aux += fpioconst mp_clz_tab -distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h \ - tst-putenvmod.c - -tests-extras += tst-putenvmod -extra-objs += tst-putenvmod.os +distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h -generated += isomac isomac.out tst-putenvmod.so +generated += isomac isomac.out CFLAGS-bsearch.c = $(uses-callbacks) CFLAGS-msort.c = $(uses-callbacks) CFLAGS-qsort.c = $(uses-callbacks) CFLAGS-system.c = -fexceptions -CFLAGS-system.os = -fomit-frame-pointer CFLAGS-fmtmsg.c = -fexceptions +include ../Makeconfig + ifneq (,$(filter %REENTRANT, $(defines))) CFLAGS-strfmon.c = -D_IO_MTSAFE_IO CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO @@ -132,9 +124,3 @@ $(objpfx)isomac: isomac.c $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/ - -$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so - -$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os - $(build-module) -CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1 diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c index b5d7436956..2ab97b7d90 100644 --- a/stdlib/fmtmsg.c +++ b/stdlib/fmtmsg.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1999,2000-2003,2005 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -316,7 +316,7 @@ internal_addseverity (int severity, const char *string) int result = MM_OK; /* First see if there is already a record for the severity level. */ - for (runp = severity_list, lastp = NULL; runp != NULL; runp = runp->next) + for (runp = severity_list, lastp = NULL; runp != NULL; runp = runp-> next) if (runp->severity == severity) break; else @@ -324,6 +324,9 @@ internal_addseverity (int severity, const char *string) if (runp != NULL) { + /* Release old string. */ + free ((char *) runp->string); + if (string != NULL) /* Change the string. */ runp->string = string; @@ -364,17 +367,34 @@ int addseverity (int severity, const char *string) { int result; + const char *new_string; /* Prevent illegal SEVERITY values. */ if (severity <= MM_INFO) return MM_NOTOK; + if (string == NULL) + /* We want to remove the severity class. */ + new_string = NULL; + else + { + new_string = __strdup (string); + + if (new_string == NULL) + /* Allocation failed or illegal value. */ + return MM_NOTOK; + } + /* Protect the global data. */ __libc_lock_lock (lock); /* Do the real work. */ result = internal_addseverity (severity, string); + if (result != MM_OK) + /* Free the allocated string. */ + free ((char *) new_string); + /* Release the lock. */ __libc_lock_unlock (lock); @@ -391,6 +411,7 @@ libc_freeres_fn (free_mem) { /* This is data we have to release. */ struct severity_info *here = runp; + free ((char *) runp->string); runp = runp->next; free (here); } diff --git a/stdlib/random_r.c b/stdlib/random_r.c index c85fd5eeef..09677e6077 100644 --- a/stdlib/random_r.c +++ b/stdlib/random_r.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995, 2005 Free Software Foundation + Copyright (C) 1995 Free Software Foundation The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -240,19 +240,10 @@ __initstate_r (seed, arg_state, n, buf) int degree; int separation; int32_t *state; - int old_type; - int32_t *old_state; if (buf == NULL) goto fail; - old_type = buf->rand_type; - old_state = buf->state; - if (old_type == TYPE_0) - old_state[-1] = TYPE_0; - else - old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type; - if (n >= BREAK_3) type = n < BREAK_4 ? TYPE_3 : TYPE_4; else if (n < BREAK_1) diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 4a1571e7db..1bda32262b 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1991-2002, 2003, 2004 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 @@ -137,45 +137,44 @@ __END_NAMESPACE_C99 /* Maximum length of a multibyte character in the current locale. */ #define MB_CUR_MAX (__ctype_get_mb_cur_max ()) -extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; +extern size_t __ctype_get_mb_cur_max (void) __THROW; __BEGIN_NAMESPACE_STD /* Convert a string to a floating-point number. */ extern double atof (__const char *__nptr) - __THROW __attribute_pure__ __nonnull ((1)) __wur; + __THROW __attribute_pure__ __nonnull ((1)); /* Convert a string to an integer. */ extern int atoi (__const char *__nptr) - __THROW __attribute_pure__ __nonnull ((1)) __wur; + __THROW __attribute_pure__ __nonnull ((1)); /* Convert a string to a long integer. */ extern long int atol (__const char *__nptr) - __THROW __attribute_pure__ __nonnull ((1)) __wur; + __THROW __attribute_pure__ __nonnull ((1)); __END_NAMESPACE_STD #if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) __BEGIN_NAMESPACE_C99 /* Convert a string to a long long integer. */ __extension__ extern long long int atoll (__const char *__nptr) - __THROW __attribute_pure__ __nonnull ((1)) __wur; + __THROW __attribute_pure__ __nonnull ((1)); __END_NAMESPACE_C99 #endif __BEGIN_NAMESPACE_STD /* Convert a string to a floating-point number. */ extern double strtod (__const char *__restrict __nptr, - char **__restrict __endptr) - __THROW __nonnull ((1)) __wur; + char **__restrict __endptr) __THROW __nonnull ((1)); __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Likewise for `float' and `long double' sizes of floating-point numbers. */ extern float strtof (__const char *__restrict __nptr, - char **__restrict __endptr) __THROW __nonnull ((1)) __wur; + char **__restrict __endptr) __THROW __nonnull ((1)); extern long double strtold (__const char *__restrict __nptr, char **__restrict __endptr) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); __END_NAMESPACE_C99 #endif @@ -183,11 +182,11 @@ __BEGIN_NAMESPACE_STD /* Convert a string to a long integer. */ extern long int strtol (__const char *__restrict __nptr, char **__restrict __endptr, int __base) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); /* Convert a string to an unsigned long integer. */ extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); __END_NAMESPACE_C99 #if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD @@ -195,12 +194,12 @@ __END_NAMESPACE_C99 __extension__ extern long long int strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); /* Convert a string to an unsigned quadword integer. */ __extension__ extern unsigned long long int strtouq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); #endif /* GCC and use BSD. */ #if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) @@ -209,12 +208,12 @@ __BEGIN_NAMESPACE_C99 __extension__ extern long long int strtoll (__const char *__restrict __nptr, char **__restrict __endptr, int __base) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); /* Convert a string to an unsigned quadword integer. */ __extension__ extern unsigned long long int strtoull (__const char *__restrict __nptr, char **__restrict __endptr, int __base) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); __END_NAMESPACE_C99 #endif /* ISO C99 or GCC and use MISC. */ @@ -239,37 +238,36 @@ __END_NAMESPACE_C99 use as an additional parameter. */ extern long int strtol_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, - __locale_t __loc) __THROW __nonnull ((1, 4)) __wur; + __locale_t __loc) __THROW __nonnull ((1, 4)); extern unsigned long int strtoul_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) - __THROW __nonnull ((1, 4)) __wur; + __THROW __nonnull ((1, 4)); __extension__ extern long long int strtoll_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) - __THROW __nonnull ((1, 4)) __wur; + __THROW __nonnull ((1, 4)); __extension__ extern unsigned long long int strtoull_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) - __THROW __nonnull ((1, 4)) __wur; + __THROW __nonnull ((1, 4)); extern double strtod_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) - __THROW __nonnull ((1, 3)) __wur; + __THROW __nonnull ((1, 3)); extern float strtof_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) - __THROW __nonnull ((1, 3)) __wur; + __THROW __nonnull ((1, 3)); extern long double strtold_l (__const char *__restrict __nptr, char **__restrict __endptr, - __locale_t __loc) - __THROW __nonnull ((1, 3)) __wur; + __locale_t __loc) __THROW __nonnull ((1, 3)); #endif /* GNU */ @@ -278,26 +276,25 @@ extern long double strtold_l (__const char *__restrict __nptr, extern double __strtod_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); extern float __strtof_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); extern long double __strtold_internal (__const char *__restrict __nptr, char **__restrict __endptr, - int __group) - __THROW __nonnull ((1)) __wur; + int __group) __THROW __nonnull ((1)); #ifndef __strtol_internal_defined extern long int __strtol_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); # define __strtol_internal_defined 1 #endif #ifndef __strtoul_internal_defined extern unsigned long int __strtoul_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); # define __strtoul_internal_defined 1 #endif #if defined __GNUC__ || defined __USE_ISOC99 @@ -306,7 +303,7 @@ __extension__ extern long long int __strtoll_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); # define __strtoll_internal_defined 1 # endif # ifndef __strtoull_internal_defined @@ -315,7 +312,7 @@ extern unsigned long long int __strtoull_internal (__const char * __restrict __nptr, char **__restrict __endptr, int __base, int __group) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); # define __strtoull_internal_defined 1 # endif #endif /* GCC */ @@ -424,11 +421,11 @@ __END_NAMESPACE_C99 /* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant digit first. Returns a pointer to static storage overwritten by the next call. */ -extern char *l64a (long int __n) __THROW __wur; +extern char *l64a (long int __n) __THROW; /* Read a number from a string S in base 64 as above. */ extern long int a64l (__const char *__s) - __THROW __attribute_pure__ __nonnull ((1)) __wur; + __THROW __attribute_pure__ __nonnull ((1)); #endif /* Use SVID || extended X/Open. */ @@ -584,10 +581,10 @@ extern int lcong48_r (unsigned short int __param[7], # define __malloc_and_calloc_defined __BEGIN_NAMESPACE_STD /* Allocate SIZE bytes of memory. */ -extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; +extern void *malloc (size_t __size) __THROW __attribute_malloc__; /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ extern void *calloc (size_t __nmemb, size_t __size) - __THROW __attribute_malloc__ __wur; + __THROW __attribute_malloc__; __END_NAMESPACE_STD #endif @@ -595,8 +592,7 @@ __END_NAMESPACE_STD __BEGIN_NAMESPACE_STD /* Re-allocate the previously allocated block in PTR, making the new block SIZE bytes long. */ -extern void *realloc (void *__ptr, size_t __size) - __THROW __attribute_malloc__ __attribute_warn_unused_result__; +extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_malloc__; /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free (void *__ptr) __THROW; __END_NAMESPACE_STD @@ -612,13 +608,13 @@ extern void cfree (void *__ptr) __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */ -extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; +extern void *valloc (size_t __size) __THROW __attribute_malloc__; #endif #ifdef __USE_XOPEN2K /* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) - __THROW __attribute_malloc__ __nonnull ((1)) __wur; + __THROW __attribute_malloc__ __nonnull ((1)); #endif __BEGIN_NAMESPACE_STD @@ -655,13 +651,12 @@ __END_NAMESPACE_C99 __BEGIN_NAMESPACE_STD /* Return the value of envariable NAME, or NULL if it doesn't exist. */ -extern char *getenv (__const char *__name) __THROW __nonnull ((1)) __wur; +extern char *getenv (__const char *__name) __THROW __nonnull ((1)); __END_NAMESPACE_STD /* This function is similar to the above but returns NULL if the programs is running with SUID or SGID enabled. */ -extern char *__secure_getenv (__const char *__name) - __THROW __nonnull ((1)) __wur; +extern char *__secure_getenv (__const char *__name) __THROW __nonnull ((1)); #if defined __USE_SVID || defined __USE_XOPEN /* The SVID says this is in , but this seems a better place. */ @@ -693,7 +688,7 @@ extern int clearenv (void) __THROW; The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */ -extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur; +extern char *mktemp (char *__template) __THROW __nonnull ((1)); /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; @@ -704,17 +699,16 @@ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur; This function is a possible cancellation points and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 -extern int mkstemp (char *__template) __nonnull ((1)) __wur; +extern int mkstemp (char *__template) __nonnull ((1)); # else # ifdef __REDIRECT -extern int __REDIRECT (mkstemp, (char *__template), mkstemp64) - __nonnull ((1)) __wur; +extern int __REDIRECT (mkstemp, (char *__template), mkstemp64) __nonnull ((1)); # else # define mkstemp mkstemp64 # endif # endif # ifdef __USE_LARGEFILE64 -extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; +extern int mkstemp64 (char *__template) __nonnull ((1)); # endif #endif @@ -724,7 +718,7 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; they are replaced with a string that makes the directory name unique. Returns TEMPLATE, or a null pointer if it cannot get a unique name. The directory is created mode 700. */ -extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur; +extern char *mkdtemp (char *__template) __THROW __nonnull ((1)); #endif @@ -733,7 +727,7 @@ __BEGIN_NAMESPACE_STD This function is a cancellation point and therefore not marked with __THROW. */ -extern int system (__const char *__command) __wur; +extern int system (__const char *__command); __END_NAMESPACE_STD @@ -742,7 +736,7 @@ __END_NAMESPACE_STD named file. The last file name component need not exist, and may be a symlink to a nonexistent file. */ extern char *canonicalize_file_name (__const char *__name) - __THROW __nonnull ((1)) __wur; + __THROW __nonnull ((1)); #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED @@ -753,7 +747,7 @@ extern char *canonicalize_file_name (__const char *__name) ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the name in RESOLVED. */ extern char *realpath (__const char *__restrict __name, - char *__restrict __resolved) __THROW __wur; + char *__restrict __resolved) __THROW; #endif @@ -772,7 +766,7 @@ __BEGIN_NAMESPACE_STD of SIZE bytes each, using COMPAR to perform the comparisons. */ extern void *bsearch (__const void *__key, __const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) - __nonnull ((1, 2, 5)) __wur; + __nonnull ((1, 2, 5)); /* Sort NMEMB elements of BASE, of SIZE bytes each, using COMPAR to perform the comparisons. */ @@ -781,13 +775,13 @@ extern void qsort (void *__base, size_t __nmemb, size_t __size, /* Return the absolute value of X. */ -extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; -extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur; +extern int abs (int __x) __THROW __attribute__ ((__const__)); +extern long int labs (long int __x) __THROW __attribute__ ((__const__)); __END_NAMESPACE_STD #ifdef __USE_ISOC99 __extension__ extern long long int llabs (long long int __x) - __THROW __attribute__ ((__const__)) __wur; + __THROW __attribute__ ((__const__)); #endif @@ -796,16 +790,16 @@ __BEGIN_NAMESPACE_STD of the value of NUMER over DENOM. */ /* GCC may have built-ins for these someday. */ extern div_t div (int __numer, int __denom) - __THROW __attribute__ ((__const__)) __wur; + __THROW __attribute__ ((__const__)); extern ldiv_t ldiv (long int __numer, long int __denom) - __THROW __attribute__ ((__const__)) __wur; + __THROW __attribute__ ((__const__)); __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 __extension__ extern lldiv_t lldiv (long long int __numer, long long int __denom) - __THROW __attribute__ ((__const__)) __wur; + __THROW __attribute__ ((__const__)); __END_NAMESPACE_C99 #endif @@ -818,31 +812,31 @@ __END_NAMESPACE_C99 this. Set *DECPT with the position of the decimal character and *SIGN with the sign of the number. */ extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, - int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; + int *__restrict __sign) __THROW __nonnull ((3, 4)); /* Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT with the position of the decimal character and *SIGN with the sign of the number. */ extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, - int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; + int *__restrict __sign) __THROW __nonnull ((3, 4)); /* If possible convert VALUE to a string with NDIGIT significant digits. Otherwise use exponential representation. The resulting string will be written to BUF. */ extern char *gcvt (double __value, int __ndigit, char *__buf) - __THROW __nonnull ((3)) __wur; + __THROW __nonnull ((3)); # ifdef __USE_MISC /* Long double versions of above functions. */ extern char *qecvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) - __THROW __nonnull ((3, 4)) __wur; + __THROW __nonnull ((3, 4)); extern char *qfcvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) - __THROW __nonnull ((3, 4)) __wur; + __THROW __nonnull ((3, 4)); extern char *qgcvt (long double __value, int __ndigit, char *__buf) - __THROW __nonnull ((3)) __wur; + __THROW __nonnull ((3)); /* Reentrant version of the functions above which provide their own @@ -869,14 +863,14 @@ extern int qfcvt_r (long double __value, int __ndigit, __BEGIN_NAMESPACE_STD /* Return the length of the multibyte character in S, which is no longer than N. */ -extern int mblen (__const char *__s, size_t __n) __THROW __wur; +extern int mblen (__const char *__s, size_t __n) __THROW; /* Return the length of the given multibyte character, putting its `wchar_t' representation in *PWC. */ extern int mbtowc (wchar_t *__restrict __pwc, - __const char *__restrict __s, size_t __n) __THROW __wur; + __const char *__restrict __s, size_t __n) __THROW; /* Put the multibyte character represented by WCHAR in S, returning its length. */ -extern int wctomb (char *__s, wchar_t __wchar) __THROW __wur; +extern int wctomb (char *__s, wchar_t __wchar) __THROW; /* Convert a multibyte string to a wide char string. */ @@ -894,7 +888,7 @@ __END_NAMESPACE_STD or negative response expression as specified by the LC_MESSAGES category in the program's current locale. Returns 1 if affirmative, 0 if negative, and -1 if not matching. */ -extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur; +extern int rpmatch (__const char *__response) __THROW __nonnull ((1)); #endif @@ -908,7 +902,7 @@ extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur; extern int getsubopt (char **__restrict __optionp, char *__const *__restrict __tokens, char **__restrict __valuep) - __THROW __nonnull ((1, 2, 3)) __wur; + __THROW __nonnull ((1, 2, 3)); #endif @@ -922,7 +916,7 @@ extern void setkey (__const char *__key) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Return a master pseudo-terminal handle. */ -extern int posix_openpt (int __oflag) __wur; +extern int posix_openpt (int __oflag); #endif #ifdef __USE_XOPEN @@ -939,7 +933,7 @@ extern int unlockpt (int __fd) __THROW; /* Return the pathname of the pseudo terminal slave assoicated with the master FD is open on, or NULL on errors. The returned storage is good until the next call to this function. */ -extern char *ptsname (int __fd) __THROW __wur; +extern char *ptsname (int __fd) __THROW; #endif #ifdef __USE_GNU diff --git a/stdlib/tst-fmtmsg.c b/stdlib/tst-fmtmsg.c index c3748d64d5..d5369bda62 100644 --- a/stdlib/tst-fmtmsg.c +++ b/stdlib/tst-fmtmsg.c @@ -1,8 +1,6 @@ #include #include #include -#include -#include #define MM_TEST 10 @@ -14,13 +12,11 @@ main (void) mtrace (); - char TEST[] = "ABCD"; - if (addseverity (MM_TEST, TEST) != MM_OK) + if (addseverity (MM_TEST, "TEST") != MM_OK) { puts ("addseverity failed"); result = 1; } - strcpy (TEST, "TEST"); if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_HALT, "halt", "should print message for MM_HALT", "GLIBC:tst-fmtmsg:1") @@ -52,31 +48,5 @@ main (void) != MM_OK) result = 1; - if (addseverity (MM_TEST, NULL) != MM_OK) - { - puts ("second addseverity failed"); - result = 1; - } - - if (addseverity (MM_TEST, NULL) != MM_NOTOK) - { - puts ("third addseverity unexpectedly succeeded"); - result = 1; - } - - char *p = strdup ("TEST2"); - if (addseverity (MM_TEST, p) != MM_OK) - { - puts ("fourth addseverity failed"); - result = 1; - } - if (addseverity (MM_TEST, "TEST3") != MM_OK) - { - puts ("fifth addseverity failed"); - result = 1; - } - - free (p); - return result; } -- cgit 1.4.1