Commit 6cfa1a00 authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI

Add API to debug the message creation/destroy in sofia.

parent 436b7e97
......@@ -49,6 +49,15 @@
#include "sofia-sip/msg_mclass.h"
static MsgCreateCb msg_create_cb = NULL;
static MsgCreateCb msg_destroy_cb = NULL;
void msg_set_callbacks( MsgCreateCb create_cb, MsgDestroyCb destroy_cb) {
msg_create_cb = create_cb;
msg_destroy_cb = destroy_cb;
}
/** Increment the reference count.
*
* @relatesalso msg_s
......@@ -86,7 +95,10 @@ static void msg_destructor(void *_msg)
*/
void msg_unref(msg_t *msg)
{
su_home_unref(msg->m_home);
if( su_home_unref(msg->m_home) ){
if( msg_destroy_cb != NULL )
msg_destroy_cb(msg);
}
}
/**
......@@ -129,6 +141,10 @@ msg_t *msg_create(msg_mclass_t const *mc, int flags)
msg->m_object->msg_common->h_class = (void *)mc;
}
if( msg_create_cb ){
msg_create_cb(msg);
}
return msg;
}
......
......@@ -39,6 +39,12 @@
SOFIA_BEGIN_DECLS
typedef void (*MsgCreateCb)(msg_t* msg);
typedef void (*MsgDestroyCb)(msg_t* msg);
SOFIAPUBFUN void msg_set_callbacks( MsgCreateCb create_cb, MsgDestroyCb destroy_cb);
SOFIAPUBFUN msg_t *msg_create(msg_mclass_t const *mc, int flags);
SOFIAPUBFUN msg_t *msg_ref(msg_t *);
......
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