doc: pipes: Fix the pipe read example.

Replaces sizeof(header) which is equal to the size of the pointer,
by sizeof (*header), which is equal to the size of struct message_header.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
This commit is contained in:
Andrej Butok 2023-10-24 11:44:56 +02:00 committed by Chris Friedt
commit 3fab7624eb

View file

@ -150,12 +150,12 @@ process data items generated by one or more producing threads.
while (1) {
rc = k_pipe_get(&my_pipe, buffer, sizeof(buffer), &bytes_read,
sizeof(header), K_MSEC(100));
sizeof(*header), K_MSEC(100));
if ((rc < 0) || (bytes_read < sizeof (header))) {
if ((rc < 0) || (bytes_read < sizeof (*header))) {
/* Incomplete message header received */
...
} else if (header->num_data_bytes + sizeof(header) > bytes_read) {
} else if (header->num_data_bytes + sizeof(*header) > bytes_read) {
/* Only some data was received */
...
} else {