summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2013-12-04 05:49:36 (GMT)
committerJason Evans <jasone@canonware.com>2013-12-04 05:49:36 (GMT)
commit66688535969c6dcb234448e590f27df38b4eebdf (patch)
treee5bddd438c82bbe65b069c0ffc67b9b07ea6acf1 /src
parent52b30691f9a98fe7c8c59d587eb6285a3bacaabc (diff)
downloadjemalloc-66688535969c6dcb234448e590f27df38b4eebdf.zip
jemalloc-66688535969c6dcb234448e590f27df38b4eebdf.tar.gz
jemalloc-66688535969c6dcb234448e590f27df38b4eebdf.tar.bz2
Avoid deprecated sbrk(2) on OS X.
Avoid referencing sbrk(2) on OS X, because it is deprecated as of OS X 10.9 (Mavericks), and the compiler warns against using it.
Diffstat (limited to 'src')
-rw-r--r--src/chunk_dss.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/chunk_dss.c b/src/chunk_dss.c
index 24781cc..510bb8b 100644
--- a/src/chunk_dss.c
+++ b/src/chunk_dss.c
@@ -28,16 +28,17 @@ static void *dss_max;
/******************************************************************************/
-#ifndef JEMALLOC_HAVE_SBRK
static void *
-sbrk(intptr_t increment)
+chunk_dss_sbrk(intptr_t increment)
{
+#ifdef JEMALLOC_HAVE_SBRK
+ return (sbrk(increment));
+#else
not_implemented();
-
return (NULL);
-}
#endif
+}
dss_prec_t
chunk_dss_prec_get(void)
@@ -93,7 +94,7 @@ chunk_alloc_dss(size_t size, size_t alignment, bool *zero)
*/
do {
/* Get the current end of the DSS. */
- dss_max = sbrk(0);
+ dss_max = chunk_dss_sbrk(0);
/*
* Calculate how much padding is necessary to
* chunk-align the end of the DSS.
@@ -117,7 +118,7 @@ chunk_alloc_dss(size_t size, size_t alignment, bool *zero)
return (NULL);
}
incr = gap_size + cpad_size + size;
- dss_prev = sbrk(incr);
+ dss_prev = chunk_dss_sbrk(incr);
if (dss_prev == dss_max) {
/* Success. */
dss_max = dss_next;
@@ -163,7 +164,7 @@ chunk_dss_boot(void)
if (malloc_mutex_init(&dss_mtx))
return (true);
- dss_base = sbrk(0);
+ dss_base = chunk_dss_sbrk(0);
dss_prev = dss_base;
dss_max = dss_base;