diff options
Diffstat (limited to 'src/gmalloc.c')
| -rw-r--r-- | src/gmalloc.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/gmalloc.c b/src/gmalloc.c index 8450a639e77..3560c744539 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -38,8 +38,6 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>. | |||
| 38 | 38 | ||
| 39 | #include "lisp.h" | 39 | #include "lisp.h" |
| 40 | 40 | ||
| 41 | #include "ptr-bounds.h" | ||
| 42 | |||
| 43 | #ifdef HAVE_MALLOC_H | 41 | #ifdef HAVE_MALLOC_H |
| 44 | # if GNUC_PREREQ (4, 2, 0) | 42 | # if GNUC_PREREQ (4, 2, 0) |
| 45 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 43 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| @@ -200,8 +198,7 @@ extern size_t _bytes_free; | |||
| 200 | 198 | ||
| 201 | /* Internal versions of `malloc', `realloc', and `free' | 199 | /* Internal versions of `malloc', `realloc', and `free' |
| 202 | used when these functions need to call each other. | 200 | used when these functions need to call each other. |
| 203 | They are the same but don't call the hooks | 201 | They are the same but don't call the hooks. */ |
| 204 | and don't bound the resulting pointers. */ | ||
| 205 | extern void *_malloc_internal (size_t); | 202 | extern void *_malloc_internal (size_t); |
| 206 | extern void *_realloc_internal (void *, size_t); | 203 | extern void *_realloc_internal (void *, size_t); |
| 207 | extern void _free_internal (void *); | 204 | extern void _free_internal (void *); |
| @@ -551,7 +548,7 @@ malloc_initialize_1 (void) | |||
| 551 | _heapinfo[0].free.size = 0; | 548 | _heapinfo[0].free.size = 0; |
| 552 | _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; | 549 | _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; |
| 553 | _heapindex = 0; | 550 | _heapindex = 0; |
| 554 | _heapbase = (char *) ptr_bounds_init (_heapinfo); | 551 | _heapbase = (char *) _heapinfo; |
| 555 | _heaplimit = BLOCK (_heapbase + heapsize * sizeof (malloc_info)); | 552 | _heaplimit = BLOCK (_heapbase + heapsize * sizeof (malloc_info)); |
| 556 | 553 | ||
| 557 | register_heapinfo (); | 554 | register_heapinfo (); |
| @@ -912,8 +909,7 @@ malloc (size_t size) | |||
| 912 | among multiple threads. We just leave it for compatibility with | 909 | among multiple threads. We just leave it for compatibility with |
| 913 | glibc malloc (i.e., assignments to gmalloc_hook) for now. */ | 910 | glibc malloc (i.e., assignments to gmalloc_hook) for now. */ |
| 914 | hook = gmalloc_hook; | 911 | hook = gmalloc_hook; |
| 915 | void *result = (hook ? hook : _malloc_internal) (size); | 912 | return (hook ? hook : _malloc_internal) (size); |
| 916 | return ptr_bounds_clip (result, size); | ||
| 917 | } | 913 | } |
| 918 | 914 | ||
| 919 | #if !(defined (_LIBC) || defined (HYBRID_MALLOC)) | 915 | #if !(defined (_LIBC) || defined (HYBRID_MALLOC)) |
| @@ -991,7 +987,6 @@ _free_internal_nolock (void *ptr) | |||
| 991 | 987 | ||
| 992 | if (ptr == NULL) | 988 | if (ptr == NULL) |
| 993 | return; | 989 | return; |
| 994 | ptr = ptr_bounds_init (ptr); | ||
| 995 | 990 | ||
| 996 | PROTECT_MALLOC_STATE (0); | 991 | PROTECT_MALLOC_STATE (0); |
| 997 | 992 | ||
| @@ -1303,7 +1298,6 @@ _realloc_internal_nolock (void *ptr, size_t size) | |||
| 1303 | else if (ptr == NULL) | 1298 | else if (ptr == NULL) |
| 1304 | return _malloc_internal_nolock (size); | 1299 | return _malloc_internal_nolock (size); |
| 1305 | 1300 | ||
| 1306 | ptr = ptr_bounds_init (ptr); | ||
| 1307 | block = BLOCK (ptr); | 1301 | block = BLOCK (ptr); |
| 1308 | 1302 | ||
| 1309 | PROTECT_MALLOC_STATE (0); | 1303 | PROTECT_MALLOC_STATE (0); |
| @@ -1426,8 +1420,7 @@ realloc (void *ptr, size_t size) | |||
| 1426 | return NULL; | 1420 | return NULL; |
| 1427 | 1421 | ||
| 1428 | hook = grealloc_hook; | 1422 | hook = grealloc_hook; |
| 1429 | void *result = (hook ? hook : _realloc_internal) (ptr, size); | 1423 | return (hook ? hook : _realloc_internal) (ptr, size); |
| 1430 | return ptr_bounds_clip (result, size); | ||
| 1431 | } | 1424 | } |
| 1432 | /* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. | 1425 | /* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. |
| 1433 | 1426 | ||
| @@ -1601,7 +1594,6 @@ aligned_alloc (size_t alignment, size_t size) | |||
| 1601 | { | 1594 | { |
| 1602 | l->exact = result; | 1595 | l->exact = result; |
| 1603 | result = l->aligned = (char *) result + adj; | 1596 | result = l->aligned = (char *) result + adj; |
| 1604 | result = ptr_bounds_clip (result, size); | ||
| 1605 | } | 1597 | } |
| 1606 | UNLOCK_ALIGNED_BLOCKS (); | 1598 | UNLOCK_ALIGNED_BLOCKS (); |
| 1607 | if (l == NULL) | 1599 | if (l == NULL) |