Skip to content

Commit 9c23355

Browse files
committed
Remove useless operations in namespace_compat
We never use the return value, so we can avoid a double lookup and a return.
1 parent 5dd9b0d commit 9c23355

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

ext/dom/namespace_compat.c

+2-9
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ PHP_DOM_EXPORT xmlNsPtr php_dom_libxml_ns_mapper_get_ns_raw_strings_nullsafe(php
180180
return php_dom_libxml_ns_mapper_get_ns_raw_strings(mapper, prefix, uri);
181181
}
182182

183-
static xmlNsPtr php_dom_libxml_ns_mapper_store_and_normalize_parsed_ns(php_dom_libxml_ns_mapper *mapper, xmlNsPtr ns)
183+
static void php_dom_libxml_ns_mapper_store_and_normalize_parsed_ns(php_dom_libxml_ns_mapper *mapper, xmlNsPtr ns)
184184
{
185185
ZEND_ASSERT(ns != NULL);
186186

@@ -198,16 +198,9 @@ static xmlNsPtr php_dom_libxml_ns_mapper_store_and_normalize_parsed_ns(php_dom_l
198198
prefix_len = xmlStrlen(ns->prefix);
199199
}
200200

201-
zval *zv = zend_hash_str_find_ptr(prefix_map, prefix, prefix_len);
202-
if (zv != NULL) {
203-
return Z_PTR_P(zv);
204-
}
205-
206201
zval new_zv;
207202
DOM_Z_UNOWNED(&new_zv, ns);
208-
zend_hash_str_add_new(prefix_map, prefix, prefix_len, &new_zv);
209-
210-
return ns;
203+
zend_hash_str_add(prefix_map, prefix, prefix_len, &new_zv);
211204
}
212205

213206
typedef struct {

0 commit comments

Comments
 (0)