You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
}
The text was updated successfully, but these errors were encountered:
Good point! I would prefer to implement general-purpose double-linked list and use it everywhere in libstrophe. This will solve the issue. Additionally to performance improvement, this will reduce copy-paste and hide all complexity in a single module.
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;
}
The text was updated successfully, but these errors were encountered: