- use OBJ_PROP_CE macro
authorMichael Wallner <mike@php.net>
Fri, 3 Mar 2006 16:06:02 +0000 (16:06 +0000)
committerMichael Wallner <mike@php.net>
Fri, 3 Mar 2006 16:06:02 +0000 (16:06 +0000)
http.c
http_deflatestream_object.c
http_inflatestream_object.c
http_message_object.c
http_querystring_object.c
http_request_object.c
http_requestpool_object.c
http_response_object.c
php_http.h
php_http_std_defs.h

diff --git a/http.c b/http.c
index 2f2011fad9ed22d32e0d86bcc234e20356e020d2..730bf4b416932582ff7c001fded93be2a2e3a863 100644 (file)
--- a/http.c
+++ b/http.c
@@ -123,6 +123,12 @@ zend_function_entry http_functions[] = {
 };
 /* }}} */
 
+PHP_MINIT_FUNCTION(http);
+PHP_MSHUTDOWN_FUNCTION(http);
+PHP_RINIT_FUNCTION(http);
+PHP_RSHUTDOWN_FUNCTION(http);
+PHP_MINFO_FUNCTION(http);
+
 /* {{{ http_module_dep */
 #if ZEND_EXTENSION_API_NO >= 220050617
 static zend_module_dep http_module_deps[] = {
@@ -135,9 +141,9 @@ static zend_module_dep http_module_deps[] = {
 #      ifdef HAVE_PHP_SESSION
        ZEND_MOD_REQUIRED("session")
 #      endif
-#ifdef HAVE_ICONV
+#      ifdef HAVE_ICONV
        ZEND_MOD_REQUIRED("iconv")
-#endif
+#      endif
        {NULL, NULL, NULL, 0}
 };
 #endif
index 0caa74b5800d524770200b08689c3d813b5d8bac..4b9e582a64003496f4b262c229eeb7c20512f364 100644 (file)
@@ -42,9 +42,7 @@ HTTP_BEGIN_ARGS(finish, 0)
        HTTP_ARG_VAL(data, 0)
 HTTP_END_ARGS;
 
-#define http_deflatestream_object_declare_default_properties() _http_deflatestream_object_declare_default_properties(TSRMLS_C)
-static inline void _http_deflatestream_object_declare_default_properties(TSRMLS_D);
-
+#define OBJ_PROP_CE http_deflatestream_object_ce
 zend_class_entry *http_deflatestream_object_ce;
 zend_function_entry http_deflatestream_object_fe[] = {
        HTTP_DEFLATE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
@@ -60,6 +58,21 @@ PHP_MINIT_FUNCTION(http_deflatestream_object)
 {
        HTTP_REGISTER_CLASS_EX(HttpDeflateStream, http_deflatestream_object, NULL, 0);
        http_deflatestream_object_handlers.clone_obj = _http_deflatestream_object_clone_obj;
+       
+#ifndef WONKY
+       DCL_CONST(long, "TYPE_GZIP", HTTP_DEFLATE_TYPE_GZIP);
+       DCL_CONST(long, "TYPE_ZLIB", HTTP_DEFLATE_TYPE_ZLIB);
+       DCL_CONST(long, "TYPE_RAW", HTTP_DEFLATE_TYPE_RAW);
+       DCL_CONST(long, "LEVEL_DEF", HTTP_DEFLATE_LEVEL_DEF);
+       DCL_CONST(long, "LEVEL_MIN", HTTP_DEFLATE_LEVEL_MIN);
+       DCL_CONST(long, "LEVEL_MAX", HTTP_DEFLATE_LEVEL_MAX);
+       DCL_CONST(long, "STRATEGY_DEF", HTTP_DEFLATE_STRATEGY_DEF);
+       DCL_CONST(long, "STRATEGY_FILT", HTTP_DEFLATE_STRATEGY_FILT);
+       DCL_CONST(long, "STRATEGY_HUFF", HTTP_DEFLATE_STRATEGY_HUFF);
+       DCL_CONST(long, "STRATEGY_RLE", HTTP_DEFLATE_STRATEGY_RLE);
+       DCL_CONST(long, "STRATEGY_FIXED", HTTP_DEFLATE_STRATEGY_FIXED);
+#endif
+       
        return SUCCESS;
 }
 
@@ -106,25 +119,6 @@ zend_object_value _http_deflatestream_object_clone_obj(zval *this_ptr TSRMLS_DC)
        return http_deflatestream_object_new_ex(Z_OBJCE_P(this_ptr), s, NULL);
 }
 
-static inline void _http_deflatestream_object_declare_default_properties(TSRMLS_D)
-{
-       zend_class_entry *ce = http_deflatestream_object_ce;
-
-#ifndef WONKY
-       DCL_CONST(long, "TYPE_GZIP", HTTP_DEFLATE_TYPE_GZIP);
-       DCL_CONST(long, "TYPE_ZLIB", HTTP_DEFLATE_TYPE_ZLIB);
-       DCL_CONST(long, "TYPE_RAW", HTTP_DEFLATE_TYPE_RAW);
-       DCL_CONST(long, "LEVEL_DEF", HTTP_DEFLATE_LEVEL_DEF);
-       DCL_CONST(long, "LEVEL_MIN", HTTP_DEFLATE_LEVEL_MIN);
-       DCL_CONST(long, "LEVEL_MAX", HTTP_DEFLATE_LEVEL_MAX);
-       DCL_CONST(long, "STRATEGY_DEF", HTTP_DEFLATE_STRATEGY_DEF);
-       DCL_CONST(long, "STRATEGY_FILT", HTTP_DEFLATE_STRATEGY_FILT);
-       DCL_CONST(long, "STRATEGY_HUFF", HTTP_DEFLATE_STRATEGY_HUFF);
-       DCL_CONST(long, "STRATEGY_RLE", HTTP_DEFLATE_STRATEGY_RLE);
-       DCL_CONST(long, "STRATEGY_FIXED", HTTP_DEFLATE_STRATEGY_FIXED);
-#endif
-}
-
 void _http_deflatestream_object_free(zend_object *object TSRMLS_DC)
 {
        http_deflatestream_object *o = (http_deflatestream_object *) object;
index 31c728fdf118e7ba9ca35d502ef4b63e0bcfe520..c46a4f162b6e3919292780b9e202156141b505ca 100644 (file)
@@ -38,6 +38,7 @@ HTTP_BEGIN_ARGS(finish, 0)
        HTTP_ARG_VAL(data, 0)
 HTTP_END_ARGS;
 
+#define OBJ_PROP_CE http_inflatestream_object_ce
 zend_class_entry *http_inflatestream_object_ce;
 zend_function_entry http_inflatestream_object_fe[] = {
        HTTP_INFLATE_ME(update, ZEND_ACC_PUBLIC)
@@ -48,8 +49,6 @@ zend_function_entry http_inflatestream_object_fe[] = {
 };
 static zend_object_handlers http_inflatestream_object_handlers;
 
-static inline void http_inflatestream_object_declare_default_properties() { return; }
-
 PHP_MINIT_FUNCTION(http_inflatestream_object)
 {
        HTTP_REGISTER_CLASS_EX(HttpInflateStream, http_inflatestream_object, NULL, 0);
index c642754c73641b81bf4182bee3a71d25ebc7f658..4cb201a2e6f21093403b525301c5d36fbc675a2e 100644 (file)
@@ -123,8 +123,6 @@ HTTP_BEGIN_ARGS(prepend, 1)
 HTTP_END_ARGS;
 HTTP_EMPTY_ARGS(reverse);
 
-#define http_message_object_declare_default_properties() _http_message_object_declare_default_properties(TSRMLS_C)
-static inline void _http_message_object_declare_default_properties(TSRMLS_D);
 #define http_message_object_read_prop _http_message_object_read_prop
 static zval *_http_message_object_read_prop(zval *object, zval *member, int type TSRMLS_DC);
 #define http_message_object_write_prop _http_message_object_write_prop
@@ -132,6 +130,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
 #define http_message_object_get_props _http_message_object_get_props
 static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC);
 
+#define OBJ_PROP_CE http_message_object_ce
 zend_class_entry *http_message_object_ce;
 zend_function_entry http_message_object_fe[] = {
        HTTP_MESSAGE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
@@ -186,6 +185,7 @@ static zend_object_handlers http_message_object_handlers;
 PHP_MINIT_FUNCTION(http_message_object)
 {
        HTTP_REGISTER_CLASS_EX(HttpMessage, http_message_object, NULL, 0);
+       
 #ifndef WONKY
 #      ifdef HAVE_SPL
        zend_class_implements(http_message_object_ce TSRMLS_CC, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);
@@ -195,17 +195,33 @@ PHP_MINIT_FUNCTION(http_message_object)
 #else
        zend_class_implements(http_message_object_ce TSRMLS_CC, 1, zend_ce_iterator);
 #endif
-
-       HTTP_LONG_CONSTANT("HTTP_MSG_NONE", HTTP_MSG_NONE);
-       HTTP_LONG_CONSTANT("HTTP_MSG_REQUEST", HTTP_MSG_REQUEST);
-       HTTP_LONG_CONSTANT("HTTP_MSG_RESPONSE", HTTP_MSG_RESPONSE);
-
+       
        http_message_object_handlers.clone_obj = _http_message_object_clone_obj;
        http_message_object_handlers.read_property = http_message_object_read_prop;
        http_message_object_handlers.write_property = http_message_object_write_prop;
        http_message_object_handlers.get_properties = http_message_object_get_props;
        http_message_object_handlers.get_property_ptr_ptr = NULL;
        
+       DCL_PROP(PROTECTED, long, type, HTTP_MSG_NONE);
+       DCL_PROP(PROTECTED, string, body, "");
+       DCL_PROP(PROTECTED, string, requestMethod, "");
+       DCL_PROP(PROTECTED, string, requestUrl, "");
+       DCL_PROP(PROTECTED, string, responseStatus, "");
+       DCL_PROP(PROTECTED, long, responseCode, 0);
+       DCL_PROP_N(PROTECTED, httpVersion);
+       DCL_PROP_N(PROTECTED, headers);
+       DCL_PROP_N(PROTECTED, parentMessage);
+       
+#ifndef WONKY
+       DCL_CONST(long, "TYPE_NONE", HTTP_MSG_NONE);
+       DCL_CONST(long, "TYPE_REQUEST", HTTP_MSG_REQUEST);
+       DCL_CONST(long, "TYPE_RESPONSE", HTTP_MSG_RESPONSE);
+#endif
+       
+       HTTP_LONG_CONSTANT("HTTP_MSG_NONE", HTTP_MSG_NONE);
+       HTTP_LONG_CONSTANT("HTTP_MSG_REQUEST", HTTP_MSG_REQUEST);
+       HTTP_LONG_CONSTANT("HTTP_MSG_RESPONSE", HTTP_MSG_RESPONSE);
+       
        return SUCCESS;
 }
 
@@ -338,27 +354,6 @@ zend_object_value _http_message_object_clone_obj(zval *this_ptr TSRMLS_DC)
        return http_message_object_new_ex(Z_OBJCE_P(this_ptr), http_message_dup(obj->message), NULL);
 }
 
-static inline void _http_message_object_declare_default_properties(TSRMLS_D)
-{
-       zend_class_entry *ce = http_message_object_ce;
-
-#ifndef WONKY
-       DCL_CONST(long, "TYPE_NONE", HTTP_MSG_NONE);
-       DCL_CONST(long, "TYPE_REQUEST", HTTP_MSG_REQUEST);
-       DCL_CONST(long, "TYPE_RESPONSE", HTTP_MSG_RESPONSE);
-#endif
-
-       DCL_PROP(PROTECTED, long, type, HTTP_MSG_NONE);
-       DCL_PROP(PROTECTED, string, body, "");
-       DCL_PROP(PROTECTED, string, requestMethod, "");
-       DCL_PROP(PROTECTED, string, requestUrl, "");
-       DCL_PROP(PROTECTED, string, responseStatus, "");
-       DCL_PROP(PROTECTED, long, responseCode, 0);
-       DCL_PROP_N(PROTECTED, httpVersion);
-       DCL_PROP_N(PROTECTED, headers);
-       DCL_PROP_N(PROTECTED, parentMessage);
-}
-
 void _http_message_object_free(zend_object *object TSRMLS_DC)
 {
        http_message_object *o = (http_message_object *) object;
index 299a5616e83453b3fb151ab4dd081d9aa878bacd..129e02caad08a18a32d4dd1d936dffe6502cf3eb 100644 (file)
@@ -78,11 +78,6 @@ HTTP_BEGIN_ARGS(unserialize, 1)
        HTTP_ARG_VAL(serialized, 0)
 HTTP_END_ARGS;
 
-#define http_querystring_object_declare_default_properties() _http_querystring_object_declare_default_properties(TSRMLS_C)
-static inline void _http_querystring_object_declare_default_properties(TSRMLS_D);
-
-#define GET_STATIC_PROP(n) *GET_STATIC_PROP_EX(http_querystring_object_ce, n)
-#define SET_STATIC_PROP(n, v) SET_STATIC_PROP_EX(http_querystring_object_ce, n, v)
 #define OBJ_PROP_CE http_querystring_object_ce
 zend_class_entry *http_querystring_object_ce;
 zend_function_entry http_querystring_object_fe[] = {
@@ -126,6 +121,19 @@ PHP_MINIT_FUNCTION(http_querystring_object)
        zend_class_implements(http_querystring_object_ce TSRMLS_CC, 1, zend_ce_serializable);
 #endif
        
+       DCL_STATIC_PROP_N(PRIVATE, instance);
+       DCL_PROP_N(PRIVATE, queryArray);
+       DCL_PROP(PRIVATE, string, queryString, "");
+       
+#ifndef WONKY
+       DCL_CONST(long, "TYPE_BOOL", HTTP_QUERYSTRING_TYPE_BOOL);
+       DCL_CONST(long, "TYPE_INT", HTTP_QUERYSTRING_TYPE_INT);
+       DCL_CONST(long, "TYPE_FLOAT", HTTP_QUERYSTRING_TYPE_FLOAT);
+       DCL_CONST(long, "TYPE_STRING", HTTP_QUERYSTRING_TYPE_STRING);
+       DCL_CONST(long, "TYPE_ARRAY", HTTP_QUERYSTRING_TYPE_ARRAY);
+       DCL_CONST(long, "TYPE_OBJECT", HTTP_QUERYSTRING_TYPE_OBJECT);
+#endif
+       
        HTTP_LONG_CONSTANT("HTTP_QUERYSTRING_TYPE_BOOL", HTTP_QUERYSTRING_TYPE_BOOL);
        HTTP_LONG_CONSTANT("HTTP_QUERYSTRING_TYPE_INT", HTTP_QUERYSTRING_TYPE_INT);
        HTTP_LONG_CONSTANT("HTTP_QUERYSTRING_TYPE_FLOAT", HTTP_QUERYSTRING_TYPE_FLOAT);
@@ -163,25 +171,6 @@ zend_object_value _http_querystring_object_new_ex(zend_class_entry *ce, http_que
        return ov;
 }
 
-static inline void _http_querystring_object_declare_default_properties(TSRMLS_D)
-{
-       zend_class_entry *ce = http_querystring_object_ce;
-
-       DCL_STATIC_PROP_N(PRIVATE, instance);
-       
-       DCL_PROP_N(PRIVATE, queryArray);
-       DCL_PROP(PRIVATE, string, queryString, "");
-       
-#ifndef WONKY
-       DCL_CONST(long, "TYPE_BOOL", HTTP_QUERYSTRING_TYPE_BOOL);
-       DCL_CONST(long, "TYPE_INT", HTTP_QUERYSTRING_TYPE_INT);
-       DCL_CONST(long, "TYPE_FLOAT", HTTP_QUERYSTRING_TYPE_FLOAT);
-       DCL_CONST(long, "TYPE_STRING", HTTP_QUERYSTRING_TYPE_STRING);
-       DCL_CONST(long, "TYPE_ARRAY", HTTP_QUERYSTRING_TYPE_ARRAY);
-       DCL_CONST(long, "TYPE_OBJECT", HTTP_QUERYSTRING_TYPE_OBJECT);
-#endif
-}
-
 void _http_querystring_object_free(zend_object *object TSRMLS_DC)
 {
        http_querystring_object *o = (http_querystring_object *) object;
index 9b0dd91f12d3652160ff3fae37a8712880733c67..6dc29b8cf5175de8268b8592da71a2c991ca1367 100644 (file)
@@ -220,9 +220,6 @@ HTTP_BEGIN_ARGS(methodExists, 1)
        HTTP_ARG_VAL(method, 0)
 HTTP_END_ARGS;
 
-#define http_request_object_declare_default_properties() _http_request_object_declare_default_properties(TSRMLS_C)
-static inline void _http_request_object_declare_default_properties(TSRMLS_D);
-
 #define OBJ_PROP_CE http_request_object_ce
 zend_class_entry *http_request_object_ce;
 zend_function_entry http_request_object_fe[] = {
@@ -310,60 +307,6 @@ PHP_MINIT_FUNCTION(http_request_object)
 {
        HTTP_REGISTER_CLASS_EX(HttpRequest, http_request_object, NULL, 0);
        http_request_object_handlers.clone_obj = _http_request_object_clone_obj;
-       return SUCCESS;
-}
-
-zend_object_value _http_request_object_new(zend_class_entry *ce TSRMLS_DC)
-{
-       return http_request_object_new_ex(ce, NULL, NULL);
-}
-
-zend_object_value _http_request_object_new_ex(zend_class_entry *ce, CURL *ch, http_request_object **ptr TSRMLS_DC)
-{
-       zend_object_value ov;
-       http_request_object *o;
-
-       o = ecalloc(1, sizeof(http_request_object));
-       o->zo.ce = ce;
-       o->request = http_request_init_ex(NULL, ch, 0, NULL);
-       
-       if (ptr) {
-               *ptr = o;
-       }
-
-       ALLOC_HASHTABLE(OBJ_PROP(o));
-       zend_hash_init(OBJ_PROP(o), 0, NULL, ZVAL_PTR_DTOR, 0);
-       zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-
-       ov.handle = putObject(http_request_object, o);
-       ov.handlers = &http_request_object_handlers;
-
-       return ov;
-}
-
-zend_object_value _http_request_object_clone_obj(zval *this_ptr TSRMLS_DC)
-{
-       zend_object *old_zo;
-       zend_object_value new_ov;
-       http_request_object *new_obj;
-       getObject(http_request_object, old_obj);
-       
-       old_zo = zend_objects_get_address(this_ptr TSRMLS_CC);
-       new_ov = http_request_object_new_ex(old_zo->ce, NULL, &new_obj);
-       if (old_obj->request->ch) {
-               http_curl_init_ex(curl_easy_duphandle(old_obj->request->ch), new_obj->request);
-       }
-       
-       zend_objects_clone_members(&new_obj->zo, new_ov, old_zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
-       phpstr_append(&new_obj->request->conv.request, old_obj->request->conv.request.data, old_obj->request->conv.request.used);
-       phpstr_append(&new_obj->request->conv.response, old_obj->request->conv.response.data, old_obj->request->conv.response.used);
-       
-       return new_ov;
-}
-
-static inline void _http_request_object_declare_default_properties(TSRMLS_D)
-{
-       zend_class_entry *ce = http_request_object_ce;
 
        DCL_PROP_N(PRIVATE, options);
        DCL_PROP_N(PRIVATE, postFields);
@@ -386,7 +329,7 @@ static inline void _http_request_object_declare_default_properties(TSRMLS_D)
 #ifndef WONKY
        /*
         * Request Method Constants
-        */
+       */
        /* HTTP/1.1 */
        DCL_CONST(long, "METH_GET", HTTP_GET);
        DCL_CONST(long, "METH_HEAD", HTTP_HEAD);
@@ -420,29 +363,79 @@ static inline void _http_request_object_declare_default_properties(TSRMLS_D)
        DCL_CONST(long, "METH_ACL", HTTP_ACL);
 
        /*
-        * HTTP Protocol Version Constants
-        */
+       * HTTP Protocol Version Constants
+       */
        DCL_CONST(long, "VERSION_1_0", CURL_HTTP_VERSION_1_0);
        DCL_CONST(long, "VERSION_1_1", CURL_HTTP_VERSION_1_1);
        DCL_CONST(long, "VERSION_NONE", CURL_HTTP_VERSION_NONE);
 
        /*
-        * Auth Constants
-        */
+       * Auth Constants
+       */
        DCL_CONST(long, "AUTH_BASIC", CURLAUTH_BASIC);
        DCL_CONST(long, "AUTH_DIGEST", CURLAUTH_DIGEST);
        DCL_CONST(long, "AUTH_NTLM", CURLAUTH_NTLM);
        DCL_CONST(long, "AUTH_ANY", CURLAUTH_ANY);
        
        /*
-        * Proxy Type Constants
-        */
+       * Proxy Type Constants
+       */
 #      if HTTP_CURL_VERSION(7,15,2)
        DCL_CONST(long, "PROXY_SOCKS4", CURLPROXY_SOCKS4);
 #      endif
        DCL_CONST(long, "PROXY_SOCKS5", CURLPROXY_SOCKS5);
        DCL_CONST(long, "PROXY_HTTP", CURLPROXY_HTTP);
 #endif /* WONKY */
+       
+       return SUCCESS;
+}
+
+zend_object_value _http_request_object_new(zend_class_entry *ce TSRMLS_DC)
+{
+       return http_request_object_new_ex(ce, NULL, NULL);
+}
+
+zend_object_value _http_request_object_new_ex(zend_class_entry *ce, CURL *ch, http_request_object **ptr TSRMLS_DC)
+{
+       zend_object_value ov;
+       http_request_object *o;
+
+       o = ecalloc(1, sizeof(http_request_object));
+       o->zo.ce = ce;
+       o->request = http_request_init_ex(NULL, ch, 0, NULL);
+       
+       if (ptr) {
+               *ptr = o;
+       }
+
+       ALLOC_HASHTABLE(OBJ_PROP(o));
+       zend_hash_init(OBJ_PROP(o), 0, NULL, ZVAL_PTR_DTOR, 0);
+       zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+
+       ov.handle = putObject(http_request_object, o);
+       ov.handlers = &http_request_object_handlers;
+
+       return ov;
+}
+
+zend_object_value _http_request_object_clone_obj(zval *this_ptr TSRMLS_DC)
+{
+       zend_object *old_zo;
+       zend_object_value new_ov;
+       http_request_object *new_obj;
+       getObject(http_request_object, old_obj);
+       
+       old_zo = zend_objects_get_address(this_ptr TSRMLS_CC);
+       new_ov = http_request_object_new_ex(old_zo->ce, NULL, &new_obj);
+       if (old_obj->request->ch) {
+               http_curl_init_ex(curl_easy_duphandle(old_obj->request->ch), new_obj->request);
+       }
+       
+       zend_objects_clone_members(&new_obj->zo, new_ov, old_zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+       phpstr_append(&new_obj->request->conv.request, old_obj->request->conv.request.data, old_obj->request->conv.request.used);
+       phpstr_append(&new_obj->request->conv.response, old_obj->request->conv.response.data, old_obj->request->conv.response.used);
+       
+       return new_ov;
 }
 
 void _http_request_object_free(zend_object *object TSRMLS_DC)
index fed57219ac4ae05d98dce1c773f126f7236182fd..c49edc559f7c35ce4dee6073f52cf963d8dc9204 100644 (file)
@@ -67,9 +67,6 @@ HTTP_EMPTY_ARGS(count);
 HTTP_EMPTY_ARGS(getAttachedRequests);
 HTTP_EMPTY_ARGS(getFinishedRequests);
 
-#define http_requestpool_object_declare_default_properties() _http_requestpool_object_declare_default_properties(TSRMLS_C)
-static inline void _http_requestpool_object_declare_default_properties(TSRMLS_D);
-
 zend_class_entry *http_requestpool_object_ce;
 zend_function_entry http_requestpool_object_fe[] = {
        HTTP_REQPOOL_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
@@ -102,13 +99,14 @@ static zend_object_handlers http_requestpool_object_handlers;
 PHP_MINIT_FUNCTION(http_requestpool_object)
 {
        HTTP_REGISTER_CLASS_EX(HttpRequestPool, http_requestpool_object, NULL, 0);
+       http_requestpool_object_handlers.clone_obj = NULL;
+       
 #if defined(HAVE_SPL) && !defined(WONKY)
        zend_class_implements(http_requestpool_object_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
 #else
        zend_class_implements(http_requestpool_object_ce TSRMLS_CC, 1, zend_ce_iterator);
 #endif
-
-       http_requestpool_object_handlers.clone_obj = NULL;
+       
        return SUCCESS;
 }
 
@@ -132,13 +130,6 @@ zend_object_value _http_requestpool_object_new(zend_class_entry *ce TSRMLS_DC)
        return ov;
 }
 
-static inline void _http_requestpool_object_declare_default_properties(TSRMLS_D)
-{
-       zend_class_entry *ce = http_requestpool_object_ce;
-
-       DCL_PROP_N(PROTECTED, pool);
-}
-
 void _http_requestpool_object_free(zend_object *object TSRMLS_DC)
 {
        http_requestpool_object *o = (http_requestpool_object *) object;
index 02578d0b463bcdb66b8188f0b42a0a0352e3aa3f..29f264a00d5ab4a6d638ce646cb5706dbb398ae2 100644 (file)
 #include "php_http_response_object.h"
 #include "php_http_send_api.h"
 
-#define GET_STATIC_PROP(n)                     *GET_STATIC_PROP_EX(http_response_object_ce, n)
-#define UPD_STATIC_PROP(t, n, v)       UPD_STATIC_PROP_EX(http_response_object_ce, t, n, v)
-#define SET_STATIC_PROP(n, v)          SET_STATIC_PROP_EX(http_response_object_ce, n, v)
-#define UPD_STATIC_STRL(n, v, l)       UPD_STATIC_STRL_EX(http_response_object_ce, n, v, l)
-
 #define HTTP_BEGIN_ARGS(method, req_args)              HTTP_BEGIN_ARGS_EX(HttpResponse, method, 0, req_args)
 #define HTTP_EMPTY_ARGS(method)                                        HTTP_EMPTY_ARGS_EX(HttpResponse, method, 0)
 #define HTTP_RESPONSE_ME(method, visibility)   PHP_ME(HttpResponse, method, HTTP_ARGS(HttpResponse, method), visibility|ZEND_ACC_STATIC)
@@ -136,11 +131,10 @@ HTTP_END_ARGS;
 HTTP_EMPTY_ARGS(getRequestHeaders);
 HTTP_EMPTY_ARGS(getRequestBody);
 
-#define http_response_object_declare_default_properties() _http_response_object_declare_default_properties(TSRMLS_C)
-static inline void _http_response_object_declare_default_properties(TSRMLS_D);
 #define http_grab_response_headers _http_grab_response_headers
 static void _http_grab_response_headers(void *data, void *arg TSRMLS_DC);
 
+#define OBJ_PROP_CE http_response_object_ce
 zend_class_entry *http_response_object_ce;
 zend_function_entry http_response_object_fe[] = {
 
@@ -199,14 +193,7 @@ zend_function_entry http_response_object_fe[] = {
 PHP_MINIT_FUNCTION(http_response_object)
 {
        HTTP_REGISTER_CLASS(HttpResponse, http_response_object, NULL, 0);
-       http_response_object_declare_default_properties();
-       return SUCCESS;
-}
-
-static inline void _http_response_object_declare_default_properties(TSRMLS_D)
-{
-       zend_class_entry *ce = http_response_object_ce;
-
+       
        DCL_STATIC_PROP(PRIVATE, bool, sent, 0);
        DCL_STATIC_PROP(PRIVATE, bool, catch, 0);
        DCL_STATIC_PROP(PRIVATE, long, mode, -1);
@@ -231,6 +218,8 @@ static inline void _http_response_object_declare_default_properties(TSRMLS_D)
        DCL_CONST(long, "REDIRECT_PROXY", HTTP_REDIRECT_PROXY);
        DCL_CONST(long, "REDIRECT_TEMP", HTTP_REDIRECT_TEMP);
 #endif /* WONKY */
+       
+       return SUCCESS;
 }
 
 static void _http_grab_response_headers(void *data, void *arg TSRMLS_DC)
index f8f3e966f311e4421d607f6029a9f03fb0b75b1a..b327d228770fbb70335776fb3b4ec20038211174 100644 (file)
@@ -195,12 +195,6 @@ PHP_FUNCTION(ob_inflatehandler);
 #endif
 PHP_FUNCTION(http_support);
 
-PHP_MINIT_FUNCTION(http);
-PHP_MSHUTDOWN_FUNCTION(http);
-PHP_RINIT_FUNCTION(http);
-PHP_RSHUTDOWN_FUNCTION(http);
-PHP_MINFO_FUNCTION(http);
-
 #endif /* PHP_HTTP_H */
 
 /*
index 2e575a38d86bc6f9c339c049f7fa44e976050dbe..51b61254533acd62b49e0b0a64d29e149b41a186 100644 (file)
@@ -228,7 +228,6 @@ 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)); \
-               name## _declare_default_properties(); \
        }
 
 #      define HTTP_REGISTER_CLASS(classname, name, parent, flags) \
@@ -255,17 +254,21 @@ 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)-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 DCL_STATIC_PROP(a, t, n, v)              zend_declare_property_ ##t(OBJ_PROP_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(OBJ_PROP_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(OBJ_PROP_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 UPD_STATIC_STRL_EX(ce, n, v, l)  zend_update_static_property_stringl(ce, #n, sizeof(#n)-1, (v), (l) 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)
-#      define DCL_PROP_N(a, n)                                 zend_declare_property_null(ce, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a) TSRMLS_CC)
+#      define GET_STATIC_PROP(n)                               *GET_STATIC_PROP_EX(OBJ_PROP_CE, n)
+#      define UPD_STATIC_PROP(t, n, v)                 UPD_STATIC_PROP_EX(OBJ_PROP_CE, t, n, v)
+#      define SET_STATIC_PROP(n, v)                    SET_STATIC_PROP_EX(OBJ_PROP_CE, n, v)
+#      define UPD_STATIC_STRL(n, v, l)                 UPD_STATIC_STRL_EX(OBJ_PROP_CE, n, v, l)
+
+#      define DCL_PROP(a, t, n, v)                             zend_declare_property_ ##t(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC)
+#      define DCL_PROP_Z(a, n, v)                              zend_declare_property(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC)
+#      define DCL_PROP_N(a, n)                                 zend_declare_property_null(OBJ_PROP_CE, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a) TSRMLS_CC)
 #      define UPD_PROP(t, n, v)                                UPD_PROP_EX(getThis(), t, n, v)
 #      define UPD_PROP_EX(this, t, n, v)               zend_update_property_ ##t(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, (v) TSRMLS_CC)
 #      define UPD_STRL(n, v, l)                                zend_update_property_stringl(OBJ_PROP_CE, getThis(), (#n), sizeof(#n)-1, (v), (l) TSRMLS_CC)
@@ -274,7 +277,7 @@ typedef int STATUS;
 #      define GET_PROP(n)                                              GET_PROP_EX(getThis(), n)
 #      define GET_PROP_EX(this, n)                     zend_read_property(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, 0 TSRMLS_CC)
 
-#      define DCL_CONST(t, n, v) zend_declare_class_constant_ ##t(ce, (n), sizeof(n)-1, (v) TSRMLS_CC)
+#      define DCL_CONST(t, n, v) zend_declare_class_constant_ ##t(OBJ_PROP_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))))