reverted commits 1399 and 1400 to stddef.h.

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@1405 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-headers/include/ChangeLog b/mingw-w64-headers/include/ChangeLog
index b81f4d9..f8f0302 100644
--- a/mingw-w64-headers/include/ChangeLog
+++ b/mingw-w64-headers/include/ChangeLog
@@ -14,12 +14,6 @@
 	the end. Added a noted that _CRT_PACKING definition being duplicated in
 	vadefs.h.
 
-	* stddef.h: Moved __threadid() and __threadhandle() from here ..
-	* _mingw.h: .. here, with notes.
-
-	* stddef.h: Removed the errno.h stuff that have no sane reason to stay
-	in stddef.h for mingw.
-
 	* _mingw.h (__USE_MINGW_ANSI_STDIO): If not explicitly defined by the
 	user, only check against the _POSIX define when forcibly enabling it.
 
diff --git a/mingw-w64-headers/include/_mingw.h b/mingw-w64-headers/include/_mingw.h
index 0bd9832..ad6c6ef 100644
--- a/mingw-w64-headers/include/_mingw.h
+++ b/mingw-w64-headers/include/_mingw.h
@@ -534,11 +534,6 @@
 extern "C" {
 #endif
 
-/* These two are not documented at MSDN.. */
-  _CRTIMP extern unsigned long __cdecl __threadid(void);
-#define _threadid (__threadid())
-  _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
-
 /* mingw-w64 specific functions: */
   const char *__mingw_get_crt_info (void);
 
diff --git a/mingw-w64-headers/include/stddef.h b/mingw-w64-headers/include/stddef.h
index 35696cc..621ce4a 100644
--- a/mingw-w64-headers/include/stddef.h
+++ b/mingw-w64-headers/include/stddef.h
@@ -8,7 +8,27 @@
 
 #ifndef _INC_STDDEF
 #define _INC_STDDEF
-/* nothing */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _CRT_ERRNO_DEFINED
+#define _CRT_ERRNO_DEFINED
+  _CRTIMP extern int *__cdecl _errno(void);
+#define errno (*_errno())
+  errno_t __cdecl _set_errno(int _Value);
+  errno_t __cdecl _get_errno(int *_Value);
+#endif
+
+  _CRTIMP extern unsigned long __cdecl __threadid(void);
+#define _threadid (__threadid())
+  _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /*