summaryrefslogtreecommitdiff
path: root/ext/dom/php_dom.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/php_dom.h')
-rw-r--r--ext/dom/php_dom.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index f2bccf7b8..f5f0bc6a7 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -146,6 +146,20 @@ entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not yet implemented"); \
return;
+#define convert_to_copy_master(orig, copy, lower_type, upper_type) \
+ if (Z_TYPE_P(orig) != IS_##upper_type) { \
+ if (Z_REFCOUNT_P(orig) > 1) { \
+ copy = *orig; \
+ zval_copy_ctor(&copy); \
+ orig = © \
+ } \
+ convert_to_##lower_type(orig); \
+ }
+
+#define convert_to_string_copy(orig, copy) convert_to_copy_master(orig, copy, string, STRING);
+#define convert_to_long_copy(orig, copy) convert_to_copy_master(orig, copy, long, LONG);
+#define convert_to_boolean_copy(orig, copy) convert_to_copy_master(orig, copy, boolean, BOOL);
+
#define DOM_NODELIST 0
#define DOM_NAMEDNODEMAP 1