aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-18 04:28:03 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-18 04:28:03 +0200
commit8aee94558b01383867b3d9f93a19ba47e51c063d (patch)
treee7201aaaf40e2c97986d5f2eb517ea2dfe959656 /include
parentinfo: malloc aligns pointers (diff)
downloadslibc-8aee94558b01383867b3d9f93a19ba47e51c063d.tar.gz
slibc-8aee94558b01383867b3d9f93a19ba47e51c063d.tar.bz2
slibc-8aee94558b01383867b3d9f93a19ba47e51c063d.tar.xz
the pointer returned by malloc is aligned
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--include/malloc.h6
-rw-r--r--include/stddef.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/include/malloc.h b/include/malloc.h
index 28f937c..66adcbd 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -37,6 +37,8 @@
/**
* Create a new memory allocation on the heap.
* The allocation will not be initialised.
+ * The returned pointer has an alignment usable
+ * for any compiler-independent intrinsic data type.
*
* @param size The size of the allocation.
* @return Pointer to the beginning of the new allocation.
@@ -99,7 +101,9 @@ void* zalloc(size_t)
/**
* Variant of `malloc` that extends, or shrinks, an existing allocation,
* if beneficial and possible, or creates a new allocation with the new
- * size, copies the data, and frees the old allocation.
+ * size, copies the data, and frees the old allocation. The returned
+ * pointer has an alignment usable for any compiler-independent intrinsic
+ * data type, if a new pointer is returned.
*
* On error, `ptr` is not freed.
*
diff --git a/include/stddef.h b/include/stddef.h
index e33cfed..50e9ba1 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -82,7 +82,7 @@
#define __NEED_ptrdiff_t
#define __NEED_wchar_t
#define __NEED_size_t
-#if defined(__C11__)
+#if defined(__C11__) || defined(__BUILDING_SLIBC)
# define __NEED_max_align_t
#endif