You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

829 lines
32 KiB

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