[haiku-commits] haiku: hrev49286 - src/system/libroot/posix/malloc headers/posix

  • From: jerome.duval@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 13 Jun 2015 14:29:45 +0200 (CEST)

hrev49286 adds 1 changeset to branch 'master'
old head: 673259506bcab276c7ce84e3ba3ac03f2d210cf1
new head: 0dc6b011fe585d2fb97087103543022e1fd750b8
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=0dc6b011fe58+%5E673259506bca

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

0dc6b011fe58: malloc: implement malloc_usable_size().

* Fix #12132

[ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

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

Revision: hrev49286
Commit: 0dc6b011fe585d2fb97087103543022e1fd750b8
URL: http://cgit.haiku-os.org/haiku/commit/?id=0dc6b011fe58
Author: Jérôme Duval <jerome.duval@xxxxxxxxx>
Date: Sat Jun 13 12:25:35 2015 UTC

Ticket: https://dev.haiku-os.org/ticket/12132

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

2 files changed, 13 insertions(+)
headers/posix/malloc.h | 4 ++++
src/system/libroot/posix/malloc/wrapper.cpp | 9 +++++++++

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

diff --git a/headers/posix/malloc.h b/headers/posix/malloc.h
index b36b17d..7754038 100644
--- a/headers/posix/malloc.h
+++ b/headers/posix/malloc.h
@@ -20,6 +20,10 @@ extern void free(void *pointer);
extern void *memalign(size_t alignment, size_t numBytes);
extern void *valloc(size_t numBytes);

+#ifdef _GNU_SOURCE
+size_t malloc_usable_size(void *ptr);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/src/system/libroot/posix/malloc/wrapper.cpp
b/src/system/libroot/posix/malloc/wrapper.cpp
index 5b5e066..c83336a 100644
--- a/src/system/libroot/posix/malloc/wrapper.cpp
+++ b/src/system/libroot/posix/malloc/wrapper.cpp
@@ -490,6 +490,15 @@ realloc(void *ptr, size_t size)
}


+extern "C" size_t
+malloc_usable_size(void *ptr)
+{
+ if (ptr == NULL)
+ return 0;
+ return threadHeap::objectSize(ptr);
+}
+
+
// #pragma mark - BeOS specific extensions




Other related posts:

  • » [haiku-commits] haiku: hrev49286 - src/system/libroot/posix/malloc headers/posix - jerome . duval