Skip to content
Browse files

Use object_properties_init() instead of zend_hash_copy()

  • Loading branch information...
1 parent 3df3bad commit 3b352111ec9023aa5d1b8e2c7ec829e23ea30af5 @mahcuz mahcuz committed
Showing with 41 additions and 1 deletion.
  1. +4 −0 cairo_context.c
  2. +4 −0 cairo_font_face.c
  3. +4 −0 cairo_font_options.c
  4. +4 −0 cairo_ft_font.c
  5. +4 −0 cairo_matrix.c
  6. +5 −1 cairo_path.c
  7. +4 −0 cairo_pattern.c
  8. +4 −0 cairo_scaled_font.c
  9. +4 −0 cairo_surface.c
  10. +4 −0 cairo_win32_font.c
View
4 cairo_context.c
@@ -2948,7 +2948,11 @@ static zend_object_value cairo_context_object_new(zend_class_entry *ce TSRMLS_DC
ALLOC_HASHTABLE(context->std.properties);
zend_hash_init(context->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(context->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&context->std, ce);
+#endif
retval.handle = zend_objects_store_put(context, NULL, (zend_objects_free_object_storage_t)cairo_context_object_destroy, NULL TSRMLS_CC);
retval.handlers = &cairo_std_object_handlers;
return retval;
View
4 cairo_font_face.c
@@ -124,7 +124,11 @@ zend_object_value cairo_font_face_object_new(zend_class_entry *ce TSRMLS_DC)
ALLOC_HASHTABLE(font_face->std.properties);
zend_hash_init(font_face->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(font_face->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&font_face->std, ce);
+#endif
retval.handle = zend_objects_store_put(font_face, NULL, (zend_objects_free_object_storage_t)cairo_font_face_object_destroy, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
View
4 cairo_font_options.c
@@ -82,7 +82,11 @@ static zend_object_value cairo_font_options_object_new(zend_class_entry *ce TSRM
ALLOC_HASHTABLE(font_options->std.properties);
zend_hash_init(font_options->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(font_options->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&font_options->std, ce);
+#endif
retval.handle = zend_objects_store_put(font_options, NULL, (zend_objects_free_object_storage_t)cairo_font_options_object_destroy, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
View
4 cairo_ft_font.c
@@ -340,7 +340,11 @@ zend_object_value cairo_ft_font_face_object_new(zend_class_entry *ce TSRMLS_DC)
ALLOC_HASHTABLE(font_face->std.properties);
zend_hash_init(font_face->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(font_face->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&font_face->std, ce);
+#endif
retval.handle = zend_objects_store_put(font_face, NULL, (zend_objects_free_object_storage_t)cairo_ft_font_face_object_destroy, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
View
4 cairo_matrix.c
@@ -532,7 +532,11 @@ static zend_object_value cairo_matrix_object_new(zend_class_entry *ce TSRMLS_DC)
ALLOC_HASHTABLE(matrix->std.properties);
zend_hash_init(matrix->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(matrix->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&matrix->std, ce);
+#endif
retval.handle = zend_objects_store_put(matrix, NULL, (zend_objects_free_object_storage_t)cairo_matrix_object_destroy, NULL TSRMLS_CC);
retval.handlers = &cairo_matrix_object_handlers;
return retval;
View
6 cairo_path.c
@@ -54,7 +54,11 @@ static zend_object_value cairo_path_object_new(zend_class_entry *ce TSRMLS_DC)
ALLOC_HASHTABLE(path->std.properties);
zend_hash_init(path->std.properties, 0, NULL, ZVAL_PTR_DTOR,0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(path->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&path->std, ce);
+#endif
retval.handle = zend_objects_store_put(path, NULL, (zend_objects_free_object_storage_t)cairo_path_object_destroy, NULL TSRMLS_CC);
retval.handlers = &cairo_std_object_handlers;
return retval;
@@ -85,4 +89,4 @@ PHP_CAIRO_API zend_class_entry* php_cairo_get_path_ce()
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
- */
+ */
View
4 cairo_pattern.c
@@ -921,7 +921,11 @@ static zend_object_value cairo_pattern_object_new(zend_class_entry *ce TSRMLS_DC
ALLOC_HASHTABLE(pattern->std.properties);
zend_hash_init(pattern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(pattern->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&pattern->std, ce);
+#endif
retval.handle = zend_objects_store_put(pattern, NULL, (zend_objects_free_object_storage_t)cairo_pattern_object_destroy, NULL TSRMLS_CC);
retval.handlers = &cairo_std_object_handlers;
return retval;
View
4 cairo_scaled_font.c
@@ -523,7 +523,11 @@ static zend_object_value cairo_scaled_font_object_new(zend_class_entry *ce TSRML
ALLOC_HASHTABLE(scaled_font->std.properties);
zend_hash_init(scaled_font->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(scaled_font->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&scaled_font->std, ce);
+#endif
retval.handle = zend_objects_store_put(scaled_font, NULL, (zend_objects_free_object_storage_t)cairo_scaled_font_object_destroy, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
View
4 cairo_surface.c
@@ -562,7 +562,11 @@ zend_object_value cairo_surface_object_new(zend_class_entry *ce TSRMLS_DC)
ALLOC_HASHTABLE(surface->std.properties);
zend_hash_init(surface->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(surface->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+#else
+ object_properties_init(&surface->std, ce);
+#endif
retval.handle = zend_objects_store_put(surface, NULL, (zend_objects_free_object_storage_t)cairo_surface_object_destroy, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
View
4 cairo_win32_font.c
@@ -280,12 +280,16 @@ zend_object_value cairo_win32_font_face_create_new(zend_class_entry *ce TSRMLS_D
ALLOC_HASHTABLE(font_face->std.properties);
zend_hash_init(font_face->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(
font_face->std.properties,
&ce->default_properties,
(copy_ctor_func_t) zval_add_ref,(void *)
&temp, sizeof(zval *)
);
+#else
+ object_properties_init(&font_face->std, ce);
+#endif
retval.handle = zend_objects_store_put(
font_face, NULL,
(zend_objects_free_object_storage_t)cairo_win32_font_face_object_destroy,

0 comments on commit 3b35211

Please sign in to comment.
Something went wrong with that request. Please try again.