about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-10-13 16:28:21 +0000
committerUlrich Drepper <drepper@redhat.com>2006-10-13 16:28:21 +0000
commitff8d96be3075b59499046dc2c49c89a871f1cfd9 (patch)
tree906685b26cae69bb5d3d8cf6929e674ef6311080
parent90a0991a65186a68adc8caeec97da7678434040c (diff)
downloadglibc-ff8d96be3075b59499046dc2c49c89a871f1cfd9.tar.gz
glibc-ff8d96be3075b59499046dc2c49c89a871f1cfd9.tar.xz
glibc-ff8d96be3075b59499046dc2c49c89a871f1cfd9.zip
* elf/dl-minimal.c (realloc): Optimize last patch.
-rw-r--r--ChangeLog6
-rw-r--r--elf/dl-minimal.c7
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index ffb3296a26..adef0d8a99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,13 @@
+2006-10-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/dl-minimal.c (realloc): Optimize last patch.
+
 2006-10-12  Richard Sandiford  <richard@codesourcery.com>
 
 	[BZ #3352]
 	* elf/dl-minimal.c (realloc): Let malloc() return a new pointer,
 	and use memcpy() if it does.
-		
+
 2006-11-12  Andreas Jaeger  <aj@suse.de>
 
 	[BZ #2510]
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index 44b8c3718b..8e78709b5a 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -1,5 +1,6 @@
 /* Minimal replacements for basic facilities used in the dynamic linker.
-   Copyright (C) 1995-1998,2000-2002,2004,2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998,2000-2002,2004,2005,2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -134,9 +135,7 @@ realloc (void *ptr, size_t n)
   size_t old_size = alloc_ptr - alloc_last_block;
   alloc_ptr = alloc_last_block;
   void *new = malloc (n);
-  if (new != ptr)
-    memcpy (new, ptr, old_size);
-  return new;
+  return new != ptr ? memcpy (new, ptr, old_size) : new;
 }
 
 /* Avoid signal frobnication in setjmp/longjmp.  Keeps things smaller.  */