Merge pull request #3655 from onikitenko/vsftpd-fix
[feed/packages.git] / lang / php7-pecl-dio / patches / 0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch
1 From 760ec7072cbba2cbbb6e4e17b0c54ee3c7b661a8 Mon Sep 17 00:00:00 2001
2 From: Michael Heimpold <mhei@heimpold.de>
3 Date: Thu, 14 Jul 2016 00:59:42 +0200
4 Subject: [PATCH 12/16] Remove ancient macros TSRMLS_CC and TSRMLS_DC
5
6 Signed-off-by: Michael Heimpold <mhei@heimpold.de>
7 ---
8 dio.c | 70 +++++++++++++++++++++++++--------------------------
9 dio_common.c | 8 +++---
10 dio_posix.c | 22 ++++++++--------
11 dio_stream_wrappers.c | 48 +++++++++++++++++------------------
12 dio_win32.c | 46 ++++++++++++++++-----------------
13 php_dio_common.h | 12 ++++-----
14 6 files changed, 103 insertions(+), 103 deletions(-)
15
16 diff --git a/dio.c b/dio.c
17 index b489747..7bad575 100644
18 --- a/dio.c
19 +++ b/dio.c
20 @@ -93,11 +93,11 @@ PHP_FUNCTION(dio_open)
21 long mode = 0;
22 int fd;
23
24 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
25 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
26 return;
27 }
28
29 - if (php_check_open_basedir(file_name TSRMLS_CC) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) {
30 + if (php_check_open_basedir(file_name) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) {
31 RETURN_FALSE;
32 }
33
34 @@ -108,7 +108,7 @@ PHP_FUNCTION(dio_open)
35 }
36
37 if (fd == -1) {
38 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno));
39 + php_error_docref(NULL, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno));
40 RETURN_FALSE;
41 }
42
43 @@ -130,14 +130,14 @@ PHP_FUNCTION(dio_fdopen)
44 long lfd;
45 int fd;
46
47 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lfd) == FAILURE) {
48 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &lfd) == FAILURE) {
49 return;
50 }
51
52 fd = (int)lfd;
53
54 if ((fcntl(fd, F_GETFL, 0) == -1) && (errno == EBADF)) {
55 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad file descriptor %d", fd);
56 + php_error_docref(NULL, E_WARNING, "Bad file descriptor %d", fd);
57 RETURN_FALSE;
58 }
59
60 @@ -158,7 +158,7 @@ PHP_FUNCTION(dio_dup)
61 php_fd_t *f, *df;
62 int dfd;
63
64 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
65 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) {
66 return;
67 }
68
69 @@ -168,7 +168,7 @@ PHP_FUNCTION(dio_dup)
70
71 dfd = dup(f->fd);
72 if (dfd == -1) {
73 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno));
74 + php_error_docref(NULL, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno));
75 RETURN_FALSE;
76 }
77
78 @@ -191,7 +191,7 @@ PHP_FUNCTION(dio_read)
79 long bytes = 1024;
80 ssize_t res;
81
82 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &r_fd, &bytes) == FAILURE) {
83 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &r_fd, &bytes) == FAILURE) {
84 return;
85 }
86
87 @@ -200,7 +200,7 @@ PHP_FUNCTION(dio_read)
88 }
89
90 if (bytes <= 0) {
91 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
92 + php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0.");
93 RETURN_FALSE;
94 }
95
96 @@ -229,12 +229,12 @@ PHP_FUNCTION(dio_write)
97 long trunc_len = 0;
98 ssize_t res;
99
100 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
101 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
102 return;
103 }
104
105 if (trunc_len < 0 || trunc_len > data_len) {
106 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string.");
107 + php_error_docref(NULL, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string.");
108 RETURN_FALSE;
109 }
110
111 @@ -244,7 +244,7 @@ PHP_FUNCTION(dio_write)
112
113 res = write(f->fd, data, trunc_len ? trunc_len : data_len);
114 if (res == -1) {
115 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno));
116 + php_error_docref(NULL, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno));
117 }
118
119 RETURN_LONG(res);
120 @@ -261,7 +261,7 @@ PHP_FUNCTION(dio_truncate)
121 php_fd_t *f;
122 long offset;
123
124 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &r_fd, &offset) == FAILURE) {
125 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &r_fd, &offset) == FAILURE) {
126 return;
127 }
128
129 @@ -270,7 +270,7 @@ PHP_FUNCTION(dio_truncate)
130 }
131
132 if (ftruncate(f->fd, offset) == -1) {
133 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno));
134 + php_error_docref(NULL, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno));
135 RETURN_FALSE;
136 }
137
138 @@ -289,7 +289,7 @@ PHP_FUNCTION(dio_stat)
139 php_fd_t *f;
140 struct stat s;
141
142 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
143 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) {
144 return;
145 }
146
147 @@ -298,7 +298,7 @@ PHP_FUNCTION(dio_stat)
148 }
149
150 if (fstat(f->fd, &s) == -1) {
151 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno));
152 + php_error_docref(NULL, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno));
153 RETURN_FALSE;
154 }
155
156 @@ -330,7 +330,7 @@ PHP_FUNCTION(dio_seek)
157 long offset;
158 long whence = SEEK_SET;
159
160 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &r_fd, &offset, &whence) == FAILURE) {
161 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &r_fd, &offset, &whence) == FAILURE) {
162 return;
163 }
164
165 @@ -353,7 +353,7 @@ PHP_FUNCTION(dio_fcntl)
166 php_fd_t *f;
167 long cmd;
168
169 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &r_fd, &cmd, &arg) == FAILURE) {
170 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z", &r_fd, &cmd, &arg) == FAILURE) {
171 return;
172 }
173
174 @@ -369,7 +369,7 @@ PHP_FUNCTION(dio_fcntl)
175 HashTable *fh;
176
177 if (!arg) {
178 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, none given");
179 + php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, none given");
180 RETURN_FALSE;
181 }
182 if (Z_TYPE_P(arg) == IS_ARRAY) {
183 @@ -403,7 +403,7 @@ PHP_FUNCTION(dio_fcntl)
184 lk.l_whence = SEEK_SET;
185 lk.l_type = Z_LVAL_P(arg);
186 } else {
187 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg));
188 + php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg));
189 RETURN_FALSE;
190 }
191
192 @@ -428,7 +428,7 @@ PHP_FUNCTION(dio_fcntl)
193 php_fd_t *new_f;
194
195 if (!arg || Z_TYPE_P(arg) != IS_LONG) {
196 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
197 + php_error_docref(NULL, E_WARNING, "expects argument 3 to be int");
198 RETURN_FALSE;
199 }
200
201 @@ -440,7 +440,7 @@ PHP_FUNCTION(dio_fcntl)
202 }
203 default:
204 if (!arg || Z_TYPE_P(arg) != IS_LONG) {
205 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
206 + php_error_docref(NULL, E_WARNING, "expects argument 3 to be int");
207 RETURN_FALSE;
208 }
209
210 @@ -465,7 +465,7 @@ PHP_FUNCTION(dio_tcsetattr)
211 HashTable *fh;
212 zval *element;
213
214 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) {
215 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &r_fd, &arg) == FAILURE) {
216 return;
217 }
218
219 @@ -474,7 +474,7 @@ PHP_FUNCTION(dio_tcsetattr)
220 }
221
222 if (Z_TYPE_P(arg) != IS_ARRAY) {
223 - php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array");
224 + php_error_docref(NULL, E_WARNING,"tcsetattr, third argument should be an associative array");
225 return;
226 }
227
228 @@ -564,7 +564,7 @@ PHP_FUNCTION(dio_tcsetattr)
229 BAUD = B50;
230 break;
231 default:
232 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid baud rate %d", Baud_Rate);
233 + php_error_docref(NULL, E_WARNING, "invalid baud rate %d", Baud_Rate);
234 RETURN_FALSE;
235 }
236 switch (Data_Bits) {
237 @@ -581,7 +581,7 @@ PHP_FUNCTION(dio_tcsetattr)
238 DATABITS = CS5;
239 break;
240 default:
241 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data bits %d", Data_Bits);
242 + php_error_docref(NULL, E_WARNING, "invalid data bits %d", Data_Bits);
243 RETURN_FALSE;
244 }
245 switch (Stop_Bits) {
246 @@ -592,7 +592,7 @@ PHP_FUNCTION(dio_tcsetattr)
247 STOPBITS = CSTOPB;
248 break;
249 default:
250 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop bits %d", Stop_Bits);
251 + php_error_docref(NULL, E_WARNING, "invalid stop bits %d", Stop_Bits);
252 RETURN_FALSE;
253 }
254
255 @@ -610,7 +610,7 @@ PHP_FUNCTION(dio_tcsetattr)
256 PARITY = 0;
257 break;
258 default:
259 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity %d", Parity);
260 + php_error_docref(NULL, E_WARNING, "invalid parity %d", Parity);
261 RETURN_FALSE;
262 }
263
264 @@ -652,7 +652,7 @@ PHP_FUNCTION(dio_close)
265 zval *r_fd;
266 php_fd_t *f;
267
268 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
269 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) {
270 return;
271 }
272
273 @@ -669,7 +669,7 @@ PHP_FUNCTION(dio_close)
274 /* {{{ dio_init_legacy_defines
275 * Initialises the legacy PHP defines
276 */
277 -static void dio_init_legacy_defines(int module_number TSRMLS_DC) {
278 +static void dio_init_legacy_defines(int module_number) {
279 RDIOC(O_RDONLY);
280 RDIOC(O_WRONLY);
281 RDIOC(O_RDWR);
282 @@ -852,11 +852,11 @@ PHP_MINIT_FUNCTION(dio)
283 /* Legacy resource destructor. */
284 le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number);
285
286 - dio_init_legacy_defines(module_number TSRMLS_CC);
287 + dio_init_legacy_defines(module_number);
288
289 /* Register the stream wrappers */
290 - return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper TSRMLS_CC) == SUCCESS &&
291 - php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE;
292 + return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper) == SUCCESS &&
293 + php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper) == SUCCESS) ? SUCCESS : FAILURE;
294 }
295 /* }}} */
296
297 @@ -864,8 +864,8 @@ PHP_MINIT_FUNCTION(dio)
298 */
299 PHP_MSHUTDOWN_FUNCTION(dio)
300 {
301 - return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME TSRMLS_CC) == SUCCESS &&
302 - php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE;
303 + return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME) == SUCCESS &&
304 + php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME) == SUCCESS) ? SUCCESS : FAILURE;
305 }
306 /* }}} */
307
308 diff --git a/dio_common.c b/dio_common.c
309 index a5f4c63..d09c0ec 100644
310 --- a/dio_common.c
311 +++ b/dio_common.c
312 @@ -55,7 +55,7 @@ void dio_init_stream_data(php_dio_stream_data *data) {
313 /* {{{ dio_assoc_array_get_basic_options
314 * Retrieves the basic open option values from an associative array
315 */
316 -void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC) {
317 +void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data) {
318 #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK)
319 zval *tmpzval;
320 HashTable *opthash;
321 @@ -98,7 +98,7 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data
322 /* {{{ dio_assoc_array_get_serial_options
323 * Retrieves the serial open option values from an associative array
324 */
325 -void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC) {
326 +void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data) {
327 zval *tmpzval;
328 HashTable *opthash;
329
330 @@ -133,7 +133,7 @@ void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data
331 /* {{{ dio_stream_context_get_raw_options
332 * Extracts the option values for dio.raw mode from a context
333 */
334 -void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) {
335 +void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data) {
336 #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK)
337 zval *tmpzval;
338 #endif
339 @@ -173,7 +173,7 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s
340 /* {{{ dio_stream_context_get_serial_options
341 * Extracts the option values for dio.serial mode from a context
342 */
343 -void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) {
344 +void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data) {
345 zval *tmpzval;
346
347 if ((tmpzval = php_stream_context_get_option(context, "dio", "data_rate")) != NULL) {
348 diff --git a/dio_posix.c b/dio_posix.c
349 index 527d683..843e234 100644
350 --- a/dio_posix.c
351 +++ b/dio_posix.c
352 @@ -474,7 +474,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void
353 /* {{{ dio_raw_open_stream
354 * Opens the underlying stream.
355 */
356 -int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
357 +int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) {
358 php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
359 pdata->flags = dio_stream_mode_to_flags(mode);
360
361 @@ -498,7 +498,7 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
362 if (pdata->fd < 0) {
363 switch (errno) {
364 case EEXIST:
365 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
366 + php_error_docref(NULL, E_WARNING, "File exists!");
367 return 0;
368 default:
369 return 0;
370 @@ -512,36 +512,36 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
371 /* {{{ dio_serial_init
372 * Initialises the serial settings storing the original settings before hand.
373 */
374 -static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
375 +static int dio_serial_init(php_dio_stream_data *data) {
376 php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
377 int ret = 0, data_bits_def, stop_bits_def, parity_def;
378 struct termios tio;
379 speed_t rate_def;
380
381 if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
382 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate);
383 + php_error_docref(NULL, E_WARNING, "invalid data_rate value (%ld)", data->data_rate);
384 return 0;
385 }
386
387 if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
388 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
389 + php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
390 return 0;
391 }
392
393 if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
394 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
395 + php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
396 return 0;
397 }
398
399 if (!dio_parity_to_define(data->parity, &parity_def)) {
400 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
401 + php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity);
402 return 0;
403 }
404
405 ret = tcgetattr(pdata->fd, &(pdata->oldtio));
406 if (ret < 0) {
407 if ((errno == ENOTTY) || (errno == ENODEV)) {
408 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!");
409 + php_error_docref(NULL, E_WARNING, "Not a serial port or terminal!");
410 }
411 return 0;
412 }
413 @@ -632,7 +632,7 @@ int dio_serial_purge(php_dio_stream_data *data) {
414 /* {{{ dio_serial_open_stream
415 * Opens the underlying stream.
416 */
417 -int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
418 +int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) {
419 php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
420
421 #ifdef O_NOCTTY
422 @@ -640,11 +640,11 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data
423 pdata->flags |= O_NOCTTY;
424 #endif
425
426 - if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
427 + if (!dio_raw_open_stream(filename, mode, data)) {
428 return 0;
429 }
430
431 - if (!dio_serial_init(data TSRMLS_CC)) {
432 + if (!dio_serial_init(data)) {
433 close(pdata->fd);
434 return 0;
435 }
436 diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c
437 index 817b0d1..eb23752 100644
438 --- a/dio_stream_wrappers.c
439 +++ b/dio_stream_wrappers.c
440 @@ -36,7 +36,7 @@
441 /* {{{ dio_stream_write
442 * Write to the stream
443 */
444 -static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
445 +static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count)
446 {
447 return dio_common_write((php_dio_stream_data*)stream->abstract, buf, count);
448 }
449 @@ -45,7 +45,7 @@ static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count
450 /* {{{ dio_stream_read
451 * Read from the stream
452 */
453 -static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
454 +static size_t dio_stream_read(php_stream *stream, char *buf, size_t count)
455 {
456 php_dio_stream_data* data = (php_dio_stream_data*)stream->abstract;
457 size_t bytes = dio_common_read(data, buf, count);
458 @@ -58,7 +58,7 @@ static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS
459 /* {{{ dio_stream_flush
460 * Flush the stream. For raw streams this does nothing.
461 */
462 -static int dio_stream_flush(php_stream *stream TSRMLS_DC)
463 +static int dio_stream_flush(php_stream *stream)
464 {
465 return 1;
466 }
467 @@ -67,7 +67,7 @@ static int dio_stream_flush(php_stream *stream TSRMLS_DC)
468 /* {{{ dio_stream_close
469 * Close the stream
470 */
471 -static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
472 +static int dio_stream_close(php_stream *stream, int close_handle)
473 {
474 php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract;
475
476 @@ -83,7 +83,7 @@ static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
477 /* {{{ dio_stream_set_option
478 * Set the stream options.
479 */
480 -static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
481 +static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam)
482 {
483 php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract;
484
485 @@ -143,7 +143,7 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper,
486 filename = path + sizeof(DIO_RAW_STREAM_PROTOCOL) - 1;
487
488 /* Check we can actually access it. */
489 - if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
490 + if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
491 return NULL;
492 }
493
494 @@ -152,11 +152,11 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper,
495
496 /* Parse the context. */
497 if (context) {
498 - dio_stream_context_get_basic_options(context, data TSRMLS_CC);
499 + dio_stream_context_get_basic_options(context, data);
500 }
501
502 /* Try and open a raw stream. */
503 - if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
504 + if (!dio_raw_open_stream(filename, mode, data)) {
505 return NULL;
506 }
507
508 @@ -199,7 +199,7 @@ PHP_FUNCTION(dio_raw) {
509 char *mode;
510 int mode_len;
511
512 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
513 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
514 RETURN_FALSE;
515 }
516
517 @@ -209,7 +209,7 @@ PHP_FUNCTION(dio_raw) {
518 }
519
520 /* Check we can actually access the file. */
521 - if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
522 + if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
523 RETURN_FALSE;
524 }
525
526 @@ -217,11 +217,11 @@ PHP_FUNCTION(dio_raw) {
527 data->stream_type = DIO_STREAM_TYPE_RAW;
528
529 if (options) {
530 - dio_assoc_array_get_basic_options(options, data TSRMLS_CC);
531 + dio_assoc_array_get_basic_options(options, data);
532 }
533
534 /* Try and open a raw stream. */
535 - if (dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
536 + if (dio_raw_open_stream(filename, mode, data)) {
537 stream = php_stream_alloc(&dio_raw_stream_ops, data, 0, mode);
538 if (!stream) {
539 (void) dio_common_close(data);
540 @@ -244,7 +244,7 @@ PHP_FUNCTION(dio_raw) {
541 * stream, if it is write only it flushes the write, otherwise it flushes
542 * both.
543 */
544 -static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC)
545 +static int dio_serial_stream_flush(php_stream *stream)
546 {
547 return dio_serial_purge((php_dio_stream_data*)stream->abstract);
548 }
549 @@ -254,7 +254,7 @@ static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC)
550 * Close the stream. Restores the serial settings to their value before
551 * the stream was open.
552 */
553 -static int dio_serial_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
554 +static int dio_serial_stream_close(php_stream *stream, int close_handle)
555 {
556 php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract;
557
558 @@ -304,7 +304,7 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper,
559 filename = path + sizeof(DIO_SERIAL_STREAM_PROTOCOL) - 1;
560
561 /* Check we can actually access it. */
562 - if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
563 + if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
564 return NULL;
565 }
566
567 @@ -313,12 +313,12 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper,
568
569 /* Parse the context. */
570 if (context) {
571 - dio_stream_context_get_basic_options(context, data TSRMLS_CC);
572 - dio_stream_context_get_serial_options(context, data TSRMLS_CC);
573 + dio_stream_context_get_basic_options(context, data);
574 + dio_stream_context_get_serial_options(context, data);
575 }
576
577 /* Try and open a serial stream. */
578 - if (!dio_serial_open_stream(filename, mode, data TSRMLS_CC)) {
579 + if (!dio_serial_open_stream(filename, mode, data)) {
580 return NULL;
581 }
582
583 @@ -359,18 +359,18 @@ PHP_FUNCTION(dio_serial) {
584 char *mode;
585 int mode_len;
586
587 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
588 + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
589 RETURN_FALSE;
590 }
591
592 /* Check the third argument is an array. */
593 if (options && (Z_TYPE_P(options) != IS_ARRAY)) {
594 - php_error_docref(NULL TSRMLS_CC, E_WARNING,"dio_serial, the third argument should be an array of options");
595 + php_error_docref(NULL, E_WARNING,"dio_serial, the third argument should be an array of options");
596 RETURN_FALSE;
597 }
598
599 /* Check we can actually access the file. */
600 - if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
601 + if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
602 RETURN_FALSE;
603 }
604
605 @@ -378,12 +378,12 @@ PHP_FUNCTION(dio_serial) {
606 data->stream_type = DIO_STREAM_TYPE_SERIAL;
607
608 if (options) {
609 - dio_assoc_array_get_basic_options(options, data TSRMLS_CC);
610 - dio_assoc_array_get_serial_options(options, data TSRMLS_CC);
611 + dio_assoc_array_get_basic_options(options, data);
612 + dio_assoc_array_get_serial_options(options, data);
613 }
614
615 /* Try and open a serial stream. */
616 - if (dio_serial_open_stream(filename, mode, data TSRMLS_CC)) {
617 + if (dio_serial_open_stream(filename, mode, data)) {
618 stream = php_stream_alloc(&dio_serial_stream_ops, data, 0, mode);
619 if (!stream) {
620 efree(data);
621 diff --git a/dio_win32.c b/dio_win32.c
622 index 1023d36..25c838a 100644
623 --- a/dio_win32.c
624 +++ b/dio_win32.c
625 @@ -30,7 +30,7 @@
626 /* {{{ dio_last_error_php_error
627 * Generates a PHP error message based upon the last Windows error.
628 */
629 -static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
630 +static void dio_last_error_php_error(int level, char * message) {
631 LPVOID msgbuf;
632 DWORD msgbuflen;
633 char * errmsg;
634 @@ -68,7 +68,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
635 /* Allocate a buffer */
636 errmsg = emalloc(errmsglen);
637 if (!errmsg) {
638 - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!");
639 + php_error_docref(NULL, E_ERROR, "Out of memory in dio_last_error_php_error()!");
640 LocalFree(msgbuf);
641 return;
642 }
643 @@ -88,7 +88,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
644 errmsg = (char *)msgbuf;
645 #endif
646
647 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg);
648 + php_error_docref(NULL, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg);
649
650 LocalFree(msgbuf);
651 #ifdef UNICODE
652 @@ -505,7 +505,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void
653 /* {{{ dio_raw_open_stream
654 * Opens the underlying stream.
655 */
656 -int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
657 +int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) {
658 php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
659 DWORD err;
660
661 @@ -543,29 +543,29 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
662 err = GetLastError();
663 switch (err) {
664 case ERROR_FILE_EXISTS:
665 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
666 + php_error_docref(NULL, E_WARNING, "File exists!");
667 return 0;
668
669 case ERROR_FILE_NOT_FOUND:
670 /* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that
671 * the file doesn't exist so now try to create it. */
672 if (TRUNCATE_EXISTING == wdata->creation_disposition) {
673 - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!");
674 + php_error_docref(NULL, E_NOTICE, "File does not exist, creating new file!");
675
676 wdata->handle = CreateFile(filename, wdata->desired_access, 0,
677 NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
678 if (INVALID_HANDLE_VALUE == wdata->handle) {
679 - dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
680 + dio_last_error_php_error(E_WARNING, "CreateFile() failed:");
681 return 0;
682 }
683 } else {
684 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!");
685 + php_error_docref(NULL, E_WARNING, "File not found!");
686 return 0;
687 }
688 break;
689
690 default:
691 - dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
692 + dio_last_error_php_error(E_WARNING, "CreateFile() failed:");
693 return 0;
694 }
695 }
696 @@ -584,33 +584,33 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
697 /* {{{ dio_serial_init
698 * Initialises the serial port
699 */
700 -static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
701 +static int dio_serial_init(php_dio_stream_data *data) {
702 php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
703 DWORD rate_def, data_bits_def, stop_bits_def, parity_def;
704 DCB dcb;
705
706 if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
707 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate);
708 + php_error_docref(NULL, E_WARNING, "invalid data_rate value (%d)", data->data_rate);
709 return 0;
710 }
711
712 if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
713 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
714 + php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
715 return 0;
716 }
717
718 if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
719 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
720 + php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
721 return 0;
722 }
723
724 if (!dio_parity_to_define(data->parity, &parity_def)) {
725 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
726 + php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity);
727 return 0;
728 }
729
730 if (!GetCommState(wdata->handle, &(wdata->olddcb))) {
731 - dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC);
732 + dio_last_error_php_error(E_WARNING, "GetCommState() failed:");
733 return 0;
734 }
735
736 @@ -646,7 +646,7 @@ static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
737 }
738
739 if (!SetCommState(wdata->handle, &dcb)) {
740 - dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC);
741 + dio_last_error_php_error(E_WARNING, "SetCommState() failed:");
742 return 0;
743 }
744
745 @@ -698,23 +698,23 @@ int dio_serial_purge(php_dio_stream_data *data) {
746 /* {{{ dio_serial_open_stream
747 * Opens the underlying stream.
748 */
749 -int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
750 +int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) {
751 php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
752 COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 };
753
754 - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode);
755 + php_error_docref(NULL, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode);
756
757 if (*mode != 'r') {
758 - php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!");
759 + php_error_docref(NULL, E_WARNING, "You must open serial ports in read or read/write mode!");
760 return 0;
761 }
762
763 - if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
764 + if (!dio_raw_open_stream(filename, mode, data)) {
765 return 0;
766 }
767
768 if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) {
769 - dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC);
770 + dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):");
771 CloseHandle(wdata->handle);
772 return 0;
773 }
774 @@ -735,12 +735,12 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data
775 }
776
777 if (!SetCommTimeouts(wdata->handle, &cto)) {
778 - dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC);
779 + dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:");
780 CloseHandle(wdata->handle);
781 return 0;
782 }
783
784 - if (!dio_serial_init(data TSRMLS_CC)) {
785 + if (!dio_serial_init(data)) {
786 CloseHandle(wdata->handle);
787 return 0;
788 }
789 diff --git a/php_dio_common.h b/php_dio_common.h
790 index 7a75370..6af202f 100644
791 --- a/php_dio_common.h
792 +++ b/php_dio_common.h
793 @@ -39,13 +39,13 @@ php_dio_stream_data * dio_create_stream_data(void);
794
795 void dio_init_stream_data(php_dio_stream_data *data);
796
797 -void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC);
798 +void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data);
799
800 -void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC);
801 +void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data);
802
803 -void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC);
804 +void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data);
805
806 -void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC);
807 +void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data);
808
809 size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count);
810
811 @@ -55,13 +55,13 @@ int dio_common_close(php_dio_stream_data *data);
812
813 int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam);
814
815 -int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC);
816 +int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data);
817
818 int dio_serial_uninit(php_dio_stream_data *data);
819
820 int dio_serial_purge(php_dio_stream_data *data);
821
822 -int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC);
823 +int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data);
824
825 #endif /* PHP_DIO_COMMON_H_ */
826
827 --
828 2.5.0
829