Diff

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
line wrap: on
line diff
--- a/util/xmppstream.lua	Thu Nov 25 08:38:26 2010 +0500
+++ b/util/xmppstream.lua	Fri Nov 26 05:23:37 2010 +0500
@@ -117,7 +117,8 @@
 				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