summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-04-14 08:26:49 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-04-17 12:05:53 +0300
commit4818b2458cdf950ee3cef5458b3d6d6774237da6 (patch)
tree7ac2d6a69762f6a90331b43ea4bf1444d6299e95 /include
parent9c3f1dd6ee81e5fcb1a1838f1235bdc3e6f1e641 (diff)
downloadbdwgc-4818b2458cdf950ee3cef5458b3d6d6774237da6.tar.gz
Allow align argument of GC_memalign to be smaller than pointer size
(fix of commit ba137368d) This is largely to match the standard requirements on aligned_alloc(). * include/gc/gc.h (GC_memalign): Update comment. * mallocx.c (GC_memalign): Allow align to be less than a pointer size (provided it is non-zero). * mallocx.c (GC_memalign, GC_posix_memalign): Do not expect align argument is invalid.
Diffstat (limited to 'include')
-rw-r--r--include/gc/gc.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/gc/gc.h b/include/gc/gc.h
index a59f7062..3f0d0cc0 100644
--- a/include/gc/gc.h
+++ b/include/gc/gc.h
@@ -582,9 +582,10 @@ GC_API GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1) void * GC_CALL
GC_API GC_ATTR_DEPRECATED void * GC_CALL GC_malloc_stubborn(size_t);
/* The routines that guarantee the requested alignment of the allocated */
-/* memory object. The align argument should be a power of two and not */
-/* less than size of a pointer. Note: GC_base() and GC_size() might */
-/* return the value which is not the expected one due to the alignment. */
+/* memory object. The align argument should be non-zero and a power */
+/* of two; GC_posix_memalign() also requires it to be not less than */
+/* size of a pointer. Note: GC_base() and GC_size() might return the */
+/* values which are not the expected ones due to the alignment. */
GC_API GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(2) void * GC_CALL
GC_memalign(size_t /* align */, size_t /* lb */);
GC_API int GC_CALL GC_posix_memalign(void ** /* memptr */, size_t /* align */,
@@ -1488,7 +1489,8 @@ typedef void (GC_CALLBACK * GC_abort_func)(const char * /* msg */);
GC_API void GC_CALL GC_set_abort_func(GC_abort_func) GC_ATTR_NONNULL(1);
GC_API GC_abort_func GC_CALL GC_get_abort_func(void);
-/* A portable way to abort the application because of not enough memory.*/
+/* A portable way to abort the application because of not enough */
+/* memory. */
GC_API void GC_CALL GC_abort_on_oom(void);
/* The following is intended to be used by a higher level */