diff options
author | Ermal <eri@pfsense.org> | 2014-03-14 21:02:44 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-03-14 21:02:44 +0000 |
commit | 6d84c956e04dd281b8c22ad8784322e29e8aa703 (patch) | |
tree | 5e81f8859ac2708e5bc98254ac28f91c4323cc34 /etc/inc/xmlparse.inc | |
parent | ffd17097a7c559ce8737a55444f495ae940ec721 (diff) | |
download | pfsense-6d84c956e04dd281b8c22ad8784322e29e8aa703.zip pfsense-6d84c956e04dd281b8c22ad8784322e29e8aa703.tar.gz |
Make the parser more efficient to test for keys rather than searching inside the array
Diffstat (limited to 'etc/inc/xmlparse.inc')
-rw-r--r-- | etc/inc/xmlparse.inc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc index 1f35ffb..098ed21 100644 --- a/etc/inc/xmlparse.inc +++ b/etc/inc/xmlparse.inc @@ -57,7 +57,7 @@ function listtags() { 'timerange', 'tunnel', 'user', 'vip', 'virtual_server', 'vlan', 'winsserver', 'wolentry', 'widget' ); - return $ret; + return array_flip($ret); } /* Package XML tags that should be treat as a list not as a traditional array */ @@ -78,7 +78,7 @@ function startElement($parser, $name, $attrs) { } /* is it an element that belongs to a list? */ - if (in_array(strtolower($name), $listtags)) { + if (isset($listtags[strtolower($name)])) { /* is there an array already? */ if (!is_array($ptr)) { @@ -112,7 +112,7 @@ function endElement($parser, $name) { array_pop($curpath); - if (in_array(strtolower($name), $listtags)) + if (isset($listtags[strtolower($name)])) array_pop($curpath); $depth--; @@ -222,7 +222,7 @@ function dump_xml_config_sub($arr, $indent) { foreach ($arr as $ent => $val) { if (is_array($val)) { /* is it just a list of multiple values? */ - if (in_array(strtolower($ent), $listtags)) { + if (isset($listtags[strtolower($ent)])) { foreach ($val as $cval) { if (is_array($cval)) { if (empty($cval)) { |