aboutsummaryrefslogtreecommitdiffstats
path: root/util/xmppstream.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-26 05:23:37 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-26 05:23:37 +0500
commit539b221189ad1bd611fd4e3d72bda98f8881f632 (patch)
treea5e7725ac2f2792d43f0b7eaf49ee7a8704ac020 /util/xmppstream.lua
parentf55acdb2a9747045b39d3690f52a892d6440cc27 (diff)
downloadprosody-539b221189ad1bd611fd4e3d72bda98f8881f632.tar.gz
prosody-539b221189ad1bd611fd4e3d72bda98f8881f632.zip
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.
Diffstat (limited to 'util/xmppstream.lua')
-rw-r--r--util/xmppstream.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua
index 0a6d554b..29095e41 100644
--- a/util/xmppstream.lua
+++ b/util/xmppstream.lua
@@ -117,7 +117,8 @@ function new_sax_handlers(session, stream_callbacks)
chardata = {};
end
-- Complete stanza
- if #stanza.last_add == 0 then
+ local last_add = stanza.last_add;
+ if not last_add or #last_add == 0 then
if tagname ~= stream_error_tag then
cb_handlestanza(session, stanza);
else