|
1 |
| -/* |
2 |
| - +----------------------------------------------------------------------+ |
3 |
| - | PHP Version 5 | |
4 |
| - +----------------------------------------------------------------------+ |
5 |
| - | Copyright (c) 1997-2015 The PHP Group | |
6 |
| - +----------------------------------------------------------------------+ |
7 |
| - | This source file is subject to version 3.01 of the PHP license, | |
8 |
| - | that is bundled with this package in the file LICENSE, and is | |
9 |
| - | available through the world-wide-web at the following url: | |
10 |
| - | http://www.php.net/license/3_01.txt | |
11 |
| - | If you did not receive a copy of the PHP license and are unable to | |
12 |
| - | obtain it through the world-wide-web, please send a note to | |
13 |
| - | [email protected] so we can mail you a copy immediately. | |
14 |
| - +----------------------------------------------------------------------+ |
15 |
| - | Authors: Payden Sutherland <[email protected]> | |
16 |
| - | Dan Ungureanu <[email protected]> | |
17 |
| - | authors of the `zlib` extension (for guidance) | |
18 |
| - +----------------------------------------------------------------------+ |
19 |
| -*/ |
20 |
| - |
21 |
| -#include <lzma.h> |
| 1 | +/* xz extension for PHP */ |
| 2 | + |
| 3 | +//#include <lzma.h> |
| 4 | +#include "./xz-5.2.4/src/liblzma/api/lzma.h" |
22 | 5 |
|
23 | 6 | #ifdef HAVE_CONFIG_H
|
24 |
| -# include "config.h" |
| 7 | +# include "config.h" |
25 | 8 | #endif
|
26 | 9 |
|
27 | 10 | #include "php.h"
|
28 | 11 | #include "php_ini.h"
|
29 |
| - |
30 | 12 | #include "ext/standard/file.h"
|
31 | 13 | #include "ext/standard/info.h"
|
32 |
| - |
33 | 14 | #include "utils.h"
|
34 |
| - |
35 | 15 | #include "php_xz.h"
|
36 | 16 |
|
| 17 | +/* For compatibility with older PHP versions */ |
| 18 | +#ifndef ZEND_PARSE_PARAMETERS_NONE |
| 19 | +#define ZEND_PARSE_PARAMETERS_NONE() \ |
| 20 | + ZEND_PARSE_PARAMETERS_START(0, 0) \ |
| 21 | + ZEND_PARSE_PARAMETERS_END() |
| 22 | +#endif |
| 23 | + |
37 | 24 | /* {{{ arginfo */
|
38 | 25 | ZEND_BEGIN_ARG_INFO(arginfo_xzread, 0)
|
39 | 26 | ZEND_ARG_INFO(0, fp)
|
@@ -63,46 +50,39 @@ ZEND_BEGIN_ARG_INFO(arginfo_xzdecode, 0)
|
63 | 50 | ZEND_END_ARG_INFO()
|
64 | 51 | /* }}} */
|
65 | 52 |
|
66 |
| -/* {{{ xz_functions[] |
67 |
| - Table containing functions exported by this module. */ |
68 |
| -const zend_function_entry xz_functions[] = { |
| 53 | +/* {{{ xz_functions[] */ |
| 54 | +static const zend_function_entry xz_functions[] = { |
69 | 55 | PHP_FE(xzdecode, NULL)
|
70 | 56 | PHP_FE(xzopen, NULL)
|
71 | 57 | PHP_FE(xzencode, NULL)
|
72 | 58 | PHP_FALIAS(xzread, fread, arginfo_xzread)
|
73 | 59 | PHP_FALIAS(xzwrite, fwrite, arginfo_xzwrite)
|
74 | 60 | PHP_FALIAS(xzclose, fclose, arginfo_xzclose)
|
75 | 61 | PHP_FALIAS(xzpassthru, fpassthru, arginfo_xzpassthru)
|
76 |
| -#ifndef PHP_FE_END |
77 |
| - { NULL, NULL, NULL, 0, 0 } |
78 |
| -#else |
79 | 62 | PHP_FE_END
|
80 |
| -#endif |
81 | 63 | };
|
82 | 64 | /* }}} */
|
83 | 65 |
|
84 |
| -/* {{{ xz_module_entry |
85 |
| - Table describing module. */ |
| 66 | +/* {{{ xz_module_entry */ |
86 | 67 | zend_module_entry xz_module_entry = {
|
87 |
| -#if ZEND_MODULE_API_NO >= 20010901 |
88 | 68 | STANDARD_MODULE_HEADER,
|
89 |
| -#endif |
90 | 69 | "xz",
|
91 | 70 | xz_functions,
|
92 | 71 | PHP_MINIT(xz),
|
93 | 72 | PHP_MSHUTDOWN(xz),
|
94 | 73 | NULL, /* PHP_RINIT */
|
95 | 74 | NULL, /* PHP_RSHUTDOWN */
|
96 | 75 | PHP_MINFO(xz),
|
97 |
| -#if ZEND_MODULE_API_NO >= 20010901 |
98 |
| - "0.1.1", |
99 |
| -#endif |
| 76 | + PHP_XZ_VERSION, |
100 | 77 | STANDARD_MODULE_PROPERTIES
|
101 | 78 | };
|
102 | 79 | /* }}} */
|
103 | 80 |
|
104 | 81 | #ifdef COMPILE_DL_XZ
|
105 |
| - ZEND_GET_MODULE(xz) |
| 82 | +# ifdef ZTS |
| 83 | +ZEND_TSRMLS_CACHE_DEFINE() |
| 84 | +# endif |
| 85 | +ZEND_GET_MODULE(xz) |
106 | 86 | #endif
|
107 | 87 |
|
108 | 88 | /* {{{ INI entries. */
|
|
0 commit comments