diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-03-27 07:53:26 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-03-27 07:53:26 -0700 |
| commit | c5afb3b3c70c026e8f72674ff6973581055658e7 (patch) | |
| tree | 832847f04613c819352b86042b769694afa6aa0d /docs/reference/src/api/msg | |
| parent | 488c2c2b9a03950ef366ce50c2d29a6ffe3445a1 (diff) | |
| download | nng-c5afb3b3c70c026e8f72674ff6973581055658e7.tar.gz nng-c5afb3b3c70c026e8f72674ff6973581055658e7.tar.bz2 nng-c5afb3b3c70c026e8f72674ff6973581055658e7.zip | |
Add nng_mtx_* functions.
Diffstat (limited to 'docs/reference/src/api/msg')
| -rw-r--r-- | docs/reference/src/api/msg/index.md | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/docs/reference/src/api/msg/index.md b/docs/reference/src/api/msg/index.md index 1a7bdabf..54d8d9b8 100644 --- a/docs/reference/src/api/msg/index.md +++ b/docs/reference/src/api/msg/index.md @@ -48,25 +48,26 @@ that would affect the binary representation of the `nng_msg` itself. ### Example 1: Preparing a message for use ```c -#include <nng/nng.h> -nng_msg *m; -if (nng_msg_alloc(&m, strlen("content") + 1) != 0) { - // handle error -} -strcpy(nng_msg_body(m), "content"); + #include <nng/nng.h> + + nng_msg *m; + if (nng_msg_alloc(&m, strlen("content") + 1) != 0) { + // handle error + } + strcpy(nng_msg_body(m), "content"); ``` ### Example 2: Preallocating message content ```c -if (nng_msg_alloc(&m, 1024) != 0) { - // handle error -} -while ((val64 = next_datum()) != 0) P - if (nng_msg_append_u64(m, val64) != 0) { + if (nng_msg_alloc(&m, 1024) != 0) { // handle error } -} + while ((val64 = next_datum()) != 0) P + if (nng_msg_append_u64(m, val64) != 0) { + // handle error + } + } ``` ## See Also |
