When the size of stanza is big, the procedure time of get the tail node will be too long. Therefore, we can store then address of the tail node everytime we invoke xmpp_stanza_add_child. Next time we can get the tail node directly. Like this:
int xmpp_stanza_add_child(xmpp_stanza_t *stanza, xmpp_stanza_t *child)
{
xmpp_stanza_t *s;
/* get a reference to the child */
xmpp_stanza_clone(child);
child->parent = stanza;
if (!stanza->children)
stanza->children = child;
else {
**s = stanza->children_tail;**
s->next = child;
child->prev = s;
}
**stanza->children_tail = child;**
return XMPP_EOK;
}
libstrophe/src/stanza.c
Line 692 in 09229e2
When the size of stanza is big, the procedure time of get the tail node will be too long. Therefore, we can store then address of the tail node everytime we invoke xmpp_stanza_add_child. Next time we can get the tail node directly. Like this:
int xmpp_stanza_add_child(xmpp_stanza_t *stanza, xmpp_stanza_t *child)
{
xmpp_stanza_t *s;
}