Skip to content

Commit 9c2c0c3

Browse files
committed
Remove always-true check
1 parent 171e398 commit 9c2c0c3

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

ext/dom/xpath.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,24 @@ PHP_METHOD(DOMXPath, __construct)
135135
}
136136

137137
intern = Z_XPATHOBJ_P(ZEND_THIS);
138-
if (intern != NULL) {
139-
oldctx = (xmlXPathContextPtr)intern->dom.ptr;
140-
if (oldctx != NULL) {
141-
php_libxml_decrement_doc_ref((php_libxml_node_object *) &intern->dom);
142-
xmlXPathFreeContext(oldctx);
143-
}
144-
145-
xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "functionString",
146-
(const xmlChar *) "http://php.net/xpath",
147-
dom_xpath_ext_function_string_php);
148-
xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "function",
149-
(const xmlChar *) "http://php.net/xpath",
150-
dom_xpath_ext_function_object_php);
151-
152-
intern->dom.ptr = ctx;
153-
ctx->userData = (void *)intern;
154-
intern->dom.document = docobj->document;
155-
intern->register_node_ns = register_node_ns;
156-
php_libxml_increment_doc_ref((php_libxml_node_object *) &intern->dom, docp);
138+
oldctx = (xmlXPathContextPtr)intern->dom.ptr;
139+
if (oldctx != NULL) {
140+
php_libxml_decrement_doc_ref((php_libxml_node_object *) &intern->dom);
141+
xmlXPathFreeContext(oldctx);
157142
}
143+
144+
xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "functionString",
145+
(const xmlChar *) "http://php.net/xpath",
146+
dom_xpath_ext_function_string_php);
147+
xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "function",
148+
(const xmlChar *) "http://php.net/xpath",
149+
dom_xpath_ext_function_object_php);
150+
151+
intern->dom.ptr = ctx;
152+
ctx->userData = (void *)intern;
153+
intern->dom.document = docobj->document;
154+
intern->register_node_ns = register_node_ns;
155+
php_libxml_increment_doc_ref((php_libxml_node_object *) &intern->dom, docp);
158156
}
159157
/* }}} end DOMXPath::__construct */
160158

0 commit comments

Comments
 (0)