Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/malloc_wrapper.cc')
-rw-r--r--winsup/cygwin/malloc_wrapper.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
index 086c43d36..dce4a77dc 100644
--- a/winsup/cygwin/malloc_wrapper.cc
+++ b/winsup/cygwin/malloc_wrapper.cc
@@ -70,8 +70,6 @@ malloc (size_t size)
__malloc_unlock ();
}
malloc_printf ("(%d) = %x, called by %p", size, res, __builtin_return_address (0));
- if (!res)
- set_errno (ENOMEM);
return res;
}
@@ -88,8 +86,6 @@ realloc (void *p, size_t size)
__malloc_unlock ();
}
malloc_printf ("(%x, %d) = %x, called by %x", p, size, res, __builtin_return_address (0));
- if (!res)
- set_errno (ENOMEM);
return res;
}
@@ -106,14 +102,14 @@ calloc (size_t nmemb, size_t size)
__malloc_unlock ();
}
malloc_printf ("(%d, %d) = %x, called by %x", nmemb, size, res, __builtin_return_address (0));
- if (!res)
- set_errno (ENOMEM);
return res;
}
extern "C" int
posix_memalign (void **memptr, size_t alignment, size_t bytes)
{
+ save_errno save;
+
void *res;
if (!use_internal_malloc)
return ENOSYS;
@@ -143,8 +139,6 @@ memalign (size_t alignment, size_t bytes)
__malloc_lock ();
res = dlmemalign (alignment, bytes);
__malloc_unlock ();
- if (!res)
- set_errno (ENOMEM);
}
return res;
@@ -164,8 +158,6 @@ valloc (size_t bytes)
__malloc_lock ();
res = dlvalloc (bytes);
__malloc_unlock ();
- if (!res)
- set_errno (ENOMEM);
}
return res;
@@ -299,3 +291,9 @@ malloc_init ()
}
#endif
}
+
+extern "C" void
+__set_ENOMEM ()
+{
+ set_errno (ENOMEM);
+}