+2005-10-07 Bob Wilson <bob.wilson@acm.org>
+
+ * libc/stdlib/mallocr.c (mALLOc, rEALLOCc, mEMALIGn): Set errno
+ to ENOMEM on failure.
+
2005-10-06 Ralf Corsepius <ralf.corsepius@rtems.org>
* libc/include/stdint.h: Add [u]int_fast<N>_t types.
#include <stdio.h> /* needed for malloc_stats */
#include <limits.h> /* needed for overflow checks */
+#include <errno.h> /* needed to set errno to ENOMEM */
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#define RDECL struct _reent *reent_ptr;
#endif
+#define RERRNO reent_ptr->_errno
#define RCALL reent_ptr,
#define RONECALL reent_ptr
#define RARG
#define RONEARG
#define RDECL
+#define RERRNO errno
#define RCALL
#define RONECALL
/* Check for overflow and just fail, if so. */
if (nb > INT_MAX || nb < bytes)
+ {
+ RERRNO = ENOMEM;
return 0;
+ }
MALLOC_LOCK;
/* Check for overflow and just fail, if so. */
if (nb > INT_MAX || nb < bytes)
+ {
+ RERRNO = ENOMEM;
return 0;
+ }
#if HAVE_MMAP
if (chunk_is_mmapped(oldp))
/* Check for overflow. */
if (nb > INT_MAX || nb < bytes)
+ {
+ RERRNO = ENOMEM;
return 0;
+ }
m = (char*)(mALLOc(RCALL nb + alignment + MINSIZE));