summaryrefslogtreecommitdiff
path: root/ext/domxml/php_domxml.h
diff options
context:
space:
mode:
authorMarkus Fischer <mfischer@php.net>2001-12-01 19:42:34 +0000
committerMarkus Fischer <mfischer@php.net>2001-12-01 19:42:34 +0000
commit222fe232751b607aab466bcbd2826c2b6f9f366f (patch)
tree719413c8e151382c3dbbaee932b8957519e0f272 /ext/domxml/php_domxml.h
parentf4299a90e268ecf6cd7b073885caaac1514c89b9 (diff)
downloadphp-git-222fe232751b607aab466bcbd2826c2b6f9f366f.tar.gz
Last commit:
- Fix segfault in xmldoc(). - Proper free zval in php_xpathptr_eval(). This one: - Fix segfault in php_xpathptr_eval(). - Fix win32 build (TSRMLS_FETCH issues). - More sanity checking in php_xpath_get_object(), php_xpath_get_context() and php_dom_get_object(). - Moved macros into header file. - Register le_domxmldtd, le_domxmlcdatap (removes anoying warning message on shutdown). - Fig segfault in node_children() with unsupported node types. - Fix leak in php_domobject_new() with unsupported note types. - Fix leak when freeing xpath context/objects. - Reverted behaviour change to append_child() [old crashes]. - set_content() also sets the node->content property. # Testers/patches/contribs welcome.
Diffstat (limited to 'ext/domxml/php_domxml.h')
-rw-r--r--ext/domxml/php_domxml.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h
index a9799b2a6a..c65da4d6a9 100644
--- a/ext/domxml/php_domxml.h
+++ b/ext/domxml/php_domxml.h
@@ -140,8 +140,47 @@ PHP_FUNCTION(xpath_eval_expression);
PHP_FUNCTION(xptr_new_context);
PHP_FUNCTION(xptr_eval);
#endif
-
PHP_FUNCTION(domxml_test);
+
+/* General macros used by domxml */
+#define DOMXML_DOMOBJ_NEW(zval, obj, ret) if (NULL == (zval = php_domobject_new(obj, ret TSRMLS_CC))) { \
+ php_error(E_WARNING, "%s() cannot create required DOM object", \
+ get_active_function_name(TSRMLS_C)); \
+ RETURN_FALSE; \
+ }
+
+#define DOMXML_RET_ZVAL(zval) SEPARATE_ZVAL(&zval); \
+ *return_value = *zval; \
+ FREE_ZVAL(zval);
+
+#define DOMXML_RET_OBJ(zval, obj, ret) DOMXML_DOMOBJ_NEW(zval, obj, ret); \
+ DOMXML_RET_ZVAL(zval);
+
+#define DOMXML_GET_THIS(zval) if (NULL == (zval = getThis())) { \
+ php_error(E_WARNING, "%s() underlying object missing", \
+ get_active_function_name(TSRMLS_C)); \
+ RETURN_FALSE; \
+ }
+
+#define DOMXML_GET_OBJ(ret, zval, le) if (NULL == (ret = php_dom_get_object(zval, le, 0 TSRMLS_CC))) { \
+ php_error(E_WARNING, "%s() cannot fetch DOM object", \
+ get_active_function_name(TSRMLS_C)); \
+ RETURN_FALSE; \
+ }
+
+#define DOMXML_GET_THIS_OBJ(ret, zval, le) DOMXML_GET_THIS(zval); \
+ DOMXML_GET_OBJ(ret, zval, le);
+
+#define DOMXML_NO_ARGS() if (ZEND_NUM_ARGS() != 0) { \
+ php_error(E_WARNING, "%s() expects exactly 0 parameters, %d given", \
+ get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); \
+ return; \
+ }
+
+#define DOMXML_NOT_IMPLEMENTED() php_error(E_WARNING, "%s() not yet implemented", \
+ get_active_function_name(TSRMLS_C)); \
+ return;
+
#else
#define domxml_module_ptr NULL
#endif /* HAVE_DOMXML */