diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-06 19:48:30 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-06 19:48:30 +0200 |
commit | 5e18247595e73491796ebeb2e3ac5f2e8af5042b (patch) | |
tree | 8af5b978c73384b67e32a1daee21c03c4174d95b /src/base.cpp | |
parent | 9bc5d1ed595e0ff0b7cec9a87d06a7923c211ebd (diff) |
refactored code, so that there is no zend engine dependency left in base.h header file
Diffstat (limited to 'src/base.cpp')
-rw-r--r-- | src/base.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/src/base.cpp b/src/base.cpp index a828083..5d15011 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -18,61 +18,61 @@ namespace Php { * @param tsrm_ls * @return MixedObject */ -MixedObject *Base::store(zend_class_entry *entry TSRMLS_DC) -{ - // allocate memory for the object - MixedObject *result = (MixedObject *)emalloc(sizeof(MixedObject)); - - // store the new c++ object - result->cpp = this; - - // store the class entry in the newly created object - result->php.ce = entry; - - // initialize the object - zend_object_std_init(&result->php, entry TSRMLS_CC); - -#if PHP_VERSION_ID < 50399 - - // tmp variable - zval *tmp; - - // initialize the properties, php 5.3 way - zend_hash_copy(result->php.properties, &entry->default_properties, (copy_ctor_func_t) zval_property_ctor, &tmp, sizeof(zval*)); - -#else - - // version higher than 5.3 have an easier way to initialize - object_properties_init(&result->php, entry); - -#endif - -#ifdef ZTS - - // when in thread safety mode, the destruct method and free method have - // an extra parameter holding thread information - using DestructType = void(zend_object*,unsigned int,void***); - using FreeType = void(zend_object*,void***); - -#else - - // not in thread mode: no special parameter for the tsrm_ls variable - using DestructType = void(zend_object*,unsigned int); - using FreeType = void(zend_object*); - -#endif - - // store the two destruct methods in temporary vars - DestructType *destructMethod = &ClassImpl::destructObject; - FreeType *freeMethod = &ClassImpl::freeObject; - - // the destructor and clone handlers are set to NULL. I dont know why, but they do not - // seem to be necessary... - _handle = zend_objects_store_put(result, (zend_objects_store_dtor_t)destructMethod, (zend_objects_free_object_storage_t)freeMethod, NULL TSRMLS_CC); - - // done - return result; -} +//MixedObject *Base::store(zend_class_entry *entry TSRMLS_DC) +//{ +// // allocate memory for the object +// MixedObject *result = (MixedObject *)emalloc(sizeof(MixedObject)); +// +// // store the new c++ object +// result->cpp = this; +// +// // store the class entry in the newly created object +// result->php.ce = entry; +// +// // initialize the object +// zend_object_std_init(&result->php, entry TSRMLS_CC); +// +//#if PHP_VERSION_ID < 50399 +// +// // tmp variable +// zval *tmp; +// +// // initialize the properties, php 5.3 way +// zend_hash_copy(result->php.properties, &entry->default_properties, (copy_ctor_func_t) zval_property_ctor, &tmp, sizeof(zval*)); +// +//#else +// +// // version higher than 5.3 have an easier way to initialize +// object_properties_init(&result->php, entry); +// +//#endif +// +//#ifdef ZTS +// +// // when in thread safety mode, the destruct method and free method have +// // an extra parameter holding thread information +// using DestructType = void(zend_object*,unsigned int,void***); +// using FreeType = void(zend_object*,void***); +// +//#else +// +// // not in thread mode: no special parameter for the tsrm_ls variable +// using DestructType = void(zend_object*,unsigned int); +// using FreeType = void(zend_object*); +// +//#endif +// +// // store the two destruct methods in temporary vars +// DestructType *destructMethod = &ClassImpl::destructObject; +// FreeType *freeMethod = &ClassImpl::freeObject; +// +// // the destructor and clone handlers are set to NULL. I dont know why, but they do not +// // seem to be necessary... +// _handle = zend_objects_store_put(result, (zend_objects_store_dtor_t)destructMethod, (zend_objects_free_object_storage_t)freeMethod, NULL TSRMLS_CC); +// +// // done +// return result; +//} /** * Overridable method that is called right before an object is destructed |