diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-10-13 22:02:55 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-10-13 22:02:55 -0700 |
| commit | 8fcf6433c2275505e6f12727e3cb209561042c5d (patch) | |
| tree | 70387242e55d83d208fef9eb260772521bfc48aa /docs/ref | |
| parent | 1f10707dd49b70d316be320cc798d98d0d7e46f6 (diff) | |
| download | nng-8fcf6433c2275505e6f12727e3cb209561042c5d.tar.gz nng-8fcf6433c2275505e6f12727e3cb209561042c5d.tar.bz2 nng-8fcf6433c2275505e6f12727e3cb209561042c5d.zip | |
docs: Fix prototype and description for nng_msg_realloc.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/api/msg/nng_msg.md | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/docs/ref/api/msg/nng_msg.md b/docs/ref/api/msg/nng_msg.md index 8d8b8686..3ab4d046 100644 --- a/docs/ref/api/msg/nng_msg.md +++ b/docs/ref/api/msg/nng_msg.md @@ -14,7 +14,7 @@ typedef struct nng_msg nng_msg; int nng_msg_alloc(nng_msg **msgp, size_t size); void nng_msg_free(nng_msg *msg); int nng_msg_dup(nng_msg **dup, nng_msg *msg); -int nng_msg_realloc(nng_msg **msgp, size_t size); +int nng_msg_realloc(nng_msg *msg, size_t size); int nng_msg_reserve(nng_msg *msg, size_t capacity); size_t nng_msg_capacity(nng_msg *msg); ``` @@ -57,11 +57,10 @@ space may be different as well. ### Message Size and Capacity The message size may be changed by use of the {{i:`nng_msg_realloc`}} function. This -function will reallocate the underlying memory for the message referenced by _msgp_, -preserving contents, to provide the new buffer, and return the new message in _msgp_. +function will reallocate the underlying memory for the message _msg_, +preserving contents while doing so. If the new size is smaller than the original message, it will truncate the message, but not perform any allocations. -If the new message is different, then the original is freed. If reallocation fails due to insufficient memory, then the original is left intact. If message growth is anticipated, the {{i:`nng_msg_reserve`}} function can be used |
