diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index e89f70723a7..6b1dbf06845 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -31,6 +31,45 @@ #define PHP_XPATH 1 #define PHP_XPTR 2 +/* 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; + static int le_domxmldocp; static int le_domxmldoctypep; static int le_domxmldtdp; diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h index c65da4d6a92..8c464e91095 100644 --- a/ext/domxml/php_domxml.h +++ b/ext/domxml/php_domxml.h @@ -142,45 +142,6 @@ 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 */