From c5afb3b3c70c026e8f72674ff6973581055658e7 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 27 Mar 2024 07:53:26 -0700 Subject: Add nng_mtx_* functions. --- docs/reference/src/api/msg/index.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'docs/reference/src/api/msg') 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_msg *m; -if (nng_msg_alloc(&m, strlen("content") + 1) != 0) { - // handle error -} -strcpy(nng_msg_body(m), "content"); + #include + + 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 -- cgit v1.2.3-70-g09d2