Comparison

util/xmppstream.lua @ 3638:6f58a3063c14

util.stanza, util.xmppstream, core.xmlhandlers: Allow stanza.last_add to be nil, and set it nil by default. Saves a table allocation per-element. 20% faster stanza building.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 26 Nov 2010 05:23:37 +0500
parent 3633:4069c37c54bc
child 3696:a96f275c42b5
comparison
equal deleted inserted replaced
3637:bd491def3efb 3638:6f58a3063c14
115 -- We have some character data in the buffer 115 -- We have some character data in the buffer
116 stanza:text(t_concat(chardata)); 116 stanza:text(t_concat(chardata));
117 chardata = {}; 117 chardata = {};
118 end 118 end
119 -- Complete stanza 119 -- Complete stanza
120 if #stanza.last_add == 0 then 120 local last_add = stanza.last_add;
121 if not last_add or #last_add == 0 then
121 if tagname ~= stream_error_tag then 122 if tagname ~= stream_error_tag then
122 cb_handlestanza(session, stanza); 123 cb_handlestanza(session, stanza);
123 else 124 else
124 cb_error(session, "stream-error", stanza); 125 cb_error(session, "stream-error", stanza);
125 end 126 end