about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-04-18 11:50:58 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-04-18 11:50:58 +0200
commit025b33ae84bb8f15b2748a1d8605dca453fce112 (patch)
tree2bb47e51512665a67018d8ed07e99b6401544a89
parent6c6ab1fc49d524ab1892cb20ee74352ace0b8034 (diff)
downloadglibc-025b33ae84bb8f15b2748a1d8605dca453fce112.tar.gz
glibc-025b33ae84bb8f15b2748a1d8605dca453fce112.tar.xz
glibc-025b33ae84bb8f15b2748a1d8605dca453fce112.zip
malloc: Turn cfree into a compatibility symbol
-rw-r--r--ChangeLog9
-rw-r--r--NEWS3
-rw-r--r--malloc/Versions2
-rw-r--r--malloc/malloc.c5
-rw-r--r--malloc/malloc.h3
-rw-r--r--manual/memory.texi9
-rw-r--r--stdlib/stdlib.h5
7 files changed, 17 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 13579e1a86..0a5e5691d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-04-18  Florian Weimer  <fweimer@redhat.com>
+
+	* malloc/malloc.c (cfree): Turn into compat symbol.
+	(__cfree): Remove alias.
+	* stdlib/stdlib.h (cfree): Remove declaration.
+	* malloc/malloc.h (cfree): Likewise.
+	* manual/memory.texi (Freeing after Malloc): Remove cfree.
+	* malloc/Versions (GLIBC_2.26): Add.
+
 2017-04-18  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/powerpc64/multiarch/Makefile
diff --git a/NEWS b/NEWS
index ace0e0d90f..811178bca6 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,9 @@ Version 2.26
 * res_mkquery and res_nmkquery no longer support the IQUERY opcode.  DNS
   servers have not supported this opcode for a long time.
 
+* The legacy cfree function has been removed.  Applications should use the
+  free function instead.
+
 Security related changes:
 
 * The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
diff --git a/malloc/Versions b/malloc/Versions
index f3c3d8a093..e34ab177be 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -61,6 +61,8 @@ libc {
   GLIBC_2.16 {
     aligned_alloc;
   }
+  GLIBC_2.26 {
+  }
   GLIBC_PRIVATE {
     # Internal startup hook for libpthread.
     __libc_malloc_pthread_startup;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4c40e2ea19..068ffc1684 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -84,7 +84,6 @@
     independent_calloc(size_t n_elements, size_t size, void* chunks[]);
     independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
     pvalloc(size_t n);
-    cfree(void* p);
     malloc_trim(size_t pad);
     malloc_usable_size(void* p);
     malloc_stats();
@@ -5290,7 +5289,6 @@ weak_alias (__malloc_info, malloc_info)
 
 
 strong_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc)
-strong_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree)
 strong_alias (__libc_free, __free) strong_alias (__libc_free, free)
 strong_alias (__libc_malloc, __malloc) strong_alias (__libc_malloc, malloc)
 strong_alias (__libc_memalign, __memalign)
@@ -5306,6 +5304,9 @@ weak_alias (__malloc_stats, malloc_stats)
 weak_alias (__malloc_usable_size, malloc_usable_size)
 weak_alias (__malloc_trim, malloc_trim)
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_26)
+compat_symbol (libc, __libc_free, cfree, GLIBC_2_0);
+#endif
 
 /* ------------------------------------------------------------
    History:
diff --git a/malloc/malloc.h b/malloc/malloc.h
index 0bd8f97bc3..274c0958e4 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -52,9 +52,6 @@ __THROW __attribute_warn_unused_result__;
 /* Free a block allocated by `malloc', `realloc' or `calloc'.  */
 extern void free (void *__ptr) __THROW;
 
-/* Free a block allocated by `calloc'. */
-extern void cfree (void *__ptr) __THROW;
-
 /* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
 extern void *memalign (size_t __alignment, size_t __size)
 __THROW __attribute_malloc__ __wur;
diff --git a/manual/memory.texi b/manual/memory.texi
index 38d3c3a4bb..a39cac805f 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -701,15 +701,6 @@ The @code{free} function deallocates the block of memory pointed at
 by @var{ptr}.
 @end deftypefun
 
-@comment stdlib.h
-@comment Sun
-@deftypefun void cfree (void *@var{ptr})
-@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
-@c alias to free
-This function does the same thing as @code{free}.  It's provided for
-backward compatibility with SunOS; you should use @code{free} instead.
-@end deftypefun
-
 Freeing a block alters the contents of the block.  @strong{Do not expect to
 find any data (such as a pointer to the next block in a chain of blocks) in
 the block after freeing it.}  Copy whatever you need out of the block before
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index c1f389253a..99125f2d23 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -425,11 +425,6 @@ extern void *realloc (void *__ptr, size_t __size)
 /* Free a block allocated by `malloc', `realloc' or `calloc'.  */
 extern void free (void *__ptr) __THROW;
 
-#ifdef	__USE_MISC
-/* Free a block.  An alias for `free'.	(Sun Unices).  */
-extern void cfree (void *__ptr) __THROW;
-#endif /* Use misc.  */
-
 #ifdef __USE_MISC
 # include <alloca.h>
 #endif /* Use misc.  */