summaryrefslogtreecommitdiff
path: root/src/lxml/proxy.pxi
diff options
context:
space:
mode:
authorPer Lejontand <per.lejontand@trustly.com>2015-12-15 09:05:52 +0100
committerPer Lejontand <per.lejontand@trustly.com>2015-12-15 09:05:52 +0100
commitd9ff0ab276b0e3baaf902c8ef05277a209a5f3c1 (patch)
treee5a7389de14a288810194a83cc9e2562141a2d56 /src/lxml/proxy.pxi
parent4af1d719108817a67d63d16c32e91126d5ba4c53 (diff)
downloadpython-lxml-d9ff0ab276b0e3baaf902c8ef05277a209a5f3c1.tar.gz
Use a more intuitive looping form.
Diffstat (limited to 'src/lxml/proxy.pxi')
-rw-r--r--src/lxml/proxy.pxi12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lxml/proxy.pxi b/src/lxml/proxy.pxi
index 9e95e1da..cb604eb3 100644
--- a/src/lxml/proxy.pxi
+++ b/src/lxml/proxy.pxi
@@ -233,7 +233,7 @@ cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node):
cdef int prefix_known
c_parent = c_from_node.parent
cdef _nscache c_ns_cache = [NULL, 0, 0]
- cdef size_t i
+ cdef _ns_update_map c_ns_entry
# Build up a cache for each of the ns prefixes used in the elements we will
# copy over, then use prescence in the cache as a basis for allowing the
@@ -242,9 +242,9 @@ cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node):
tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_from_node, c_node, 1)
if c_node.ns is not NULL:
c_ns = NULL
- for i in range(int(c_ns_cache.last)):
- if c_node.ns is c_ns_cache.ns_map[i].old:
- c_ns = c_ns_cache.ns_map[i].old
+ for c_ns_entry in c_ns_cache.ns_map[:c_ns_cache.last]:
+ if c_node.ns is c_ns_entry.old:
+ c_ns = c_ns_entry.old
break
if c_ns is NULL:
@@ -256,8 +256,8 @@ cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node):
c_new_ns = c_parent.nsDef
while c_new_ns:
ns_in_use = 0
- for i in range(c_ns_cache.last):
- if c_new_ns is c_ns_cache.ns_map[i].old:
+ for c_ns_entry in c_ns_cache.ns_map[:c_ns_cache.last]:
+ if c_new_ns is c_ns_entry.old:
ns_in_use = 1
break