-
Notifications
You must be signed in to change notification settings - Fork 1
/
php_chardet_class.c
92 lines (77 loc) · 2.74 KB
/
php_chardet_class.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
92
/*
* Copyright 2022. JoungKyun.Kim All rights reserved
*
* This file is part of mod_chardet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published
* by the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU LESSER GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* Project: mod_chardet :: Character set detect API
* File: mod_chardet_class.c
*
* Copyright 2022. JoungKyun.Kim All rights reserved
*
* LICENSE: MPL or GPL
*
* @category Charset
* @package mod_chardet
* @author JoungKyun.Kim <http://oops.org>
* @copyright 2022. JoungKyun.Kim
* @license MPL or GPL
* @since File available since release 0.0.1
*/
/*
* PHP5 Charaset Detect library module "chardet"
*/
/* {{{ Class API */
#define Z_CHARDET_P(zv) chardet_fetch_object(Z_OBJ_P(zv))
static inline chardet_obj * chardet_fetch_object (zend_object * obj) {
return (chardet_obj *) ((char *) obj - XtOffsetOf(chardet_obj, std));
}
static void chardet_object_free_storage (zend_object * object) {
chardet_obj * intern = (chardet_obj *) chardet_fetch_object (object);
zend_object_std_dtor (&intern->std);
if ( intern->fp->rsrc )
zend_list_close (intern->fp->rsrc);
}
static void chardet_object_new (zend_class_entry *class_type, zend_object_handlers *handlers, zend_object **retval TSRMLS_DC)
{
chardet_obj * intern;
zval * tmp;
intern = ecalloc (1, sizeof (chardet_obj) + zend_object_properties_size (class_type));
zend_object_std_init (&intern->std,class_type TSRMLS_CC);
handlers->offset = XtOffsetOf(chardet_obj, std);
handlers->free_obj = (zend_object_free_obj_t) chardet_object_free_storage;
intern->std.handlers = handlers;
*retval = &intern->std;
}
static zend_object * chardet_object_new_main (zend_class_entry * class_type TSRMLS_DC) {
zend_object * retval;
chardet_object_new (class_type, &chardet_object_handlers, &retval TSRMLS_CC);
return retval;
}
static zend_object * chardet_object_new_exception (zend_class_entry * class_type TSRMLS_DC) {
zend_object * retval;
chardet_object_new (class_type, &chardet_object_handlers_exception, &retval TSRMLS_CC);
return retval;
}
/* Class API }}} */
/*
* 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
*/