From d1c39edc9b15cf45b5ea577747197d9188417deb Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 4 Jan 2022 10:14:41 -0500 Subject: [PATCH] use const for malloc_object_size API --- h_malloc.c | 4 ++-- include/h_malloc.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/h_malloc.c b/h_malloc.c index 6f848f7..0aaae9a 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -1642,7 +1642,7 @@ EXPORT size_t h_malloc_usable_size(H_MALLOC_USABLE_SIZE_CONST void *p) { return size; } -EXPORT size_t h_malloc_object_size(void *p) { +EXPORT size_t h_malloc_object_size(const void *p) { if (p == NULL) { return 0; } @@ -1699,7 +1699,7 @@ EXPORT size_t h_malloc_object_size(void *p) { return size; } -EXPORT size_t h_malloc_object_size_fast(void *p) { +EXPORT size_t h_malloc_object_size_fast(const void *p) { if (p == NULL) { return 0; } diff --git a/include/h_malloc.h b/include/h_malloc.h index fdc7083..5824abb 100644 --- a/include/h_malloc.h +++ b/include/h_malloc.h @@ -104,10 +104,10 @@ void h_malloc_enable(void); // hardened_malloc extensions // return an upper bound on object size for any pointer based on malloc metadata -size_t h_malloc_object_size(void *ptr); +size_t h_malloc_object_size(const void *ptr); // similar to malloc_object_size, but avoiding locking so the results are much more limited -size_t h_malloc_object_size_fast(void *ptr); +size_t h_malloc_object_size_fast(const void *ptr); // The free function with an extra parameter for passing the size requested at // allocation time.