Permalink
Browse files

Add macros to return values of other zvals.

This is needed because one cannot use REPLACE_ZVAL_VALUE with return_value.
  • Loading branch information...
1 parent 5690821 commit c7d27ad938e48df7e742a2d3e183485194a97e09 Marcus Boerger committed Nov 29, 2003
Showing with 17 additions and 0 deletions.
  1. +17 −0 Zend/zend_API.h
View
@@ -377,6 +377,21 @@ ZEND_API ZEND_FUNCTION(display_disabled_class);
(z)->type = IS_STRING; \
}
+#define ZVAL_ZVAL(z, zv, copy, dtor) { \
+ int is_ref, refcount; \
+ is_ref = (z)->is_ref; \
+ refcount = (z)->refcount; \
+ *(z) = *(zv); \
+ if (copy) { \
+ zval_copy_ctor(z); \
+ } \
+ if (dtor) { \
+ zval_ptr_dtor(zv); \
+ } \
+ (z)->is_ref = is_ref; \
+ (z)->refcount = refcount; \
+ }
+
#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
@@ -388,6 +403,7 @@ ZEND_API ZEND_FUNCTION(display_disabled_class);
#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
+#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
@@ -399,6 +415,7 @@ ZEND_API ZEND_FUNCTION(display_disabled_class);
#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
+#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
#define RETURN_FALSE { RETVAL_FALSE; return; }
#define RETURN_TRUE { RETVAL_TRUE; return; }

0 comments on commit c7d27ad

Please sign in to comment.