- add rebuild script
[m6w6/ext-http] / php_http_std_defs.h
index e115b569840f1beeea232244d907b6f092bed67d..f166fe5ade8d77c77c7b89649b09fec91f14a27a 100644 (file)
@@ -36,10 +36,21 @@ typedef int STATUS;
 /* lenof() */
 #define lenof(S) (sizeof(S) - 1)
 
+#ifndef MIN
+#      define MIN(a,b) (a<b?a:b)
+#endif
+#ifndef MAX
+#      define MAX(a,b) (a>b?a:b)
+#endif
+
 /* STR_SET() */
-#define STR_SET(target, source) \
-       if(target) efree(target); \
-       target = source
+#ifndef STR_SET
+#      define STR_SET(STR, SET) \
+       { \
+               STR_FREE(STR); \
+               STR = SET; \
+       }
+#endif
 
 /* return bool (v == SUCCESS) */
 #define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
@@ -51,13 +62,17 @@ typedef int STATUS;
        RETVAL_OBJECT(o); \
        return
 #define RETVAL_OBJVAL(ov) \
-       return_value->is_ref = 1; \
-       return_value->type = IS_OBJECT; \
-       return_value->value.obj = (ov); \
-       zend_objects_store_add_ref(return_value TSRMLS_CC)
+       ZVAL_OBJVAL(return_value, ov)
 #define RETURN_OBJVAL(ov) \
        RETVAL_OBJVAL(ov); \
        return
+#define ZVAL_OBJVAL(zv, ov) \
+       (zv)->is_ref = 1; \
+       (zv)->type = IS_OBJECT; \
+       (zv)->value.obj = (ov); \
+       if (Z_OBJ_HT_P(zv)->add_ref) { \
+               Z_OBJ_HT_P(zv)->add_ref((zv) TSRMLS_CC); \
+       }
 
 /* function accepts no args */
 #define NO_ARGS \
@@ -107,6 +122,8 @@ typedef int STATUS;
 
 #define HTTP_PHP_INI_ENTRY(entry, default, scope, updater, global) \
        STD_PHP_INI_ENTRY(entry, default, scope, updater, global, zend_http_globals, http_globals)
+#define HTTP_PHP_INI_ENTRY_EX(entry, default, scope, updater, displayer, global) \
+       STD_PHP_INI_ENTRY_EX(entry, default, scope, updater, global, zend_http_globals, http_globals, displayer)
 
 /* {{{ arrays */
 #define FOREACH_VAL(array, val) FOREACH_HASH_VAL(Z_ARRVAL_P(array), val)
@@ -201,12 +218,12 @@ typedef int STATUS;
 #      define putObject(t, o) zend_objects_store_put(o, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) t## _free, NULL TSRMLS_CC);
 #      define OBJ_PROP(o) (o)->zo.properties
 
-#      define DCL_STATIC_PROP(a, t, n, v)              zend_declare_property_ ##t(ce, (#n), sizeof(#n), (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
-#      define DCL_STATIC_PROP_Z(a, n, v)               zend_declare_property(ce, (#n), sizeof(#n), (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
-#      define DCL_STATIC_PROP_N(a, n)                  zend_declare_property_null(ce, (#n), sizeof(#n), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
-#      define GET_STATIC_PROP_EX(ce, n)                zend_std_get_static_property(ce, (#n), sizeof(#n), 0 TSRMLS_CC)
-#      define UPD_STATIC_PROP_EX(ce, t, n, v)  zend_update_static_property_ ##t(ce, #n, sizeof(#n), (v) TSRMLS_CC)
-#      define SET_STATIC_PROP_EX(ce, n, v)             zend_update_static_property(ce, #n, sizeof(#n), v TSRMLS_CC)
+#      define DCL_STATIC_PROP(a, t, n, v)              zend_declare_property_ ##t(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
+#      define DCL_STATIC_PROP_Z(a, n, v)               zend_declare_property(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
+#      define DCL_STATIC_PROP_N(a, n)                  zend_declare_property_null(ce, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
+#      define GET_STATIC_PROP_EX(ce, n)                zend_std_get_static_property(ce, (#n), sizeof(#n)-1, 0 TSRMLS_CC)
+#      define UPD_STATIC_PROP_EX(ce, t, n, v)  zend_update_static_property_ ##t(ce, #n, sizeof(#n)-1, (v) TSRMLS_CC)
+#      define SET_STATIC_PROP_EX(ce, n, v)             zend_update_static_property(ce, #n, sizeof(#n)-1, v 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)
@@ -218,7 +235,7 @@ typedef int STATUS;
 #      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)-1, 0 TSRMLS_CC)
 
-#      define DCL_CONST(t, n, v) zend_declare_class_constant_ ##t(ce, (n), sizeof(n), (v) TSRMLS_CC)
+#      define DCL_CONST(t, n, v) zend_declare_class_constant_ ##t(ce, (n), sizeof(n)-1, (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))))
@@ -254,15 +271,16 @@ typedef int STATUS;
 #ifndef E_THROW
 #      define E_THROW 0
 #endif
-#define HE_THROW       E_THROW
 #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)
+#      define HE_THROW         E_THROW TSRMLS_CC
+#      define HE_NOTICE        (HTTP_G(only_exceptions) ? E_THROW : E_NOTICE) TSRMLS_CC
+#      define HE_WARNING       (HTTP_G(only_exceptions) ? E_THROW : E_WARNING) TSRMLS_CC
+#      define HE_ERROR         (HTTP_G(only_exceptions) ? E_THROW : E_ERROR) TSRMLS_CC
 #else
-#      define HE_NOTICE        E_NOTICE
-#      define HE_WARNING       E_WARNING
-#      define HE_ERROR         E_ERROR
+#      define HE_THROW         E_WARNING TSRMLS_CC
+#      define HE_NOTICE        E_NOTICE TSRMLS_CC
+#      define HE_WARNING       E_WARNING TSRMLS_CC
+#      define HE_ERROR         E_ERROR TSRMLS_CC
 #endif
 
 #define HTTP_E_RUNTIME                         1L
@@ -288,6 +306,12 @@ typedef int STATUS;
 #      define HTTP_ARG_OBJ(class, name, allow_null)                            ZEND_ARG_OBJ_INFO(1, name, class, allow_null)
 #endif
 
+#ifdef ZEND_ENGINE_2
+#      define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL, 0, 0}
+#else
+#      define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL}
+#endif
+
 #ifdef HTTP_HAVE_CURL
 #      ifdef ZEND_ENGINE_2
 #              define HTTP_DECLARE_ARG_PASS_INFO() \