X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_object.c;h=9024ee9a47b53a4d757cead7afc3c4c765d48a4b;hb=b2773ab559878238bd024c4bbebe5825cc38ad85;hp=d2ff6493149fdc0387d0a7413f3f468efbe5a25b;hpb=7096ff6dbb61fd13b9b04ef86bfbece8fb4b2ea0;p=m6w6%2Fext-http diff --git a/php_http_object.c b/php_http_object.c index d2ff649..9024ee9 100644 --- a/php_http_object.c +++ b/php_http_object.c @@ -12,6 +12,8 @@ #include "php_http_api.h" +static zend_object_handlers php_http_object_handlers; + zend_object *php_http_object_new(zend_class_entry *ce) { return &php_http_object_new_ex(ce, NULL)->zo; @@ -26,11 +28,17 @@ php_http_object_t *php_http_object_new_ex(zend_class_entry *ce, void *intern) object_properties_init(&o->zo, ce); o->intern = intern; - o->zo.handlers = zend_get_std_object_handlers(); + o->zo.handlers = &php_http_object_handlers; return o; } +void php_http_object_free(zend_object *object) +{ + php_http_object_t *obj = PHP_HTTP_OBJ(object, NULL); + zend_object_std_dtor(object); +} + ZEND_RESULT_CODE php_http_new(void **obj_ptr, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr) { void *obj; @@ -75,6 +83,14 @@ ZEND_RESULT_CODE php_http_method_call(zval *object, const char *method_str, size return rv; } +PHP_MINIT_FUNCTION(http_object) +{ + memcpy(&php_http_object_handlers, zend_get_std_object_handlers(), sizeof(php_http_object_handlers)); + php_http_object_handlers.offset = XtOffsetOf(php_http_object_t, zo); + + return SUCCESS; +} + /* * Local variables: * tab-width: 4