Commit 6cf78ac8 authored by Pekka Pessi's avatar Pekka Pessi

Removed msg_clone() from msg module.

Moved msg_set_parent() into msg/msg.c.

darcs-hash:20051107200400-65a35-9e7754d554ec2556f5b37632c176e555af6caf90.gz
parent 7fab5e8a
......@@ -111,6 +111,29 @@ msg_t *msg_ref_create(msg_t *msg)
return msg;
}
/**Set a message parent.
*
* @relates msg_s
*
* Set a parent for a message. The parent message is not destroyed until all
* its kids have been destroyed - each kid keeps a reference to its parent
* message.
*
* @param kid child message
* @param dad parent message
*/
void msg_set_parent(msg_t *kid, msg_t *dad)
{
if (kid) {
msg_t *step_dad = kid->m_parent;
if (dad && step_dad && step_dad != dad)
msg_ref_destroy(step_dad);
kid->m_parent = msg_ref_create(dad);
}
}
/** Destroy a reference to a message.
*
* @relates msg_s
......
......@@ -42,8 +42,6 @@
msg_t *msg_create(msg_mclass_t const *mc, int flags);
void msg_destroy(msg_t *);
void msg_clone(msg_t *clone, msg_t *parent);
msg_t *msg_copy(msg_t *);
msg_t *msg_dup(msg_t *);
......
......@@ -160,52 +160,6 @@ static inline int msg_is_status(msg_header_t const *h)
/* ====================================================================== */
/* Message buffer management */
/**Clone a message.
*
* @relates msg_s
*
* The cloned message inherits the message buffer from its parent. The
* parent message is not destroyed until all the clones have been destroyed.
*
* @param clone clone message
* @param parent parent message
*/
void msg_clone(msg_t *clone, msg_t *parent)
{
if (clone && parent) {
clone->m_parent = msg_ref_create(parent);
if (!parent->m_set_buffer && parent->m_buffer->mb_size) {
*clone->m_buffer = *parent->m_buffer;
memset(parent->m_buffer, 0, sizeof(parent->m_buffer));
}
}
}
/**Set a message parent.
*
* @relates msg_s
*
* Set a parent for a message. parent message is not destroyed until all the
* kids have been destroyed.
*
* @param kid child message
* @param dad parent message
*/
void msg_set_parent(msg_t *kid, msg_t *dad)
{
if (kid) {
msg_t *step_dad = kid->m_parent;
if (dad && step_dad && step_dad != dad)
msg_ref_destroy(step_dad);
kid->m_parent = msg_ref_create(dad);
}
}
/** Allocate a buffer of @a size octets, with slack of #msg_min_size. */
void *msg_buf_alloc(msg_t *msg, unsigned size)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment