aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-11-30 15:08:09 +0100
committerGitHub <[email protected]>2017-11-30 15:08:09 +0100
commitec4c31031cce6db591d16f9da52c2a6cc4b90ad3 (patch)
treea663217faceb30cf6681398a1b94cd8cb83d27c9
parent35266110ade3b34b879327e5bc4bbd2d367e305a (diff)
parent15aaf359c770d302bef57482c13341646ef275cd (diff)
downloadotp-ec4c31031cce6db591d16f9da52c2a6cc4b90ad3.tar.gz
otp-ec4c31031cce6db591d16f9da52c2a6cc4b90ad3.tar.bz2
otp-ec4c31031cce6db591d16f9da52c2a6cc4b90ad3.zip
Merge PR-1636 from nox/enif-realloc
Document enif_realloc and pointer alignment guarantees
-rw-r--r--erts/doc/src/erl_nif.xml16
1 files changed, 16 insertions, 0 deletions
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml
index 419e41693e..ef3cdb89e9 100644
--- a/erts/doc/src/erl_nif.xml
+++ b/erts/doc/src/erl_nif.xml
@@ -952,6 +952,8 @@ typedef struct {
<desc>
<p>Allocates memory of <c>size</c> bytes.</p>
<p>Returns <c>NULL</c> if the allocation fails.</p>
+ <p>The returned pointer is suitably aligned for any built-in type that
+ fit in the allocated memory.</p>
</desc>
</func>
@@ -2760,6 +2762,20 @@ enif_map_iterator_destroy(env, &amp;iter);</code>
</func>
<func>
+ <name><ret>void *</ret>
+ <nametext>enif_realloc(void* ptr, size_t size)</nametext></name>
+ <fsummary>Reallocate dynamic memory.</fsummary>
+ <desc>
+ <p>Reallocates memory allocated by
+ <seealso marker="#enif_alloc"><c>enif_alloc</c></seealso> to
+ <c>size</c> bytes.</p>
+ <p>Returns <c>NULL</c> if the reallocation fails.</p>
+ <p>The returned pointer is suitably aligned for any built-in type that
+ fit in the allocated memory.</p>
+ </desc>
+ </func>
+
+ <func>
<name><ret>int</ret>
<nametext>enif_realloc_binary(ErlNifBinary* bin, size_t size)</nametext>
</name>