Revert "Backing this one out since the counterpart needs to be sent upstream."

This reverts commit a04d2bc28e7d7fcaf34ad71e4a6608a13cf84197.

Change-Id: I1b49165ca5d4bafdba7948818256a6167a363aca
diff --git a/libc/bionic/malloc_debug_common.cpp b/libc/bionic/malloc_debug_common.cpp
index 6677c22..cbca160 100644
--- a/libc/bionic/malloc_debug_common.cpp
+++ b/libc/bionic/malloc_debug_common.cpp
@@ -61,9 +61,13 @@
   Malloc(malloc_usable_size),
   Malloc(memalign),
   Malloc(posix_memalign),
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   Malloc(pvalloc),
+#endif
   Malloc(realloc),
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   Malloc(valloc),
+#endif
 };
 
 // Selector of dispatch table to use for dispatching malloc calls.
@@ -258,17 +262,21 @@
   return __libc_malloc_dispatch->posix_memalign(memptr, alignment, size);
 }
 
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
 extern "C" void* pvalloc(size_t bytes) {
   return __libc_malloc_dispatch->pvalloc(bytes);
 }
+#endif
 
 extern "C" void* realloc(void* oldMem, size_t bytes) {
   return __libc_malloc_dispatch->realloc(oldMem, bytes);
 }
 
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
 extern "C" void* valloc(size_t bytes) {
   return __libc_malloc_dispatch->valloc(bytes);
 }
+#endif
 
 // We implement malloc debugging only in libc.so, so the code below
 // must be excluded if we compile this file for static libc.a
@@ -299,9 +307,13 @@
   InitMallocFunction<MallocDebugMallocUsableSize>(malloc_impl_handler, &table->malloc_usable_size, prefix, "malloc_usable_size");
   InitMallocFunction<MallocDebugMemalign>(malloc_impl_handler, &table->memalign, prefix, "memalign");
   InitMallocFunction<MallocDebugPosixMemalign>(malloc_impl_handler, &table->posix_memalign, prefix, "posix_memalign");
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   InitMallocFunction<MallocDebugPvalloc>(malloc_impl_handler, &table->pvalloc, prefix, "pvalloc");
+#endif
   InitMallocFunction<MallocDebugRealloc>(malloc_impl_handler, &table->realloc, prefix, "realloc");
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
   InitMallocFunction<MallocDebugValloc>(malloc_impl_handler, &table->valloc, prefix, "valloc");
+#endif
 }
 
 // Initializes memory allocation framework once per process.
@@ -447,9 +459,14 @@
       (malloc_dispatch_table.malloc_usable_size == NULL) ||
       (malloc_dispatch_table.memalign == NULL) ||
       (malloc_dispatch_table.posix_memalign == NULL) ||
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
       (malloc_dispatch_table.pvalloc == NULL) ||
-      (malloc_dispatch_table.realloc == NULL) ||
-      (malloc_dispatch_table.valloc == NULL)) {
+#endif
+      (malloc_dispatch_table.realloc == NULL)
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
+      || (malloc_dispatch_table.valloc == NULL)
+#endif
+      ) {
     error_log("%s: some symbols for libc.debug.malloc level %d were not found (see above)",
               getprogname(), g_malloc_debug_level);
     dlclose(malloc_impl_handle);