+#define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
+#define HASH_ORNULL(z) ((z) ? Z_ARRVAL_P(z) : NULL)
+#define NO_ARGS if (ZEND_NUM_ARGS()) WRONG_PARAM_COUNT
+
+#define array_copy(src, dst) zend_hash_copy(Z_ARRVAL_P(dst), Z_ARRVAL_P(src), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *))
+#define array_merge(src, dst) zend_hash_merge(Z_ARRVAL_P(dst), Z_ARRVAL_P(src), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *), 1)
+
+#ifdef ZEND_ENGINE_2
+
+# define HTTP_REGISTER_CLASS_EX(classname, name, parent, flags) \
+ { \
+ zend_class_entry ce; \
+ INIT_CLASS_ENTRY(ce, #classname, name## _class_methods); \
+ ce.create_object = name## _new_object; \
+ name## _ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
+ name## _ce->ce_flags |= flags; \
+ memcpy(& name## _object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
+ name## _object_handlers.clone_obj = NULL; \
+ name## _declare_default_properties(name## _ce); \
+ }
+
+# define HTTP_REGISTER_CLASS(classname, name, parent, flags) \
+ { \
+ zend_class_entry ce; \
+ INIT_CLASS_ENTRY(ce, #classname, name## _class_methods); \
+ ce.create_object = NULL; \
+ name## _ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
+ name## _ce->ce_flags |= flags; \
+ }
+
+# define getObject(t, o) t * o = ((t *) zend_object_store_get_object(getThis() TSRMLS_CC))
+# define OBJ_PROP(o) o->zo.properties
+# define DCL_PROP(a, t, n, v) zend_declare_property_ ##t(ce, (#n), sizeof(#n), (v), (ZEND_ACC_ ##a) TSRMLS_CC)
+# define DCL_PROP_Z(a, n, v) zend_declare_property(ce, (#n), sizeof(#n), (v), (ZEND_ACC_ ##a) TSRMLS_CC)
+# define DCL_PROP_N(a, n) zend_declare_property_null(ce, (#n), sizeof(#n), (ZEND_ACC_ ##a) TSRMLS_CC)
+# define UPD_PROP(o, t, n, v) zend_update_property_ ##t(o->zo.ce, getThis(), (#n), sizeof(#n), (v) TSRMLS_CC)
+# define SET_PROP(o, n, z) zend_update_property(o->zo.ce, getThis(), (#n), sizeof(#n), (z) TSRMLS_CC)
+# define GET_PROP(o, n) zend_read_property(o->zo.ce, getThis(), (#n), sizeof(#n), 0 TSRMLS_CC)
+
+# define INIT_PARR(o, n) \
+ { \
+ zval *__tmp; \
+ MAKE_STD_ZVAL(__tmp); \
+ array_init(__tmp); \
+ SET_PROP(o, n, __tmp); \
+ }
+
+# define FREE_PARR(o, p) \
+ { \
+ zval *__tmp = NULL; \
+ if (__tmp = GET_PROP(o, p)) { \
+ zval_dtor(__tmp); \
+ FREE_ZVAL(__tmp); \
+ __tmp = NULL; \
+ } \
+ }
+
+#endif /* ZEND_ENGINE_2 */
+