This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.14-284-g8e58439


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  8e58439c92250cde8aae7c2313d08578070b95bb (commit)
      from  02d46fc4b969e25e4ba0c54aa95fa98d7279bd05 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8e58439c92250cde8aae7c2313d08578070b95bb

commit 8e58439c92250cde8aae7c2313d08578070b95bb
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat Sep 10 22:12:38 2011 -0400

    Remove MALLOC_FAILURE_ACTION use in malloc

diff --git a/ChangeLog b/ChangeLog
index 05a6b61..03b02d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-09-10  Ulrich Drepper  <drepper@gmail.com>
 
+	* malloc/malloc.c: Replace MALLOC_FAILURE_ACTION with use of __set_errno.
+	* malloc/hooks.c: Likewise.
+
 	* malloc/arena.c (ptmalloc_init_minimal): Removed.  Initialize all
 	variables statically.
 	(narenas): Initialize.
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 7817ae9..fc46e7d 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -204,7 +204,7 @@ top_check(void)
   new_brk = (char*)(MORECORE (sbrk_size));
   if (new_brk == (char*)(MORECORE_FAILURE))
     {
-      MALLOC_FAILURE_ACTION;
+      __set_errno (ENOMEM);
       return -1;
     }
   /* Call the `morecore' hook if necessary.  */
@@ -225,7 +225,7 @@ malloc_check(size_t sz, const void *caller)
   void *victim;
 
   if (sz+1 == 0) {
-    MALLOC_FAILURE_ACTION;
+    __set_errno (ENOMEM);
     return NULL;
   }
 
@@ -266,7 +266,7 @@ realloc_check(void* oldmem, size_t bytes, const void *caller)
   unsigned char *magic_p;
 
   if (bytes+1 == 0) {
-    MALLOC_FAILURE_ACTION;
+    __set_errno (ENOMEM);
     return NULL;
   }
   if (oldmem == 0) return malloc_check(bytes, NULL);
@@ -334,7 +334,7 @@ memalign_check(size_t alignment, size_t bytes, const void *caller)
   if (alignment <  MINSIZE) alignment = MINSIZE;
 
   if (bytes+1 == 0) {
-    MALLOC_FAILURE_ACTION;
+    __set_errno (ENOMEM);
     return NULL;
   }
   (void)mutex_lock(&main_arena.mutex);
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 3cff6d8..864c7d9 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -184,7 +184,6 @@
     USE_MALLOC_LOCK            NOT defined
     MALLOC_DEBUG               NOT defined
     REALLOC_ZERO_BYTES_FREES   1
-    MALLOC_FAILURE_ACTION      errno = ENOMEM
     TRIM_FASTBINS              0
 
     Options for customizing MORECORE:
@@ -233,7 +232,7 @@ extern "C" {
 
 #include <unistd.h>
 #include <stdio.h>    /* needed for malloc_stats */
-#include <errno.h>    /* needed for optional MALLOC_FAILURE_ACTION */
+#include <errno.h>
 
 /* For uintptr_t.  */
 #include <stdint.h>
@@ -479,20 +478,6 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore;
 
 
 /*
-  MALLOC_FAILURE_ACTION is the action to take before "return 0" when
-  malloc fails to be able to return memory, either because memory is
-  exhausted or because of illegal arguments.
-
-  By default, sets errno if running on STD_C platform, else does nothing.
-*/
-
-#ifndef MALLOC_FAILURE_ACTION
-#define MALLOC_FAILURE_ACTION \
-   errno = ENOMEM;
-
-#endif
-
-/*
   MORECORE-related declarations. By default, rely on sbrk
 */
 
@@ -1401,7 +1386,7 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
 #define checked_request2size(req, sz)                             \
   if (REQUEST_OUT_OF_RANGE(req)) {                                \
-    MALLOC_FAILURE_ACTION;                                        \
+    __set_errno (ENOMEM);					  \
     return 0;                                                     \
   }                                                               \
   (sz) = request2size(req);
@@ -2774,7 +2759,7 @@ static void* sYSMALLOc(INTERNAL_SIZE_T nb, mstate av)
   }
 
   /* catch all failure paths */
-  MALLOC_FAILURE_ACTION;
+  __set_errno (ENOMEM);
   return 0;
 }
 
@@ -3247,7 +3232,7 @@ public_cALLOc(size_t n, size_t elem_size)
   (((INTERNAL_SIZE_T) 1) << (8 * sizeof (INTERNAL_SIZE_T) / 2))
   if (__builtin_expect ((n | elem_size) >= HALF_INTERNAL_SIZE_T, 0)) {
     if (elem_size != 0 && bytes / elem_size != n) {
-      MALLOC_FAILURE_ACTION;
+      __set_errno (ENOMEM);
       return 0;
     }
   }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    3 +++
 malloc/hooks.c  |    8 ++++----
 malloc/malloc.c |   23 ++++-------------------
 3 files changed, 11 insertions(+), 23 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]