- fix php4 build
[m6w6/ext-http] / php_http_std_defs.h
index 115ece2e1fc1ca5e432075a0779c07ef72d0c402..93b5f65ef4ca6fddb566b3dbed9748229579a145 100644 (file)
@@ -54,7 +54,6 @@ typedef int STATUS;
        return_value->is_ref = 1; \
        return_value->type = IS_OBJECT; \
        return_value->value.obj = (ov); \
-       zval_add_ref(&return_value); \
        zend_objects_store_add_ref(return_value TSRMLS_CC)
 #define RETURN_OBJVAL(ov) \
        RETVAL_OBJVAL(ov); \
@@ -179,6 +178,7 @@ typedef int STATUS;
                name## _ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
                name## _ce->ce_flags |= flags;  \
                memcpy(& name## _handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
+               zend_hash_init(& name## _ce->constants_table, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1); \
                name## _declare_default_properties(); \
        }
 
@@ -289,15 +289,17 @@ typedef int STATUS;
                zval_dtor(__tmp); \
                efree(__tmp); \
        }
-#      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 DCL_PROP(a, t, n, v) zend_declare_property_ ##t(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC)
+#      define DCL_PROP_Z(a, n, v) zend_declare_property(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC)
+#      define DCL_PROP_N(a, n) zend_declare_property_null(ce, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a) TSRMLS_CC)
 #      define UPD_PROP(o, t, n, v) UPD_PROP_EX(o, getThis(), t, n, v)
-#      define UPD_PROP_EX(o, this, t, n, v) zend_update_property_ ##t(o->zo.ce, this, (#n), sizeof(#n), (v) TSRMLS_CC)
+#      define UPD_PROP_EX(o, this, t, n, v) zend_update_property_ ##t(o->zo.ce, this, (#n), sizeof(#n)-1, (v) TSRMLS_CC)
 #      define SET_PROP(o, n, z) SET_PROP_EX(o, getThis(), n, z)
-#      define SET_PROP_EX(o, this, n, z) zend_update_property(o->zo.ce, this, (#n), sizeof(#n), (z) TSRMLS_CC)
+#      define SET_PROP_EX(o, this, n, z) zend_update_property(o->zo.ce, this, (#n), sizeof(#n)-1, (z) TSRMLS_CC)
 #      define GET_PROP(o, n) GET_PROP_EX(o, getThis(), n)
-#      define GET_PROP_EX(o, this, n) zend_read_property(o->zo.ce, this, (#n), sizeof(#n), 0 TSRMLS_CC)
+#      define GET_PROP_EX(o, this, n) zend_read_property(o->zo.ce, this, (#n), sizeof(#n)-1, 0 TSRMLS_CC)
+
+#      define DCL_CONST(t, n, v) zend_declare_class_constant_ ##t(ce, (n), sizeof(n), (v) TSRMLS_CC)
 
 #      define ACC_PROP_PRIVATE(ce, flags)              ((flags & ZEND_ACC_PRIVATE) && (EG(scope) && ce == EG(scope))
 #      define ACC_PROP_PROTECTED(ce, flags)    ((flags & ZEND_ACC_PROTECTED) && (zend_check_protected(ce, EG(scope))))
@@ -314,8 +316,8 @@ typedef int STATUS;
 
 #      define FREE_PARR(o, p) \
        { \
-               zval *__tmp = NULL; \
-               if (__tmp = GET_PROP(o, p)) { \
+               zval *__tmp = GET_PROP(o, p); \
+               if (__tmp) { \
                        zval_dtor(__tmp); \
                        FREE_ZVAL(__tmp); \
                        __tmp = NULL; \
@@ -334,9 +336,15 @@ typedef int STATUS;
 #      define E_THROW 0
 #endif
 #define HE_THROW       E_THROW
-#define HE_NOTICE      (HTTP_G(only_exceptions) ? E_THROW : E_NOTICE)
-#define HE_WARNING     (HTTP_G(only_exceptions) ? E_THROW : E_WARNING)
-#define HE_ERROR       (HTTP_G(only_exceptions) ? E_THROW : E_ERROR)
+#ifdef ZEND_ENGINE_2
+#      define HE_NOTICE        (HTTP_G(only_exceptions) ? E_THROW : E_NOTICE)
+#      define HE_WARNING       (HTTP_G(only_exceptions) ? E_THROW : E_WARNING)
+#      define HE_ERROR         (HTTP_G(only_exceptions) ? E_THROW : E_ERROR)
+#else
+#      define HE_NOTICE        E_NOTICE
+#      define HE_WARNING       E_WARNING
+#      define HE_ERROR         E_ERROR
+#endif
 
 #define HTTP_E_RUNTIME                         1L
 #define HTTP_E_INVALID_PARAM           2L