summaryrefslogtreecommitdiff
path: root/doc/zmq_msg_copy.txt
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2010-03-09 18:47:31 +0100
committerMartin Lucina <mato@kotelna.sk>2010-03-09 18:47:31 +0100
commit1aee86408d575d6572b071d7564da7f006d1757e (patch)
tree98d54989b5961db8c458017034bfb8f981e98c8f /doc/zmq_msg_copy.txt
parentd790940fd06060c8a2c624b0e41e470ad31ae0d8 (diff)
Documentation rewrite
Diffstat (limited to 'doc/zmq_msg_copy.txt')
-rw-r--r--doc/zmq_msg_copy.txt46
1 files changed, 21 insertions, 25 deletions
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 <sustrik at 250bpm dot com>
+AUTHORS
+-------
+The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
+Martin Lucina <mato@kotelna.sk>.