summaryrefslogtreecommitdiff
path: root/doc/libstddjb/alloc.html
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-04-29 23:24:30 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-04-29 23:24:30 +0000
commit8c16e68dda72032e81a624360b1abb1006e33481 (patch)
treed271162cd45dadb85832aa2560190e90859a39af /doc/libstddjb/alloc.html
parent038082c425c40037a28111934dfb5037edbcad8c (diff)
downloadskalibs-8c16e68dda72032e81a624360b1abb1006e33481.tar.xz
Correct alloc.h documentation
Diffstat (limited to 'doc/libstddjb/alloc.html')
-rw-r--r--doc/libstddjb/alloc.html11
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/libstddjb/alloc.html b/doc/libstddjb/alloc.html
index 87b1751..ca6ecf1 100644
--- a/doc/libstddjb/alloc.html
+++ b/doc/libstddjb/alloc.html
@@ -65,11 +65,10 @@ should favor them over basic interfaces like <tt>malloc()</tt>.
<h2> Functions </h2>
<p>
-<code> char *alloc (size_t len) </code> <br />
+<code> void *alloc (size_t len) </code> <br />
Allocates a block of <em>len</em> bytes in the heap and returns a pointer
-to the start of the block (or NULL if it failed). Though the pointer type
-is <tt>char *</tt>, the block of memory is correctly aligned for any type
-of object. If <em>len</em> is 0, the function returns a pointer that
+to the start of the block (or NULL if it failed).
+If <em>len</em> is 0, the function returns a unique pointer that
cannot be written to, but that is <em>not null</em>. Note that this is
different from the required C99 behaviour for <tt>malloc()</tt>.
</p>
@@ -85,7 +84,9 @@ Redimension the block of heap memory pointed to by *<em>p</em> to
<em>newlen</em> bytes. The block may have to be moved, in which case
*<em>p</em> will be modified. Normally returns 1; if an error occurred,
returns 0 and sets errno, and neither *<em>p</em> nor its contents are
-modified.
+modified. Note that <em>p</em> must be a pointer to a <tt>char *</tt>,
+because polymorphism isn't possible here (for reasons that have to do
+with pointer representation in C).
</p>
<p>