[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r4830 - in /fsf/trunk/libc: ./ iconv/ iconvdata/ malloc/ stdlib/ sunrpc/ sysdeps/unix/sysv/linux/i386/



Author: eglibc
Date: Thu Jan 10 00:05:23 2008
New Revision: 4830

Log:
Import glibc-mainline for 2008-01-10

Added:
    fsf/trunk/libc/iconvdata/tst-iconv7.c
    fsf/trunk/libc/stdlib/tst-makecontext2.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/iconv/loop.c
    fsf/trunk/libc/iconvdata/Makefile
    fsf/trunk/libc/iconvdata/ibm1364.c
    fsf/trunk/libc/iconvdata/ibm930.c
    fsf/trunk/libc/iconvdata/ibm933.c
    fsf/trunk/libc/iconvdata/ibm935.c
    fsf/trunk/libc/iconvdata/ibm937.c
    fsf/trunk/libc/iconvdata/ibm939.c
    fsf/trunk/libc/iconvdata/iso-2022-cn-ext.c
    fsf/trunk/libc/iconvdata/iso-2022-cn.c
    fsf/trunk/libc/iconvdata/iso-2022-jp-3.c
    fsf/trunk/libc/iconvdata/iso-2022-jp.c
    fsf/trunk/libc/iconvdata/iso-2022-kr.c
    fsf/trunk/libc/malloc/malloc.c
    fsf/trunk/libc/stdlib/Makefile
    fsf/trunk/libc/sunrpc/clnt_perr.c
    fsf/trunk/libc/sunrpc/rpc_thread.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/makecontext.S

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Jan 10 00:05:23 2008
@@ -1,3 +1,49 @@
+2008-01-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5541]
+	* sunrpc/rpc_thread.c (__rpc_thread_destroy): Also free xports and
+	pollfd structures.
+	Patch by André Cruz.
+
+	[BZ #5545]
+	* sunrpc/clnt_perr.c (clnt_sperror): Don't use fixed size buffer.
+	(clnt_spcreateerror): Likewise.
+
+	[BZ #5553]
+	* malloc/malloc.c (public_mALLOc): Set ar_ptr when trying main_arena.
+	(public_mEMALIGn): Likewise.
+	Patch mostly by Daniel Jacobowitz.
+
+2008-01-09  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/i386/makecontext.S (__makecontext): Avoid
+	clobbering memory at or above uc_stack.ss_sp + uc_stack.ss_size.
+	* stdlib/Makefile: Add rules to build and run tst-makecontext2.
+	* stdlib/tst-makecontext2.c: New test.
+
+008-01-08  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* iconv/loop.c (UPDATE_PARAMS): Define to empty statement if not
+	defined.
+	(REINIT_PARAMS): Likewise.  Undefine before end of file.
+	(STANDARD_TO_LOOP_ERR_HANDLER): Use UPDATE_PARAMS before calling
+	transliteration hooks and REINIT_PARAMS afterwards.
+	* iconvdata/iso-2022-jp.c (BODY): Use a separate variable for
+	status.
+	(REINIT_PARAMS): Define.
+	* iconvdata/ibm1364.c (REINIT_PARAMS): Likewise.
+	* iconvdata/ibm930.c (REINIT_PARAMS): Likewise.
+	* iconvdata/ibm933.c (REINIT_PARAMS): Likewise.
+	* iconvdata/ibm935.c (REINIT_PARAMS): Likewise.
+	* iconvdata/ibm937.c (REINIT_PARAMS): Likewise.
+	* iconvdata/ibm939.c (REINIT_PARAMS): Likewise.
+	* iconvdata/iso-2022-cn.c (REINIT_PARAMS): Likewise.
+	* iconvdata/iso-2022-cn-ext.c (REINIT_PARAMS): Likewise.
+	* iconvdata/iso-2022-jp-3.c (REINIT_PARAMS): Likewise.
+	* iconvdata/iso-2022-kr.c (REINIT_PARAMS): Likewise.
+	* iconvdata/Makefile: Add rules to build and run tst-iconv7.c.
+	* iconvdata/tst-iconv7.c: New test.
+
 2008-01-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* libio/stdio.h (vscanf): Fix definition for loser compilers.

Modified: fsf/trunk/libc/iconv/loop.c
==============================================================================
--- fsf/trunk/libc/iconv/loop.c (original)
+++ fsf/trunk/libc/iconv/loop.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion loop frame work.
-   Copyright (C) 1998-2002, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -174,6 +174,15 @@
 # define EXTRA_LOOP_DECLS
 #endif
 
+/* Allow using UPDATE_PARAMS in macros where #ifdef UPDATE_PARAMS test
+   isn't possible.  */
+#ifndef UPDATE_PARAMS
+# define UPDATE_PARAMS do { } while (0)
+#endif
+#ifndef REINIT_PARAMS
+# define REINIT_PARAMS do { } while (0)
+#endif
+
 
 /* To make it easier for the writers of the modules, we define a macro
    to test whether we have to ignore errors.  */
@@ -213,6 +222,10 @@
       /* This means we are in call from __gconv_transliterate.  In this	      \
 	 case we are not doing any error recovery outself.  */		      \
       break;								      \
+									      \
+    /* If needed, flush any conversion state, so that __gconv_transliterate   \
+       starts with current shift state.  */				      \
+    UPDATE_PARAMS;							      \
 									      \
     /* First try the transliteration methods.  */			      \
     for (trans = step_data->__trans; trans != NULL; trans = trans->__next)    \
@@ -223,6 +236,9 @@
 	if (result != __GCONV_ILLEGAL_INPUT)				      \
 	  break;							      \
       }									      \
+									      \
+    REINIT_PARAMS;							      \
+									      \
     /* If any of them recognized the input continue with the loop.  */	      \
     if (result != __GCONV_ILLEGAL_INPUT)				      \
       {									      \
@@ -319,9 +335,7 @@
   /* Update the pointers pointed to by the parameters.  */
   *inptrp = inptr;
   *outptrp = outptr;
-#ifdef UPDATE_PARAMS
   UPDATE_PARAMS;
-#endif
 
   return result;
 }
@@ -492,6 +506,7 @@
 #undef EXTRA_LOOP_DECLS
 #undef INIT_PARAMS
 #undef UPDATE_PARAMS
+#undef REINIT_PARAMS
 #undef ONEBYTE_BODY
 #undef UNPACK_BYTES
 #undef CLEAR_STATE

Modified: fsf/trunk/libc/iconvdata/Makefile
==============================================================================
--- fsf/trunk/libc/iconvdata/Makefile (original)
+++ fsf/trunk/libc/iconvdata/Makefile Thu Jan 10 00:05:23 2008
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1997-2004,2005,2006,2007,2008 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
@@ -67,7 +67,7 @@
 
 ifeq (yes,$(build-shared))
 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
-	tst-iconv6 bug-iconv5 bug-iconv6
+	tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7
 ifeq ($(have-thread-library),yes)
 tests += bug-iconv3
 endif
@@ -365,6 +365,8 @@
 			  $(addprefix $(objpfx),$(modules.so))
 $(objpfx)tst-iconv4.out: $(objpfx)gconv-modules \
 			 $(addprefix $(objpfx),$(modules.so))
+$(objpfx)tst-iconv7.out: $(objpfx)gconv-modules \
+			 $(addprefix $(objpfx),$(modules.so))
 
 $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
 			 $(addprefix $(objpfx),$(modules.so)) \

Modified: fsf/trunk/libc/iconvdata/ibm1364.c
==============================================================================
--- fsf/trunk/libc/iconvdata/ibm1364.c (original)
+++ fsf/trunk/libc/iconvdata/ibm1364.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM1364.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@xxxxxxxxxx>, 2005.
 
@@ -387,6 +387,7 @@
 #define LOOP_NEED_FLAGS
 #define EXTRA_LOOP_DECLS	, int *curcsp
 #define INIT_PARAMS		int curcs = *curcsp & ~7
+#define REINIT_PARAMS		curcs = *curcsp & ~7
 #define UPDATE_PARAMS		*curcsp = curcs
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/ibm930.c
==============================================================================
--- fsf/trunk/libc/iconvdata/ibm930.c (original)
+++ fsf/trunk/libc/iconvdata/ibm930.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM930.
-   Copyright (C) 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@xxxxxxxxxxxxxxxx>, 2000.
 
@@ -277,6 +277,7 @@
 #define LOOP_NEED_FLAGS
 #define EXTRA_LOOP_DECLS	, int *curcsp
 #define INIT_PARAMS		int curcs = *curcsp & ~7
+#define REINIT_PARAMS		curcs = *curcsp & ~7
 #define UPDATE_PARAMS		*curcsp = curcs
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/ibm933.c
==============================================================================
--- fsf/trunk/libc/iconvdata/ibm933.c (original)
+++ fsf/trunk/libc/iconvdata/ibm933.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM933.
-   Copyright (C) 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@xxxxxxxxxxxxxxxx>, 2000.
 
@@ -272,6 +272,7 @@
 #define LOOP_NEED_FLAGS
 #define EXTRA_LOOP_DECLS	, int *curcsp
 #define INIT_PARAMS		int curcs = *curcsp & ~7
+#define REINIT_PARAMS		curcs = *curcsp & ~7
 #define UPDATE_PARAMS		*curcsp = curcs
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/ibm935.c
==============================================================================
--- fsf/trunk/libc/iconvdata/ibm935.c (original)
+++ fsf/trunk/libc/iconvdata/ibm935.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM935
-   Copyright (C) 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@xxxxxxxxxxxxxxxx>, 2000.
 
@@ -272,6 +272,7 @@
 #define LOOP_NEED_FLAGS
 #define EXTRA_LOOP_DECLS	, int *curcsp
 #define INIT_PARAMS		int curcs = *curcsp & ~7
+#define REINIT_PARAMS		curcs = *curcsp & ~7
 #define UPDATE_PARAMS		*curcsp = curcs
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/ibm937.c
==============================================================================
--- fsf/trunk/libc/iconvdata/ibm937.c (original)
+++ fsf/trunk/libc/iconvdata/ibm937.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM937.
-   Copyright (C) 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@xxxxxxxxxxxxxxxx>, 2000.
 
@@ -272,6 +272,7 @@
 #define LOOP_NEED_FLAGS
 #define EXTRA_LOOP_DECLS	, int *curcsp
 #define INIT_PARAMS		int curcs = *curcsp & ~7
+#define REINIT_PARAMS		curcs = *curcsp & ~7
 #define UPDATE_PARAMS		*curcsp = curcs
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/ibm939.c
==============================================================================
--- fsf/trunk/libc/iconvdata/ibm939.c (original)
+++ fsf/trunk/libc/iconvdata/ibm939.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion to and from IBM939.
-   Copyright (C) 2000-2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2005, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@xxxxxxxxxxxxxxxx>, 2000.
 
@@ -277,6 +277,7 @@
 #define LOOP_NEED_FLAGS
 #define EXTRA_LOOP_DECLS	, int *curcsp
 #define INIT_PARAMS		int curcs = *curcsp & ~7
+#define REINIT_PARAMS		curcs = *curcsp & ~7
 #define UPDATE_PARAMS		*curcsp = curcs
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/iso-2022-cn-ext.c
==============================================================================
--- fsf/trunk/libc/iconvdata/iso-2022-cn-ext.c (original)
+++ fsf/trunk/libc/iconvdata/iso-2022-cn-ext.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion module for ISO-2022-CN-EXT.
-   Copyright (C) 2000-2002, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2004, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2000.
 
@@ -648,6 +648,12 @@
 #define EXTRA_LOOP_DECLS	, int *setp
 #define INIT_PARAMS		int set = (*setp >> 3) & CURRENT_MASK; \
 				int ann = (*setp >> 3) & ~CURRENT_MASK
+#define REINIT_PARAMS		do					      \
+				  {					      \
+				    set = (*setp >> 3) & CURRENT_MASK;	      \
+				    ann = (*setp >> 3) & ~CURRENT_MASK;	      \
+				  }					      \
+				while (0)
 #define UPDATE_PARAMS		*setp = (set | ann) << 3
 #define LOOP_NEED_FLAGS
 #include <iconv/loop.c>

Modified: fsf/trunk/libc/iconvdata/iso-2022-cn.c
==============================================================================
--- fsf/trunk/libc/iconvdata/iso-2022-cn.c (original)
+++ fsf/trunk/libc/iconvdata/iso-2022-cn.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Conversion module for ISO-2022-CN.
-   Copyright (C) 1999, 2000-2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000-2002, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1999.
 
@@ -393,6 +393,12 @@
 #define EXTRA_LOOP_DECLS	, int *setp
 #define INIT_PARAMS		int set = *setp & CURRENT_SEL_MASK; \
 				int ann = *setp & CURRENT_ANN_MASK
+#define REINIT_PARAMS		do					      \
+				  {					      \
+				    set = *setp & CURRENT_SEL_MASK;	      \
+				    ann = *setp & CURRENT_ANN_MASK;	      \
+				  }					      \
+				while (0)
 #define UPDATE_PARAMS		*setp = set | ann
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/iso-2022-jp-3.c
==============================================================================
--- fsf/trunk/libc/iconvdata/iso-2022-jp-3.c (original)
+++ fsf/trunk/libc/iconvdata/iso-2022-jp-3.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,6 @@
 /* Conversion module for ISO-2022-JP-3.
-   Copyright (C) 1998-1999, 2000-2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2000-2002, 2004, 2008
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998,
    and Bruno Haible <bruno@xxxxxxxxx>, 2002.
@@ -759,6 +760,12 @@
 #define EXTRA_LOOP_DECLS	, int *statep
 #define INIT_PARAMS		int set = *statep & CURRENT_SEL_MASK;	      \
 				uint32_t lasttwo = *statep >> 6
+#define REINIT_PARAMS		do					      \
+				  {					      \
+				    set = *statep & CURRENT_SEL_MASK;	      \
+				    lasttwo = *statep >> 6;		      \
+				  }					      \
+				while (0)
 #define UPDATE_PARAMS		*statep = set | (lasttwo << 6)
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/iso-2022-jp.c
==============================================================================
--- fsf/trunk/libc/iconvdata/iso-2022-jp.c (original)
+++ fsf/trunk/libc/iconvdata/iso-2022-jp.c Thu Jan 10 00:05:23 2008
@@ -715,8 +715,7 @@
 	       list that depends on the current language tag.  */	      \
 	    cvlist_t conversion_list;					      \
 	    unsigned char buf[2];					      \
-									      \
-	    result = __GCONV_ILLEGAL_INPUT;				      \
+	    int res = __GCONV_ILLEGAL_INPUT;				      \
 									      \
 	    if (var == iso2022jp2)					      \
 	      conversion_list = conversion_lists[tag >> 8];		      \
@@ -735,7 +734,7 @@
 			{						      \
 			  if (__builtin_expect (outptr + 3 > outend, 0))      \
 			    {						      \
-			      result = __GCONV_FULL_OUTPUT;		      \
+			      res = __GCONV_FULL_OUTPUT;		      \
 			      break;					      \
 			    }						      \
 			  *outptr++ = ESC;				      \
@@ -746,13 +745,13 @@
 									      \
 		      if (__builtin_expect (outptr + 3 > outend, 0))	      \
 			{						      \
-			  result = __GCONV_FULL_OUTPUT;			      \
+			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
 			}						      \
 		      *outptr++ = ESC;					      \
 		      *outptr++ = 'N';					      \
 		      *outptr++ = ch - 0x80;				      \
-		      result = __GCONV_OK;				      \
+		      res = __GCONV_OK;					      \
 		      break;						      \
 		    }							      \
 									      \
@@ -774,7 +773,7 @@
 				  if (__builtin_expect (outptr + 3 > outend,  \
 							0))		      \
 				    {					      \
-				      result = __GCONV_FULL_OUTPUT;	      \
+				      res = __GCONV_FULL_OUTPUT;	      \
 				      break;				      \
 				    }					      \
 				  *outptr++ = ESC;			      \
@@ -785,13 +784,13 @@
 									      \
 			      if (__builtin_expect (outptr + 3 > outend, 0))  \
 				{					      \
-				  result = __GCONV_FULL_OUTPUT;		      \
+				  res = __GCONV_FULL_OUTPUT;		      \
 				  break;				      \
 				}					      \
 			      *outptr++ = ESC;				      \
 			      *outptr++ = 'N';				      \
 			      *outptr++ = res;				      \
-			      result = __GCONV_OK;			      \
+			      res = __GCONV_OK;				      \
 			      break;					      \
 			    }						      \
 			}						      \
@@ -810,7 +809,7 @@
 			{						      \
 			  if (__builtin_expect (outptr + 3 > outend, 0))      \
 			    {						      \
-			      result = __GCONV_FULL_OUTPUT;		      \
+			      res = __GCONV_FULL_OUTPUT;		      \
 			      break;					      \
 			    }						      \
 			  *outptr++ = ESC;				      \
@@ -821,11 +820,11 @@
 									      \
 		      if (__builtin_expect (outptr + 1 > outend, 0))	      \
 			{						      \
-			  result = __GCONV_FULL_OUTPUT;			      \
+			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
 			}						      \
 		      *outptr++ = buf[0];				      \
-		      result = __GCONV_OK;				      \
+		      res = __GCONV_OK;					      \
 		      break;						      \
 		    }							      \
 									      \
@@ -837,7 +836,7 @@
 			{						      \
 			  if (__builtin_expect (outptr + 3 > outend, 0))      \
 			    {						      \
-			      result = __GCONV_FULL_OUTPUT;		      \
+			      res = __GCONV_FULL_OUTPUT;		      \
 			      break;					      \
 			    }						      \
 			  *outptr++ = ESC;				      \
@@ -848,12 +847,12 @@
 									      \
 		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
 			{						      \
-			  result = __GCONV_FULL_OUTPUT;			      \
+			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
 			}						      \
 		      *outptr++ = buf[0];				      \
 		      *outptr++ = buf[1];				      \
-		      result = __GCONV_OK;				      \
+		      res = __GCONV_OK;					      \
 		      break;						      \
 		    }							      \
 									      \
@@ -869,7 +868,7 @@
 			{						      \
 			  if (__builtin_expect (outptr + 4 > outend, 0))      \
 			    {						      \
-			      result = __GCONV_FULL_OUTPUT;		      \
+			      res = __GCONV_FULL_OUTPUT;		      \
 			      break;					      \
 			    }						      \
 			  *outptr++ = ESC;				      \
@@ -881,12 +880,12 @@
 									      \
 		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
 			{						      \
-			  result = __GCONV_FULL_OUTPUT;			      \
+			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
 			}						      \
 		      *outptr++ = buf[0];				      \
 		      *outptr++ = buf[1];				      \
-		      result = __GCONV_OK;				      \
+		      res = __GCONV_OK;					      \
 		      break;						      \
 		    }							      \
 									      \
@@ -903,7 +902,7 @@
 			{						      \
 			  if (__builtin_expect (outptr + 3 > outend, 0))      \
 			    {						      \
-			      result = __GCONV_FULL_OUTPUT;		      \
+			      res = __GCONV_FULL_OUTPUT;		      \
 			      break;					      \
 			    }						      \
 			  *outptr++ = ESC;				      \
@@ -914,12 +913,12 @@
 									      \
 		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
 			{						      \
-			  result = __GCONV_FULL_OUTPUT;			      \
+			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
 			}						      \
 		      *outptr++ = buf[0];				      \
 		      *outptr++ = buf[1];				      \
-		      result = __GCONV_OK;				      \
+		      res = __GCONV_OK;					      \
 		      break;						      \
 		    }							      \
 									      \
@@ -936,7 +935,7 @@
 			{						      \
 			  if (__builtin_expect (outptr + 4 > outend, 0))      \
 			    {						      \
-			      result = __GCONV_FULL_OUTPUT;		      \
+			      res = __GCONV_FULL_OUTPUT;		      \
 			      break;					      \
 			    }						      \
 			  *outptr++ = ESC;				      \
@@ -948,12 +947,12 @@
 									      \
 		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
 			{						      \
-			  result = __GCONV_FULL_OUTPUT;			      \
+			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
 			}						      \
 		      *outptr++ = buf[0];				      \
 		      *outptr++ = buf[1];				      \
-		      result = __GCONV_OK;				      \
+		      res = __GCONV_OK;					      \
 		      break;						      \
 		    }							      \
 									      \
@@ -972,7 +971,7 @@
 			{						      \
 			  if (__builtin_expect (outptr + 3 > outend, 0))      \
 			    {						      \
-			      result = __GCONV_FULL_OUTPUT;		      \
+			      res = __GCONV_FULL_OUTPUT;		      \
 			      break;					      \
 			    }						      \
 			  *outptr++ = ESC;				      \
@@ -983,11 +982,11 @@
 									      \
 		      if (__builtin_expect (outptr + 1 > outend, 0))	      \
 			{						      \
-			  result = __GCONV_FULL_OUTPUT;			      \
+			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
 			}						      \
 		      *outptr++ = buf[0] - 0x80;			      \
-		      result = __GCONV_OK;				      \
+		      res = __GCONV_OK;					      \
 		      break;						      \
 		    }							      \
 									      \
@@ -996,13 +995,16 @@
 		default:						      \
 		  abort ();						      \
 		}							      \
-	    while (result == __GCONV_ILLEGAL_INPUT			      \
+	    while (res == __GCONV_ILLEGAL_INPUT				      \
 		   && (conversion_list = CVLIST_REST (conversion_list)) != 0);\
 									      \
-	    if (result == __GCONV_FULL_OUTPUT)				      \
-	      break;							      \
-									      \
-	    if (result == __GCONV_ILLEGAL_INPUT)			      \
+	    if (res == __GCONV_FULL_OUTPUT)				      \
+	      {								      \
+		result = res;						      \
+		break;							      \
+	      }								      \
+									      \
+	    if (res == __GCONV_ILLEGAL_INPUT)				      \
 	      {								      \
 		STANDARD_TO_LOOP_ERR_HANDLER (4);			      \
 	      }								      \
@@ -1017,6 +1019,13 @@
 #define INIT_PARAMS		int set = *setp & CURRENT_SEL_MASK;	      \
 				int set2 = *setp & CURRENT_ASSIGN_MASK;	      \
 				int tag = *setp & CURRENT_TAG_MASK;
+#define REINIT_PARAMS		do					      \
+				  {					      \
+				    set = *setp & CURRENT_SEL_MASK;	      \
+				    set2 = *setp & CURRENT_ASSIGN_MASK;	      \
+				    tag = *setp & CURRENT_TAG_MASK;	      \
+				  }					      \
+				while (0)
 #define UPDATE_PARAMS		*setp = set | set2 | tag
 #include <iconv/loop.c>
 

Modified: fsf/trunk/libc/iconvdata/iso-2022-kr.c
==============================================================================
--- fsf/trunk/libc/iconvdata/iso-2022-kr.c (original)
+++ fsf/trunk/libc/iconvdata/iso-2022-kr.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,6 @@
 /* Conversion module for ISO-2022-KR.
-   Copyright (C) 1998, 1999, 2000-2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000-2002, 2007, 2008
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -261,6 +262,7 @@
 #define LOOP_NEED_FLAGS
 #define EXTRA_LOOP_DECLS	, int *setp
 #define INIT_PARAMS		int set = *setp
+#define REINIT_PARAMS		set = *setp
 #define UPDATE_PARAMS		*setp = set
 #include <iconv/loop.c>
 

Added: fsf/trunk/libc/iconvdata/tst-iconv7.c
==============================================================================
--- fsf/trunk/libc/iconvdata/tst-iconv7.c (added)
+++ fsf/trunk/libc/iconvdata/tst-iconv7.c Thu Jan 10 00:05:23 2008
@@ -1,0 +1,61 @@
+#include <iconv.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int
+do_test (void)
+{
+  setlocale (LC_ALL, "de_DE.UTF-8");
+
+  iconv_t cd = iconv_open ("ISO-2022-JP//TRANSLIT", "");
+  if (cd == (iconv_t) -1)
+    {
+      puts ("iconv_open failed");
+      return 1;
+    }
+
+  char instr1[] = "\xc2\xa3\xe2\x82\xac\n";
+  const char expstr1[] = "\033$B!r\033(BEUR\n";
+  char outstr[32];
+  size_t inlen = sizeof (instr1);
+  size_t outlen = sizeof (outstr);
+  char *inptr = instr1;
+  char *outptr = outstr;
+  size_t r = iconv (cd, &inptr, &inlen, &outptr, &outlen);
+  if (r != 1
+      || inlen != 0
+      || outlen != sizeof (outstr) - sizeof (expstr1)
+      || memcmp (outstr, expstr1, sizeof (expstr1)) != 0)
+    {
+      puts ("wrong first conversion");
+      return 1;
+    }
+
+  char instr2[] = "\xe3\x88\xb1\n";
+  const char expstr2[] = "(\033$B3t\033(B)\n";
+  inlen = sizeof (instr2);
+  outlen = sizeof (outstr);
+  inptr = instr2;
+  outptr = outstr;
+  r = iconv (cd, &inptr, &inlen, &outptr, &outlen);
+  if (r != 1
+      || inlen != 0
+      || outlen != sizeof (outstr) - sizeof (expstr2)
+      || memcmp (outstr, expstr2, sizeof (expstr2)) != 0)
+    {
+      puts ("wrong second conversion");
+      return 1;
+    }
+
+  if (iconv_close (cd) != 0)
+    {
+      puts ("iconv_close failed");
+      return 1;
+    }
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 1996-2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1996-2006, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wg@xxxxxxxxx>
    and Doug Lea <dl@xxxxxxxxxxxxx>, 2001.
@@ -3553,9 +3553,10 @@
     /* Maybe the failure is due to running out of mmapped areas. */
     if(ar_ptr != &main_arena) {
       (void)mutex_unlock(&ar_ptr->mutex);
-      (void)mutex_lock(&main_arena.mutex);
-      victim = _int_malloc(&main_arena, bytes);
-      (void)mutex_unlock(&main_arena.mutex);
+      ar_ptr = &main_arena;
+      (void)mutex_lock(&ar_ptr->mutex);
+      victim = _int_malloc(ar_ptr, bytes);
+      (void)mutex_unlock(&ar_ptr->mutex);
     } else {
 #if USE_ARENAS
       /* ... or sbrk() has failed and there is still a chance to mmap() */
@@ -3760,17 +3761,20 @@
   if(!ar_ptr)
     return 0;
   p = _int_memalign(ar_ptr, alignment, bytes);
-  (void)mutex_unlock(&ar_ptr->mutex);
   if(!p) {
     /* Maybe the failure is due to running out of mmapped areas. */
     if(ar_ptr != &main_arena) {
-      (void)mutex_lock(&main_arena.mutex);
-      p = _int_memalign(&main_arena, alignment, bytes);
-      (void)mutex_unlock(&main_arena.mutex);
+      (void)mutex_unlock(&ar_ptr->mutex);
+      ar_ptr = &main_arena;
+      (void)mutex_lock(&ar_ptr->mutex);
+      p = _int_memalign(ar_ptr, alignment, bytes);
+      (void)mutex_unlock(&ar_ptr->mutex);
     } else {
 #if USE_ARENAS
       /* ... or sbrk() has failed and there is still a chance to mmap() */
-      ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes);
+      mstate prev = ar_ptr->next ? ar_ptr : 0;
+      (void)mutex_unlock(&ar_ptr->mutex);
+      ar_ptr = arena_get2(prev, bytes);
       if(ar_ptr) {
         p = _int_memalign(ar_ptr, alignment, bytes);
         (void)mutex_unlock(&ar_ptr->mutex);

Modified: fsf/trunk/libc/stdlib/Makefile
==============================================================================
--- fsf/trunk/libc/stdlib/Makefile (original)
+++ fsf/trunk/libc/stdlib/Makefile Thu Jan 10 00:05:23 2008
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1991-2006, 2007, 2008 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
@@ -68,7 +68,8 @@
 		   tst-limits tst-rand48 bug-strtod tst-setcontext	    \
 		   test-a64l tst-qsort tst-system testmb2 bug-strtod2	    \
 		   tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
-		   tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2
+		   tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2	    \
+		   tst-makecontext2
 
 include ../Makeconfig
 
@@ -106,6 +107,7 @@
 
 CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
 CFLAGS-tst-qsort.c = $(stack-align-test-flags)
+CFLAGS-tst-makecontext2.c = $(stack-align-test-flags)
 
 include ../Rules
 

Added: fsf/trunk/libc/stdlib/tst-makecontext2.c
==============================================================================
--- fsf/trunk/libc/stdlib/tst-makecontext2.c (added)
+++ fsf/trunk/libc/stdlib/tst-makecontext2.c Thu Jan 10 00:05:23 2008
@@ -1,0 +1,80 @@
+/* Copyright (C) 2008 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ucontext.h>
+#include <tst-stack-align.h>
+
+ucontext_t ucp, ucp2;
+char st1[262144] __attribute__((aligned (16)));
+
+void
+cf (int i, int j)
+{
+  if (i != 78 || j != 274)
+    {
+      printf ("i %d j %d\n", i, j);
+      exit (1);
+    }
+  else if (TEST_STACK_ALIGN ())
+    {
+      puts ("insufficiently aligned stack");
+      exit (2);
+    }
+}
+
+int
+do_test (void)
+{
+  for (size_t j = 32; j < 64; j += sizeof (long))
+    {
+      if (getcontext (&ucp) != 0)
+	{
+	  if (errno == ENOSYS)
+	    {
+	      puts ("context handling not supported");
+	      return 0;
+	    }
+
+	  puts ("getcontext failed");
+	  return 1;
+	}
+      ucp.uc_link = &ucp2;
+      ucp.uc_stack.ss_sp = st1;
+      ucp.uc_stack.ss_size = sizeof (st1) - j;
+      memset (&st1[sizeof (st1) - j], 0x55, j);
+      makecontext (&ucp, (void (*) (void)) cf, 2, 78, 274);
+      if (swapcontext (&ucp2, &ucp) != 0)
+	{
+	  puts ("setcontext failed");
+	  return 1;
+	}
+
+      for (size_t i = j; i > 0; i--)
+	if (st1[sizeof (st1) - j + i - 1] != 0x55)
+	  { printf ("fail %zd %zd\n", i, j); break; }
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/sunrpc/clnt_perr.c
==============================================================================
--- fsf/trunk/libc/sunrpc/clnt_perr.c (original)
+++ fsf/trunk/libc/sunrpc/clnt_perr.c Thu Jan 10 00:05:23 2008
@@ -60,36 +60,21 @@
 static char *buf;
 #endif
 
-static char *
-_buf (void)
-{
-  if (buf == NULL)
-    buf = (char *) malloc (256);
-  return buf;
-}
-
 /*
  * Print reply error info
  */
 char *
 clnt_sperror (CLIENT * rpch, const char *msg)
 {
+  struct rpc_err e;
+  CLNT_GETERR (rpch, &e);
+
+  const char *errstr = clnt_sperrno (e.re_status);
+
   char chrbuf[1024];
-  struct rpc_err e;
-  char *err;
-  char *str = _buf ();
-  char *strstart = str;
-  int len;
-
-  if (str == NULL)
-    return NULL;
-  CLNT_GETERR (rpch, &e);
-
-  len = sprintf (str, "%s: ", msg);
-  str += len;
-
-  str = stpcpy (str, clnt_sperrno (e.re_status));
-
+  char *str;
+  char *tmpstr;
+  int res;
   switch (e.re_status)
     {
     case RPC_SUCCESS:
@@ -105,50 +90,52 @@
     case RPC_PMAPFAILURE:
     case RPC_PROGNOTREGISTERED:
     case RPC_FAILED:
+      res = __asprintf (&str, "%s: %s\n", msg, errstr);
       break;
 
     case RPC_CANTSEND:
     case RPC_CANTRECV:
-      len = sprintf (str, "; errno = %s", __strerror_r (e.re_errno,
-							chrbuf, sizeof chrbuf));
-      str += len;
+      res = __asprintf (&str, "%s: %s; errno = %s\n",
+			msg, errstr, __strerror_r (e.re_errno,
+						   chrbuf, sizeof chrbuf));
       break;
 
     case RPC_VERSMISMATCH:
-      len= sprintf (str, _("; low version = %lu, high version = %lu"),
-		    e.re_vers.low, e.re_vers.high);
-      str += len;
+      res = __asprintf (&str,
+			_("%s: %s; low version = %lu, high version = %lu"),
+			msg, errstr, e.re_vers.low, e.re_vers.high);
       break;
 
     case RPC_AUTHERROR:
-      err = auth_errmsg (e.re_why);
-      str = stpcpy (str, _ ("; why = "));
-      if (err != NULL)
-	{
-	  str = stpcpy (str, err);
-	}
+      tmpstr = auth_errmsg (e.re_why);
+      if (tmpstr != NULL)
+	res = __asprintf (&str, _("%s: %s; why = %s\n"), msg, errstr, tmpstr);
       else
-	{
-	  len = sprintf (str, _("(unknown authentication error - %d)"),
-			 (int) e.re_why);
-	  str += len;
-	}
+	res = __asprintf (&str, _("\
+%s: %s; why = (unknown authentication error - %d)\n"),
+			  msg, errstr, (int) e.re_why);
       break;
 
     case RPC_PROGVERSMISMATCH:
-      len = sprintf (str, _("; low version = %lu, high version = %lu"),
-		     e.re_vers.low, e.re_vers.high);
-      str += len;
+      res = __asprintf (&str,
+			_("%s: %s; low version = %lu, high version = %lu"),
+			msg, errstr, e.re_vers.low, e.re_vers.high);
       break;
 
     default:			/* unknown */
-      len = sprintf (str, "; s1 = %lu, s2 = %lu", e.re_lb.s1, e.re_lb.s2);
-      str += len;
+      res = __asprintf (&str, "%s: %s; s1 = %lu, s2 = %lu",
+			msg, errstr, e.re_lb.s1, e.re_lb.s2);
       break;
     }
-  *str = '\n';
-  *++str = '\0';
-  return (strstart);
+
+  if (res < 0)
+    return NULL;
+
+  char *oldbuf = buf;
+  buf = str;
+  free (oldbuf);
+
+  return str;
 }
 libc_hidden_def (clnt_sperror)
 
@@ -291,35 +278,36 @@
 char *
 clnt_spcreateerror (const char *msg)
 {
+  struct rpc_createerr *ce = &get_rpc_createerr ();
+
   char chrbuf[1024];
-  char *str = _buf ();
-  char *cp;
-  int len;
-  struct rpc_createerr *ce;
-
-  if (str == NULL)
-    return NULL;
-  ce = &get_rpc_createerr ();
-  len = sprintf (str, "%s: ", msg);
-  cp = str + len;
-  cp = stpcpy (cp, clnt_sperrno (ce->cf_stat));
+  const char *connector = "";
+  const char *errstr = "";
   switch (ce->cf_stat)
     {
     case RPC_PMAPFAILURE:
-      cp = stpcpy (stpcpy (cp, " - "),
-		   clnt_sperrno (ce->cf_error.re_status));
+      connector = " - ";
+      errstr = clnt_sperrno (ce->cf_error.re_status);
       break;
 
     case RPC_SYSTEMERROR:
-      cp = stpcpy (stpcpy (cp, " - "),
-		   __strerror_r (ce->cf_error.re_errno,
-				 chrbuf, sizeof chrbuf));
-      break;
+      connector = " - ";
+      errstr = __strerror_r (ce->cf_error.re_errno, chrbuf, sizeof chrbuf);
+      break;
+
     default:
       break;
     }
-  *cp = '\n';
-  *++cp = '\0';
+
+  char *str;
+  if (__asprintf (&str, "%s: %s%s%s\n",
+		  msg, clnt_sperrno (ce->cf_stat), connector, errstr) < 0)
+    return NULL;
+
+  char *oldbuf = buf;
+  buf = str;
+  free (oldbuf);
+
   return str;
 }
 libc_hidden_def (clnt_spcreateerror)

Modified: fsf/trunk/libc/sunrpc/rpc_thread.c
==============================================================================
--- fsf/trunk/libc/sunrpc/rpc_thread.c (original)
+++ fsf/trunk/libc/sunrpc/rpc_thread.c Thu Jan 10 00:05:23 2008
@@ -29,6 +29,8 @@
 		free (tvp->svcraw_private_s);
 		free (tvp->authdes_cache_s);
 		free (tvp->authdes_lru_s);
+		free (tvp->svc_xports_s);
+		free (tvp->svc_pollfd_s);
 		if (tvp != &__libc_tsd_RPC_VARS_mem)
 			free (tvp);
 		__libc_tsd_set (RPC_VARS, NULL);

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/makecontext.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/makecontext.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/makecontext.S Thu Jan 10 00:05:23 2008
@@ -1,5 +1,5 @@
 /* Create new context.
-   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2001.
 
@@ -41,13 +41,15 @@
 	movl	12(%esp), %ecx
 	movl	%ecx, oEBX(%eax)
 
-	/* Make room on the new stack for the parameters.  */
+	/* Make room on the new stack for the parameters.
+	   Room for the arguments, return address (== L(exitcode)) and
+	   oLINK pointer is needed.  One of the pointer sizes is subtracted
+	   after aligning the stack.  */
 	negl	%ecx
-	leal	-8(%edx,%ecx,4), %edx
+	leal	-4(%edx,%ecx,4), %edx
 	negl	%ecx
 
 	/* Align the stack.  */
-	addl	$16, %edx
 	andl	$0xfffffff0, %edx
 	subl	$4, %edx