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.18-565-ge8349ef


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  e8349efd466cfedc0aa98be61d88ca8795c9e565 (commit)
      from  f3eeb3fc560ccc4ce51dc605e4703c5016b07244 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e8349efd466cfedc0aa98be61d88ca8795c9e565

commit e8349efd466cfedc0aa98be61d88ca8795c9e565
Author: OndÅ?ej Bílka <neleai@seznam.cz>
Date:   Mon Dec 9 17:25:19 2013 +0100

    Simplify perturb_byte logic.

diff --git a/ChangeLog b/ChangeLog
index e04ee34..bbd241c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2013-12-09  OndÅ?ej Bílka  <neleai@seznam.cz>
 
+	* malloc/malloc.c (alloc_perturb, free_perturb): Convert from
+	macro to a function.  Check for zero perturb_byte.
+	(_int_malloc, _int_free): Remove zero perturb_byte checks.
+
+2013-12-09  OndÅ?ej Bílka  <neleai@seznam.cz>
+
 	* malloc/malloc.c: (force_reg): Remove.
 	(__malloc_assert, __libc_malloc, __libc_free, __libc_realloc,
 	_mid_memalign, __libc_calloc, sysmalloc, systrim): Replace
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4821deb..ac8c3f6 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1870,8 +1870,20 @@ static int check_action = DEFAULT_CHECK_ACTION;
 
 static int perturb_byte;
 
-#define alloc_perturb(p, n) memset (p, (perturb_byte ^ 0xff) & 0xff, n)
-#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+static inline void
+alloc_perturb (char *p, size_t n)
+{
+  if (__glibc_unlikely (perturb_byte))
+    memset (p, perturb_byte ^ 0xff, n);
+}
+
+static inline void
+free_perturb (char *p, size_t n)
+{
+  if (__glibc_unlikely (perturb_byte))
+    memset (p, perturb_byte, n);
+}
+
 
 
 #include <stap-probe.h>
@@ -3287,8 +3299,7 @@ _int_malloc(mstate av, size_t bytes)
 	}
       check_remalloced_chunk(av, victim, nb);
       void *p = chunk2mem(victim);
-      if (__builtin_expect (perturb_byte, 0))
-	alloc_perturb (p, bytes);
+      alloc_perturb (p, bytes);
       return p;
     }
   }
@@ -3323,8 +3334,7 @@ _int_malloc(mstate av, size_t bytes)
 	  victim->size |= NON_MAIN_ARENA;
 	check_malloced_chunk(av, victim, nb);
 	void *p = chunk2mem(victim);
-	if (__builtin_expect (perturb_byte, 0))
-	  alloc_perturb (p, bytes);
+	alloc_perturb (p, bytes);
 	return p;
       }
     }
@@ -3403,8 +3413,7 @@ _int_malloc(mstate av, size_t bytes)
 
 	check_malloced_chunk(av, victim, nb);
 	void *p = chunk2mem(victim);
-	if (__builtin_expect (perturb_byte, 0))
-	  alloc_perturb (p, bytes);
+	alloc_perturb (p, bytes);
 	return p;
       }
 
@@ -3420,8 +3429,7 @@ _int_malloc(mstate av, size_t bytes)
 	  victim->size |= NON_MAIN_ARENA;
 	check_malloced_chunk(av, victim, nb);
 	void *p = chunk2mem(victim);
-	if (__builtin_expect (perturb_byte, 0))
-	  alloc_perturb (p, bytes);
+	alloc_perturb (p, bytes);
 	return p;
       }
 
@@ -3545,8 +3553,7 @@ _int_malloc(mstate av, size_t bytes)
 	}
 	check_malloced_chunk(av, victim, nb);
 	void *p = chunk2mem(victim);
-	if (__builtin_expect (perturb_byte, 0))
-	  alloc_perturb (p, bytes);
+	alloc_perturb (p, bytes);
 	return p;
       }
     }
@@ -3649,8 +3656,7 @@ _int_malloc(mstate av, size_t bytes)
 	}
 	check_malloced_chunk(av, victim, nb);
 	void *p = chunk2mem(victim);
-	if (__builtin_expect (perturb_byte, 0))
-	  alloc_perturb (p, bytes);
+	alloc_perturb (p, bytes);
 	return p;
       }
     }
@@ -3684,8 +3690,7 @@ _int_malloc(mstate av, size_t bytes)
 
       check_malloced_chunk(av, victim, nb);
       void *p = chunk2mem(victim);
-      if (__builtin_expect (perturb_byte, 0))
-	alloc_perturb (p, bytes);
+      alloc_perturb (p, bytes);
       return p;
     }
 
@@ -3705,7 +3710,7 @@ _int_malloc(mstate av, size_t bytes)
     */
     else {
       void *p = sysmalloc(nb, av);
-      if (p != NULL && __builtin_expect (perturb_byte, 0))
+      if (p != NULL)
 	alloc_perturb (p, bytes);
       return p;
     }
@@ -3798,8 +3803,7 @@ _int_free(mstate av, mchunkptr p, int have_lock)
 	  }
       }
 
-    if (__builtin_expect (perturb_byte, 0))
-      free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
+    free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
 
     set_fastchunks(av);
     unsigned int idx = fastbin_index(size);
@@ -3881,8 +3885,7 @@ _int_free(mstate av, mchunkptr p, int have_lock)
 	goto errout;
       }
 
-    if (__builtin_expect (perturb_byte, 0))
-      free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
+    free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
 
     /* consolidate backward */
     if (!prev_inuse(p)) {

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

Summary of changes:
 ChangeLog       |    6 ++++++
 malloc/malloc.c |   45 ++++++++++++++++++++++++---------------------
 2 files changed, 30 insertions(+), 21 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]