Skip to content

Commit c9d5e13

Browse files
committed
TSRMLS related work on streams, as discussed with Zeev.
# Should be the last "broad" commit for a while # Don't forget to make clean ; make
1 parent 41c1c08 commit c9d5e13

23 files changed

+320
-275
lines changed

ext/exif/exif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3271,7 +3271,7 @@ PHP_FUNCTION(exif_imagetype)
32713271

32723272
rsrc_id = ZEND_REGISTER_RESOURCE(NULL, stream, php_file_le_stream());
32733273

3274-
itype = itype = php_getimagetype(stream, NULL);
3274+
itype = itype = php_getimagetype(stream, NULL TSRMLS_CC);
32753275

32763276
zend_list_delete(rsrc_id);
32773277

ext/ftp/ftp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type)
547547
char *ptr;
548548
int lastch;
549549
int rcvd;
550+
TSRMLS_FETCH();
550551

551552
if (ftp == NULL)
552553
return 0;
@@ -619,6 +620,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type)
619620
int size;
620621
char *ptr;
621622
int ch;
623+
TSRMLS_FETCH();
622624

623625
if (ftp == NULL)
624626
return 0;

ext/mailparse/mailparse.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ static void mailparse_rfc822t_errfunc(const char * msg, int num)
153153
static void mailparse_do_uudecode(php_stream * instream, php_stream * outstream)
154154
{
155155
int A, B, C, D, n;
156+
TSRMLS_FETCH();
156157

157158
while(!php_stream_eof(instream)) {
158159
UU_NEXT(n);
@@ -375,10 +376,13 @@ PHP_FUNCTION(mailparse_determine_best_xfer_encoding)
375376
static int mailparse_stream_output(int c, void *stream)
376377
{
377378
char buf = c;
379+
TSRMLS_FETCH();
380+
378381
return php_stream_write((php_stream*)stream, &buf, 1);
379382
}
380383
static int mailparse_stream_flush(void *stream)
381384
{
385+
TSRMLS_FETCH();
382386
return php_stream_flush((php_stream*)stream);
383387
}
384388

ext/standard/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ PHP_FUNCTION(get_meta_tags)
254254

255255
tok_last = TOK_EOF;
256256

257-
while (!done && (tok = php_next_meta_token(&md)) != TOK_EOF) {
257+
while (!done && (tok = php_next_meta_token(&md TSRMLS_CC)) != TOK_EOF) {
258258
if (tok == TOK_ID) {
259259
if (tok_last == TOK_OPENTAG) {
260260
md.in_meta = !strcasecmp("meta", md.token_data);
@@ -785,7 +785,7 @@ PHP_FUNCTION(socket_set_blocking)
785785
if (php_set_sock_blocking(socketd, block) == FAILURE)
786786
RETURN_FALSE;
787787

788-
php_stream_sock_set_blocking((php_stream*)what, block == 0 ? 0 : 1);
788+
php_stream_sock_set_blocking((php_stream*)what, block == 0 ? 0 : 1 TSRMLS_CC);
789789
RETURN_TRUE;
790790
}
791791
RETURN_FALSE;
@@ -832,7 +832,7 @@ PHP_FUNCTION(socket_set_timeout)
832832
t.tv_usec = 0;
833833

834834
if (php_stream_is((php_stream*)what, PHP_STREAM_IS_SOCKET)) {
835-
php_stream_sock_set_timeout((php_stream*)what, &t);
835+
php_stream_sock_set_timeout((php_stream*)what, &t TSRMLS_CC);
836836
RETURN_TRUE;
837837
}
838838

@@ -1947,7 +1947,7 @@ PHP_FUNCTION(realpath)
19471947

19481948
/* {{{ php_next_meta_token
19491949
Tokenizes an HTML file for get_meta_tags */
1950-
php_meta_tags_token php_next_meta_token(php_meta_tags_data *md)
1950+
php_meta_tags_token php_next_meta_token(php_meta_tags_data *md TSRMLS_DC)
19511951
{
19521952
int ch = 0, compliment;
19531953
char buff[META_DEF_BUFSIZE + 1];

ext/standard/file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ typedef struct _php_meta_tags_data {
100100
int in_meta;
101101
} php_meta_tags_data;
102102

103-
php_meta_tags_token php_next_meta_token(php_meta_tags_data *);
103+
php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC);
104104

105105
typedef struct {
106106
int fgetss_state;

ext/standard/fsock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
205205
int ssl_ret = FAILURE;
206206
switch(ssl_flags) {
207207
case php_ssl_v23:
208-
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, SSLv23_client_method());
208+
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, SSLv23_client_method() TSRMLS_CC);
209209
break;
210210
case php_ssl_tls:
211-
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, TLSv1_client_method());
211+
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, TLSv1_client_method() TSRMLS_CC);
212212
break;
213213
default:
214214
/* unknown ?? */

ext/standard/ftp_fopen_wrapper.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
#include "php_fopen_wrappers.h"
6868

69-
static int php_get_ftp_result(php_stream *stream)
69+
static int php_get_ftp_result(php_stream *stream TSRMLS_DC)
7070
{
7171
char tmp_line[513];
7272

@@ -85,7 +85,7 @@ php_stream_wrapper php_stream_ftp_wrapper = {
8585

8686
/* {{{ php_fopen_url_wrap_ftp
8787
*/
88-
php_stream * php_stream_url_wrap_ftp(char *path, char *mode, int options, char **opened_path STREAMS_DC)
88+
php_stream * php_stream_url_wrap_ftp(char *path, char *mode, int options, char **opened_path STREAMS_DC TSRMLS_DC)
8989
{
9090
php_stream *stream=NULL;
9191
php_url *resource=NULL;
@@ -109,7 +109,7 @@ php_stream * php_stream_url_wrap_ftp(char *path, char *mode, int options, char *
109109
goto errexit;
110110

111111
/* Start talking to ftp server */
112-
result = php_get_ftp_result(stream);
112+
result = php_get_ftp_result(stream TSRMLS_CC);
113113
if (result > 299 || result < 200)
114114
goto errexit;
115115

@@ -124,7 +124,7 @@ php_stream * php_stream_url_wrap_ftp(char *path, char *mode, int options, char *
124124
php_stream_write_string(stream, "\r\n");
125125

126126
/* get the response */
127-
result = php_get_ftp_result(stream);
127+
result = php_get_ftp_result(stream TSRMLS_CC);
128128

129129
/* if a password is required, send it */
130130
if (result >= 300 && result <= 399) {
@@ -144,14 +144,14 @@ php_stream * php_stream_url_wrap_ftp(char *path, char *mode, int options, char *
144144
php_stream_write_string(stream, "\r\n");
145145

146146
/* read the response */
147-
result = php_get_ftp_result(stream);
147+
result = php_get_ftp_result(stream TSRMLS_CC);
148148
}
149149
if (result > 299 || result < 200)
150150
goto errexit;
151151

152152
/* set the connection to be binary */
153153
php_stream_write_string(stream, "TYPE I\r\n");
154-
result = php_get_ftp_result(stream);
154+
result = php_get_ftp_result(stream TSRMLS_CC);
155155
if (result > 299 || result < 200)
156156
goto errexit;
157157

@@ -161,7 +161,7 @@ php_stream * php_stream_url_wrap_ftp(char *path, char *mode, int options, char *
161161
php_stream_write_string(stream, "\r\n");
162162

163163
/* read the response */
164-
result = php_get_ftp_result(stream);
164+
result = php_get_ftp_result(stream TSRMLS_CC);
165165
if (mode[0] == 'r') {
166166
/* when reading file, it must exist */
167167
if (result > 299 || result < 200) {

ext/standard/http_fopen_wrapper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
#define HTTP_HEADER_BLOCK_SIZE 1024
7272

7373

74-
php_stream *php_stream_url_wrap_http(char *path, char *mode, int options, char **opened_path STREAMS_DC)
74+
php_stream *php_stream_url_wrap_http(char *path, char *mode, int options, char **opened_path STREAMS_DC TSRMLS_DC)
7575
{
7676
php_stream *stream = NULL;
7777
php_url *resource = NULL;
@@ -268,7 +268,7 @@ php_stream *php_stream_url_wrap_http(char *path, char *mode, int options, char *
268268
else {
269269
strlcpy(new_path, location, sizeof(new_path));
270270
}
271-
stream = php_stream_url_wrap_http(new_path, mode, options, opened_path STREAMS_CC);
271+
stream = php_stream_url_wrap_http(new_path, mode, options, opened_path STREAMS_CC TSRMLS_CC);
272272
if (stream->wrapperdata) {
273273
entryp = &entry;
274274
MAKE_STD_ZVAL(entry);

0 commit comments

Comments
 (0)