From 1aee86408d575d6572b071d7564da7f006d1757e Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Tue, 9 Mar 2010 18:47:31 +0100 Subject: Documentation rewrite --- doc/zmq_msg_copy.txt | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'doc/zmq_msg_copy.txt') diff --git a/doc/zmq_msg_copy.txt b/doc/zmq_msg_copy.txt index b31897a..78337ea 100644 --- a/doc/zmq_msg_copy.txt +++ b/doc/zmq_msg_copy.txt @@ -4,30 +4,35 @@ zmq_msg_copy(3) NAME ---- -zmq_msg_copy - copies content of a message to another message +zmq_msg_copy - copy content of a message to another message SYNOPSIS -------- -'int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);' +*int zmq_msg_copy (zmq_msg_t '*dest', zmq_msg_t '*src');* DESCRIPTION ----------- -Copy the 'src' message to 'dest'. The original content of -'dest' is orderly deallocated. +The _zmq_msg_copy()_ function shall copy the message object referenced by 'src' +to the message object referenced by 'dest'. The original content of 'dest', if +any, shall be released. -CAUTION: The implementation may choose not to physically copy the data, rather -to share the buffer between two messages. Thus avoid modifying message data -after the message was copied. Doing so can modify multiple message instances. -If what you need is actual hard copy, allocate new message using -'zmq_msg_size' and copy the data using 'memcpy'. +CAUTION: The implementation may choose not to physically copy the message +content, rather to share the underlying buffer between 'src' and 'dest'. Avoid +modifying message content after a message has been copied with +_zmq_msg_copy()_, doing so can result in undefined behaviour. If what you need +is an actual hard copy, allocate a new message using _zmq_msg_init_size()_ and +copy the message content using _memcpy()_. + +CAUTION: Never access 'zmq_msg_t' members directly, instead always use the +_zmq_msg_ family of functions. RETURN VALUE ------------ -In case of success the function returns zero. Otherwise it returns -1 and -sets 'errno' to the appropriate value. +The _zmq_msg_copy()_ function shall return zero if successful. Otherwise it +shall return -1 and set 'errno' to one of the values defined below. ERRORS @@ -35,17 +40,6 @@ ERRORS No errors are defined. -EXAMPLE -------- ----- -zmq_msg_t dest; -rc = zmq_msg_init (&dest); -assert (rc == 0); -rc = zmq_msg_copy (&dest, &src); -assert (rc == 0); ----- - - SEE ALSO -------- linkzmq:zmq_msg_move[3] @@ -53,8 +47,10 @@ linkzmq:zmq_msg_init[3] linkzmq:zmq_msg_init_size[3] linkzmq:zmq_msg_init_data[3] linkzmq:zmq_msg_close[3] +linkzmq:zmq[7] -AUTHOR ------- -Martin Sustrik +AUTHORS +------- +The 0MQ documentation was written by Martin Sustrik and +Martin Lucina . -- cgit v1.2.3