-
Notifications
You must be signed in to change notification settings - Fork 19
/
cairo_path.c
91 lines (76 loc) · 2.83 KB
/
cairo_path.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Elizabeth Smith <[email protected]> |
| Michael Maclean <[email protected]> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_cairo.h"
zend_class_entry *cairo_ce_cairopath;
static void cairo_path_object_destroy(void *object TSRMLS_DC)
{
cairo_path_object *path = (cairo_path_object *)object;
zend_hash_destroy(path->std.properties);
FREE_HASHTABLE(path->std.properties);
if(path->path){
cairo_path_destroy(path->path);
}
efree(object);
}
static zend_object_value cairo_path_object_new(zend_class_entry *ce TSRMLS_DC)
{
zend_object_value retval;
cairo_path_object *path;
#if PHP_VERSION_ID < 50399
zval *temp;
#endif
path = ecalloc(1, sizeof(cairo_path_object));
path->std.ce = ce;
path->path = NULL;
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;
}
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(cairo_path)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "CairoPath", NULL);
cairo_ce_cairopath = zend_register_internal_class(&ce TSRMLS_CC);
cairo_ce_cairopath->create_object = cairo_path_object_new;
return SUCCESS;
}
PHP_CAIRO_API zend_class_entry* php_cairo_get_path_ce()
{
return cairo_ce_cairopath;
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/